help

package
v0.0.0-...-78f3228 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2023 License: Apache-2.0 Imports: 15 Imported by: 29

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeepCopy

func DeepCopy(in, out interface{})

func GobDecode

func GobDecode(encoded []byte, i interface{}) error

func GobEncode

func GobEncode(obj interface{}) ([]byte, error)

func IsBlank

func IsBlank(v reflect.Value) bool

func SetCookie

func SetCookie(w http.ResponseWriter, target map[string]string, args ...interface{}) *http.Cookie

cookie[0] => name string cookie[1] => value string cookie[2] => path string cookie[3] => domain string cookie[4] => expires int cookie[5] => maxAge int cookie[6] => secure bool cookie[7] => httpOnly bool cookie[8] => sameSite http.SameSite

Types

type Date

type Date struct {
	time.Time
}

func (Date) String

func (d Date) String() string

type DateTime

type DateTime struct {
	time.Time
}

func (DateTime) String

func (d DateTime) String() string

type M

type M map[string]interface{}

func (M) DeepCopy

func (m M) DeepCopy() (nm M)

func (M) MapToStruct

func (m M) MapToStruct(s interface{})

convert map to struct

type Slice

type Slice struct {
	I interface{}
}

func NewSlice

func NewSlice(i interface{}) Slice

func (Slice) CheckDigital

func (s Slice) CheckDigital(digital int) bool

func (Slice) CheckItem

func (s Slice) CheckItem(item string) bool

func (Slice) CheckMustDigital

func (s Slice) CheckMustDigital(digital int, digitals ...int) bool

func (Slice) CheckMustItem

func (s Slice) CheckMustItem(item string, items ...string) bool

func (Slice) CheckPartDigital

func (s Slice) CheckPartDigital(digital int, digitals ...int) bool

func (Slice) CheckPartItem

func (s Slice) CheckPartItem(item string, items ...string) bool

func (Slice) ConvBool

func (s Slice) ConvBool() []bool

func (Slice) ConvInt

func (s Slice) ConvInt() []int

func (Slice) ConvObjectID

func (s Slice) ConvObjectID() []primitive.ObjectID

func (Slice) ObjectIDToStrings

func (s Slice) ObjectIDToStrings() []string

func (Slice) SliceToMap

func (s Slice) SliceToMap(is ...interface{}) M

convert slice to map

type Strings

type Strings string

func NewString

func NewString(i interface{}) Strings

func (Strings) GenerateSecret

func (s Strings) GenerateSecret(secret string) string

func (Strings) Md5

func (s Strings) Md5() string

func (Strings) PluralizeString

func (s Strings) PluralizeString() string

func (Strings) RandMixed

func (s Strings) RandMixed(width int) string

func (Strings) RandNumber

func (s Strings) RandNumber(width int) string

func (Strings) RandString

func (s Strings) RandString(width int) string

func (Strings) SnakeCasedName

func (s Strings) SnakeCasedName() string

convert like this: "HelloWorld" to "hello_world"

func (Strings) SnakeCasedNameByDelimiterStyle

func (s Strings) SnakeCasedNameByDelimiterStyle(delimiterStyle rune) string

delimiterStyle: '-' convert like this: "HelloWorld" to "hello-world"

func (Strings) String

func (s Strings) String() string

func (Strings) TitleCasedName

func (s Strings) TitleCasedName() string

convert like this: "hello_world" to "HelloWorld"

func (Strings) TitleCasedNameByDelimiterStyle

func (s Strings) TitleCasedNameByDelimiterStyle(delimiterStyle rune) string

delimiterStyle: '-' convert like this: "hello-world" to "HelloWorld"

func (Strings) TrimSide

func (s Strings) TrimSide(cutset string) string

type Struct

type Struct struct {
	I interface{}
	// contains filtered or unexported fields
}

func NewStruct

func NewStruct(i interface{}) Struct

func (Struct) CompatibleTag

func (s Struct) CompatibleTag(tag string) Struct

func (Struct) GetTypeName

func (s Struct) GetTypeName() string

func (Struct) RawStructToMap

func (s Struct) RawStructToMap(snakeCasedKey bool) M

convert struct to map s must to be struct, can not be a pointer

func (Struct) StructName

func (s Struct) StructName() string

func (Struct) StructToMap

func (s Struct) StructToMap() M

convert struct to map

func (Struct) StructToSnakeKeyMap

func (s Struct) StructToSnakeKeyMap() M

convert struct to map but struct's field name to snake cased map key

func (Struct) UseTag

func (s Struct) UseTag(tag string) Struct

type Time

type Time struct {
	Layout string
	Zone   string
}

func NewTime

func NewTime() *Time

func (*Time) StrToUnix

func (t *Time) StrToUnix(s string) int64

func (*Time) UnixToStr

func (t *Time) UnixToStr(n int64, layouts ...string) string

Jump to

Keyboard shortcuts

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