Documentation ¶
Index ¶
- Constants
- Variables
- func Abs(v int64) int64
- func Bind(ptr any, tag string, input map[string]any) error
- func Bytes2Str(b []byte) string
- func CRC32(data string) uint32
- func CountLine(fileName string) (int, error)
- func FNV32a(data string) uint32
- func FastUuid() [24]byte
- func FastUuidStr() string
- func FillStruct(ptr any, data map[string]any)
- func FillStructByTag(ptr any, tag string, input map[string]any) (filled []string, err error)
- func Filter(params map[string]any, filters []string)
- func FindAllPrefixMatch(ss []string, prefix string) []string
- func FindFirst(n int, pred func(i int) bool) int
- func FindLast(n int, pred func(i int) bool) int
- func GetBool(v any) bool
- func GetByKind(kind reflect.Kind, v any) (result any)
- func GetByteArray(v any) []byte
- func GetDayRangeOfMonth(date time.Time) (firstDay, lastDay time.Time)
- func GetExternalIP() string
- func GetFloat32(v any) float32
- func GetFloat64(v any) float64
- func GetInt(v any) int
- func GetInt16(v any) int16
- func GetInt32(v any) int32
- func GetInt64(v any) int64
- func GetInt64Slices(v any) []int64
- func GetInt8(v any) int8
- func GetIntSlices(v any) []int
- func GetMonthsOfDayRange(layout string, beginDay, endDay time.Time) []string
- func GetPanicStack() string
- func GetStack(calldepth int) []byte
- func GetString(v any) string
- func GetTimeRangeOfDay(t time.Time) (begin, end time.Time)
- func GetUint(v any) uint
- func GetUint16(v any) uint16
- func GetUint32(v any) uint32
- func GetUint64(v any) uint64
- func GetUint64Slices(v any) []uint64
- func GetUint8(v any) uint8
- func IsAllLetters(input string) bool
- func IsAllNumberLetters(input string) bool
- func IsAllNumbers(input string) bool
- func IsErrClosing(err error) bool
- func IsFileExists(fileName string) (exists bool, err error)
- func IsType(value reflect.Value, expected reflect.Type) bool
- func JoinSlice(slice any, sep string) string
- func LocatePanic() string
- func Milliseconds(t time.Time) int64
- func ParseJSON(data []byte, ptr any) error
- func Rand(min, max int) int
- func RandString(n int, letterBytes string) string
- func RepeatWithSep(s string, sep string, count int) string
- func SetDefaults(ptr any) error
- func Split(str string, sep string) (r []string)
- func Str2Bytes(s string) []byte
- func StringJoin(params ...any) string
- func StringsToInterfaces(keys []string) []any
- func TimeInUTCOffset(t time.Time, utcOffset int) time.Time
- func TimeLocationOfUTCOffset(utcOffset int) *time.Location
- func ToCamel(s string) string
- func ToCamelLower(s string) string
- func ToJSON(v any) string
- func ToSnake(s string) string
- func TouchFile(fileName string) error
- func TrimUntil(s string, stop string) string
- type BindUnmarshaler
Constants ¶
const ( LettersAlphaNumber = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" LettersNumber = "0123456789" LettersAlpha = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" )
Variables ¶
var BindSliceSep = ","
BindSliceSep the separator for parsing slice field
Functions ¶
func FastUuidStr ¶ added in v1.0.27
func FastUuidStr() string
FastUuidStr generate a new UUID as string
func FillStruct ¶
FillStruct set the field value of ptr according data kv map.
func FillStructByTag ¶
FillStructByTag set the field value of struct s according
func FindAllPrefixMatch ¶ added in v1.0.35
FindAllPrefixMatch return all item in sorted string slice has the specified prefix.
func FindFirst ¶ added in v1.0.36
FindFirst return the first index that pred(i) is true. If not found, return n.
func FindLast ¶ added in v1.0.36
FindLast return the last index that pred(i) is true. If not found, return -1.
func GetDayRangeOfMonth ¶
GetDayRangeOfMonth [firstDay, lastDay]
func GetExternalIP ¶
func GetExternalIP() string
GetExternalIP return the first available external ip address
func GetInt64Slices ¶
GetInt64Slices convert interface to []int64
func GetMonthsOfDayRange ¶
GetMonthsOfDayRange return the month string of day range [beginDay, endDay]
func GetPanicStack ¶
func GetPanicStack() string
GetPanicStack return the panic stack trace as string
func GetTimeRangeOfDay ¶
GetTimeRangeOfDay [begin, end)
func GetUint64Slices ¶
GetUint64Slices convert interface to []uint64
func IsAllLetters ¶ added in v1.0.32
IsAllLetters return true if input contains only letters.
func IsAllNumberLetters ¶ added in v1.0.32
IsAllNumberLetters return true if input contains only numbers or letters.
func IsAllNumbers ¶ added in v1.0.32
IsAllNumbers return true if input contains only numbers.
func IsErrClosing ¶
IsErrClosing return true if err indicates socket is closing
func IsFileExists ¶
func Milliseconds ¶
Milliseconds return the milliseconds of time
func RandString ¶
RandString return a random string of length n
func RepeatWithSep ¶
RepeatWithSep repeat the `s` `count` times, and separated by `sep`
func SetDefaults ¶
SetDefaults set the default value by tag `default:"value"`
func StringsToInterfaces ¶
StringsToInterfaces convert to []string to []interface{}
func TimeInUTCOffset ¶
TimeInUTCOffset return time in specified utc offset
func TimeLocationOfUTCOffset ¶
TimeLocationOfUTCOffset return the time.Location of utc offset
func ToCamelLower ¶
ToCamelLower returns a string converted from snake case to lowercase
Types ¶
type BindUnmarshaler ¶
BindUnmarshaler the bind unmarshal interface