utils

package
v0.0.0-...-ea214e1 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultMessage = "[Error for gin.Context]"

Variables

This section is empty.

Functions

func ComparePassword

func ComparePassword(digest string, password string) bool

func EncryptPassword

func EncryptPassword(password string) (string, error)

func ErrorNotFound

func ErrorNotFound(c *gin.Context, id int64)

func LogError

func LogError(c *gin.Context, err error)

func LogErrorMsg

func LogErrorMsg(c *gin.Context, err error, message string)

func LogInvalidAdmin

func LogInvalidAdmin(c *gin.Context)

func LogInvalidUser

func LogInvalidUser(c *gin.Context)

func RandomHex

func RandomHex(length int) string

func ToCamel

func ToCamel(s string) string

func Trim

func Trim(s string, trimType TrimType) string

func TrimFull

func TrimFull(s string) string

Types

type Date

type Date struct {
	Year  int        `json:"year"`
	Month time.Month `json:"month"`
	Day   int        `json:"day"`
}

func Today

func Today() Date

func (Date) Yesterday

func (d Date) Yesterday() Date

type Timestamp

type Timestamp time.Time

func (Timestamp) MarshalJSON

func (ts Timestamp) MarshalJSON() ([]byte, error)

type TrimType

type TrimType int
const (
	None TrimType = iota
	Left
	Right
	Full
)

Jump to

Keyboard shortcuts

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