utils

package
v0.0.0-...-48fb7be Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MonthDay = []int{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}

Functions

func CmpAge

func CmpAge(birthday time.Time) int

func GetCompanyId

func GetCompanyId(c *gin.Context) string

GetCompanyId 获取企业company的uuid

func GetMonthFirstDayLocal

func GetMonthFirstDayLocal(t time.Time) time.Time

func GetMonthFirstDayLocation

func GetMonthFirstDayLocation(t time.Time, location *time.Location) time.Time

func GetMonthLen

func GetMonthLen(t time.Time) int

func GetSub

func GetSub(c *gin.Context) int

func GetUserId

func GetUserId(c *gin.Context) string

GetUserId 获取用户的uuid

func GetWeekFirstDayLocal

func GetWeekFirstDayLocal(t time.Time) time.Time

func GetWeekFirstDayLocation

func GetWeekFirstDayLocation(t time.Time, location *time.Location) time.Time

func GetZoreTimeLocal

func GetZoreTimeLocal(t time.Time) time.Time

func GetZoreTimeLocation

func GetZoreTimeLocation(t time.Time, location *time.Location) time.Time

func MoneyFmt

func MoneyFmt(m float64) string

Types

type CustomClaims

type CustomClaims struct {
	UserId               int    `json:"uid,omitempty"`
	RoleId               int    `json:"rid,omitempty"`
	Phone                string `json:"mob,omitempty"`
	Nickname             string `json:"nick,omitempty"`
	JwtData              map[string]any
	jwt.RegisteredClaims // 内嵌标准的声明
}

AdminCustomClaims 自定义格式内容

func NewClaims

func NewClaims(userId int, expiresAt time.Time, issuer, subject string) CustomClaims

NewAdminCustomClaims 初始化AdminCustomClaims

func (*CustomClaims) AddData

func (c *CustomClaims) AddData(key string, val any) *CustomClaims

func (*CustomClaims) ExpiresAt

func (c *CustomClaims) ExpiresAt(expiresAt time.Time) *CustomClaims

func (*CustomClaims) GetInt

func (c *CustomClaims) GetInt(key string) int

func (*CustomClaims) GetString

func (c *CustomClaims) GetString(key string) string

type LocalTime

type LocalTime time.Time

func (*LocalTime) IsZero

func (t *LocalTime) IsZero() bool

func (LocalTime) MarshalJSON

func (t LocalTime) MarshalJSON() ([]byte, error)

func (*LocalTime) Scan

func (t *LocalTime) Scan(v interface{}) error

func (*LocalTime) String

func (t *LocalTime) String() string

func (*LocalTime) UnmarshalJSON

func (t *LocalTime) UnmarshalJSON(data []byte) error

func (LocalTime) Value

func (t LocalTime) Value() (driver.Value, error)

type StringBuilder

type StringBuilder struct {
	// contains filtered or unexported fields
}

func NewSB

func NewSB() *StringBuilder

func (*StringBuilder) Append

func (s *StringBuilder) Append(str string) *StringBuilder

func (*StringBuilder) AppendByte

func (s *StringBuilder) AppendByte(b byte) *StringBuilder

func (*StringBuilder) AppendBytes

func (s *StringBuilder) AppendBytes(bs []byte) *StringBuilder

func (*StringBuilder) String

func (s *StringBuilder) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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