Documentation ¶
Index ¶
- Constants
- Variables
- func Abs(v int64) int64
- func Bind(ptr interface{}, tag string, input map[string]interface{}) 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 interface{}, data map[string]interface{})
- func FillStructByTag(ptr interface{}, tag string, input map[string]interface{}) (filled []string, err error)
- func Filter(params map[string]interface{}, filters []string)
- func GetBool(v interface{}) bool
- func GetByKind(kind reflect.Kind, v interface{}) (result interface{})
- func GetByteArray(v interface{}) []byte
- func GetDayRangeOfMonth(date time.Time) (firstDay, lastDay time.Time)
- func GetExternalIP() string
- func GetFloat32(v interface{}) float32
- func GetFloat64(v interface{}) float64
- func GetInt(v interface{}) int
- func GetInt16(v interface{}) int16
- func GetInt32(v interface{}) int32
- func GetInt64(v interface{}) int64
- func GetInt64Slices(v interface{}) []int64
- func GetInt8(v interface{}) int8
- func GetIntSlices(v interface{}) []int
- func GetMonthsOfDayRange(layout string, beginDay, endDay time.Time) []string
- func GetPanicStack() string
- func GetStack(calldepth int) []byte
- func GetString(v interface{}) string
- func GetTimeRangeOfDay(t time.Time) (begin, end time.Time)
- func GetUint(v interface{}) uint
- func GetUint16(v interface{}) uint16
- func GetUint32(v interface{}) uint32
- func GetUint64(v interface{}) uint64
- func GetUint64Slices(v interface{}) []uint64
- func GetUint8(v interface{}) uint8
- func IsEmptyValue(v reflect.Value) 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 interface{}, sep string) string
- func LocatePanic() string
- func Max(vals ...int) int
- func Milliseconds(t time.Time) int64
- func Min(vals ...int) int
- func ParseJSON(data []byte, ptr interface{}) 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 interface{}) error
- func Split(str string, sep string) (r []string)
- func Str2Bytes(s string) []byte
- func StringJoin(params ...interface{}) string
- func StringsToInterfaces(keys []string) []interface{}
- 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 interface{}) string
- func ToSnake(s string) string
- func TouchFile(fileName string) error
- func TrimUntil(s string, stop string) string
- type BindUnmarshaler
Constants ¶
const ( AlphaNumber = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" Number = "0123456789" Alpha = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" )
Variables ¶
var BindSliceSep = ","
BindSliceSep the separator for parsing slice field
Functions ¶
func FillStruct ¶
func FillStruct(ptr interface{}, data map[string]interface{})
FillStruct set the field value of ptr according data kv map.
func FillStructByTag ¶
func FillStructByTag(ptr interface{}, tag string, input map[string]interface{}) (filled []string, err error)
FillStructByTag set the field value of struct s according
func GetByteArray ¶
func GetByteArray(v interface{}) []byte
GetByteArray convert interface to byte slice.
func GetDayRangeOfMonth ¶ added in v1.2.0
GetDayRangeOfMonth [firstDay, lastDay]
func GetExternalIP ¶
func GetExternalIP() string
GetExternalIP return the first available external ip address
func GetInt64Slices ¶
func GetInt64Slices(v interface{}) []int64
GetInt64Slices convert interface to []int64
func GetMonthsOfDayRange ¶ added in v1.2.0
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 ¶ added in v1.2.0
GetTimeRangeOfDay [begin, end)
func GetUint64Slices ¶
func GetUint64Slices(v interface{}) []uint64
GetUint64Slices convert interface to []uint64
func IsEmptyValue ¶
IsEmptyValue return true if the value is zero value
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 ¶
func SetDefaults(ptr interface{}) error
SetDefaults set the default value by tag `default:"value"`
func StringJoin ¶
func StringJoin(params ...interface{}) string
StringJoin join slice to single string
func StringsToInterfaces ¶
func StringsToInterfaces(keys []string) []interface{}
StringsToInterfaces convert to []string to []interface{}
func TimeInUTCOffset ¶ added in v1.2.0
TimeInUTCOffset return time in specified utc offset
func TimeLocationOfUTCOffset ¶ added in v1.2.0
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