helper

package
v0.0.0-...-753941a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPasswordHash

func CheckPasswordHash(hash, password string) bool

CheckPasswordHash will compare current password with hashed password in database

func GetEnvBool

func GetEnvBool(e string) bool

func GetEnvInt

func GetEnvInt(e string) int

func GetEnvString

func GetEnvString(e string) string

func HashPassword

func HashPassword(password string) (string, error)

HashPassword will transform from plain password into hashed password

func IsValid

func IsValid(s string) bool

IsValid will validating the password with common rules

func NewResponses

func NewResponses[T any](ctx *gin.Context, statusCode int, message string, data T, err error, meta *Meta)

NewResponses return dynamic JSON responses

func OptionsHandler

func OptionsHandler(ctx *gin.Context)

OptionsHandler will handing preflight requests

func RandomStringBytesMaskImprSrcSB

func RandomStringBytesMaskImprSrcSB(n int) string

RandomStringBytesMaskImprSrcSB will generating a unique random alphanumeric with fixed length

Types

type BaseResponse

type BaseResponse struct {
	Messages string      `json:"messages"`
	Data     interface{} `json:"data"`
	Error    error       `json:"error,omitempty"`
	Meta     *Meta       `json:"meta,omitempty"`
}

type Meta

type Meta struct {
	Page      int64 `json:"page,omitempty"`
	TotalPage int64 `json:"total_page,omitempty"`
	TotalData int64 `json:"total_data,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL