Documentation
¶
Index ¶
- func BodyDump(ignore ...string) echo.MiddlewareFunc
- func ConvertType(sourceValue any, targetType reflect.Type) (any, error)
- func CopyMap[K comparable, V any](src map[K]V) map[K]V
- func EndOfDay(t time.Time) time.Time
- func EndOfHour(t time.Time) time.Time
- func EndOfMonth(t time.Time) time.Time
- func EndOfYear(t time.Time) time.Time
- func FloorDay(t time.Time) time.Time
- func FloorHour(t time.Time) time.Time
- func FloorMonth(t time.Time) time.Time
- func FloorYear(t time.Time) time.Time
- func GenerateGJWToken(password, deviceid, userid, issuer string, roles []string, ...) (string, error)
- func GenerateGJWTokenWithTime(password string, deviceid string, userid string, issuer string, roles []string, ...) (string, error)
- func GenerateRandomStr(charset string, length int) (string, error)
- func GenerateServerToken(password, systemid, userid, issuer string, roles []string, ...) (string, error)
- func GenerateServerTokenWithTime(password string, systemid string, userid string, issuer string, roles []string, ...) (string, error)
- func GetContentType(ext string) string
- func ImplementsInterface(target reflect.Type, theInterface reflect.Type) bool
- func IsArrayType(target reflect.Type) bool
- func IsConvertible(sourceValue any, targetType reflect.Type) bool
- func IsEmptyStr(target *string) bool
- func IsErrorObj(target interface{}) bool
- func IsErrorType(target reflect.Type) bool
- func IsFuncType(target reflect.Type) bool
- func IsInterfaceType(target reflect.Type) bool
- func IsPointerType(target reflect.Type) bool
- func IsStructType(target reflect.Type) bool
- func ToPtr[T interface{}](source T) *T
- func Unused(_ ...interface{})
- func ValueOrZeroOf[T interface{}](ptr *T) T
- type GJWCustomClaims
- type GJWTokenPayload
- type Optional
- type ServerCustomClaims
- type ServerTokenPayload
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BodyDump ¶
func BodyDump(ignore ...string) echo.MiddlewareFunc
func CopyMap ¶
func CopyMap[K comparable, V any](src map[K]V) map[K]V
CopyMap returns a shallow copy of src. Returns nil if src is nil.
func GenerateGJWToken ¶
func GenerateServerToken ¶
func GetContentType ¶
func ImplementsInterface ¶
func IsArrayType ¶
func IsEmptyStr ¶
func IsErrorObj ¶
func IsErrorObj(target interface{}) bool
func IsErrorType ¶
func IsFuncType ¶
func IsInterfaceType ¶
func IsPointerType ¶
func IsStructType ¶
func Unused ¶
func Unused(_ ...interface{})
Unused is for avoiding unused variable error, in case you want to run debugging and inspect the variable value. Example:
svc := NewService(); utility.Unused(svc); // Now put breakpoint and run debugger here.
func ValueOrZeroOf ¶
func ValueOrZeroOf[T interface{}](ptr *T) T
Types ¶
type GJWCustomClaims ¶
type GJWCustomClaims struct {
UserId string `json:"userid,omitempty"`
DId string `json:"did,omitempty"`
Roles []string `json:"roles"`
jwt.RegisteredClaims
}
type GJWTokenPayload ¶
type GJWTokenPayload struct {
UserId string `json:"userid,omitempty"`
DId string `json:"did,omitempty"`
Roles []string `json:"roles"`
}
func ParseGJWToken ¶
func ParseGJWToken(tokenString string, password string) (*GJWTokenPayload, error)
type Optional ¶
type Optional[T any] struct { // contains filtered or unexported fields }
Optional distinguishes three JSON states for the same field:
- Absent : key is missing from the JSON body. IsSet() == false.
- Null : key is present with value `null`. IsSet() == true, Get() == nil.
- Value : key is present with a real value. IsSet() == true, Get() != nil.
Use it in DTOs when partial-update semantics are required so the mapper can skip the field entirely on absence, clear it on null, or set it on value.
func NewOptional ¶
func NewOptionalNull ¶
func (Optional[T]) MarshalJSON ¶
func (*Optional[T]) UnmarshalJSON ¶
type ServerCustomClaims ¶
type ServerCustomClaims struct {
SystemId string `json:"systemid"`
UserId string `json:"userid"`
Roles []string `json:"roles"`
jwt.RegisteredClaims
}
type ServerTokenPayload ¶
Click to show internal directories.
Click to hide internal directories.