Documentation
¶
Index ¶
- Constants
- func ApiSign(url string, secret string) string
- func Average(xs []float64) (avg float64)
- func Camel2Case(name string) string
- func Case2Camel(name string) string
- func CatchErr(err error, errCode fmt.Stringer) bool
- func CheckErr(err error) bool
- func ConvertStringUTC(t string) string
- func ConvertUTC(t time.Time) string
- func DebugResponse(err error, errCode fmt.Stringer, debugMsg string)
- func Decimal(value float64) float64
- func GetApiServer(url string) string
- func GetDayRangeList(startDate string, endDate string) ([]string, error)
- func GetDayStringSub(startDate string, endDate string) int
- func GetDaySub(startDate time.Time, endDate time.Time) int
- func GetGenerator(db *gorm.DB) *gen.Generator
- func GetGeneratorOptions() []gen.ModelOpt
- func GetImgBase64String(image string) (string, error)
- func GetMonthRangeList(startDate string, endDate string) []string
- func GetStructField(ptr any) []string
- func GetStructMap(data any) map[string]any
- func GetTimeDuration(startTime int64, endTime int64) int64
- func GetWeekRangeList(startDate string, endDate string) []string
- func GetYearDay(date time.Time) int
- func HasErr(err error, errCode fmt.Stringer) bool
- func HasQueryErr(err error, errCode fmt.Stringer) bool
- func HasWar(err error, errCode fmt.Stringer) bool
- func IsStaticRequest(context *gin.Context) bool
- func JsonDisplay(obj any)
- func JsonString(params any) string
- func LcFirst(str string) string
- func MaxNum(arr []int) (max int, maxIndex int)
- func MinNum(arr []int) (min int, minIndex int)
- func OpenFreeUDPPort(portBase int, num int) (net.PacketConn, int, error)
- func RandString(length int) string
- func RequestSign(ts string, secret string) string
- func RpcSign(secret string) (string, int64)
- func SetStructField(ptr any, fields map[string]string)
- func Sign(params map[string]any, secret string) string
- func SignParams(paramsStruct any, secret string) map[string]any
- func Success(status int) bool
- func ToHump(str string) string
- func ToLine(str string) string
- func TransDateArr(start string, end string) []string
- func TransDateFormat(dateTime string, template string) (string, error)
- func TransInterfaceToMap(params any) map[string]any
- func TransJsonString(source []byte) []byte
- func TransStrToImage(sourceString string, imageName string) error
- func TransStruct[T any](source any, target T) error
- func TransToByte(params any) []byte
- func UcFirst(str string) string
- type Buffer
- type ImageUtil
- type JsonCamelCase
- type JsonSnakeCase
- type WeekDate
Constants ¶
View Source
const ( // DateTimeTemplate 日期时间模板 DateTimeTemplate = "2006-01-02 15:04:05" ZeroTimeTemplate = "2006-01-02 00:00:00" DateTemplate = "2006-01-02" OnlyTimeTemplate = "15:04:05" ParseTimeTemplate = "2006-01-02T15:04:05+08:00" YearMonthTemplate = "2006-01" )
View Source
const DateFormat = "2006-01-02"
DateFormat
View Source
const MonthFormat = "2006-01"
MonthFormat 月份模板
Variables ¶
This section is empty.
Functions ¶
func GetApiServer ¶
func GetDayRangeList ¶
GetDayRangeList 获取日期区间数据
func GetDayStringSub ¶
GetDayStringSub 获取两个日期的天数之差
func GetGenerator ¶ added in v0.2.3
GetGenerator 获取生成器
func GetGeneratorOptions ¶ added in v0.2.3
func GetImgBase64String ¶
func GetMonthRangeList ¶
GetMonthRangeList 月份区间
func GetStructField ¶
func GetStructMap ¶
func GetTimeDuration ¶
GetTimeDuration 获取时间区间
func GetWeekRangeList ¶
GetWeekRangeList 将开始时间和结束时间分割为周为单位
func JsonDisplay ¶
func JsonDisplay(obj any)
func JsonString ¶
func OpenFreeUDPPort ¶
OpenFreeUDPPort opens free UDP port This example does not actually use UDP ports, but to avoid port collisions with the HTTP server, it binds the same number of UDP port in advance.
func RandString ¶
func RequestSign ¶
func SetStructField ¶
func TransDateFormat ¶
TransDateFormat 时间日期转换
func TransInterfaceToMap ¶
TransInterfaceToMap 转换struct 等结构到map
func TransJsonString ¶ added in v0.2.1
func TransStrToImage ¶
TransStrToImage base64 字符串转图片
func TransStruct ¶ added in v0.2.4
TransStruct 转换struct
func TransToByte ¶
Types ¶
type ImageUtil ¶
type ImageUtil struct {
// contains filtered or unexported fields
}
func NewImageUtil ¶
func NewImageUtil() *ImageUtil
type JsonCamelCase ¶ added in v0.2.1
type JsonCamelCase struct {
Value interface{}
}
func (JsonCamelCase) MarshalJSON ¶ added in v0.2.1
func (c JsonCamelCase) MarshalJSON() ([]byte, error)
type JsonSnakeCase ¶ added in v0.2.1
type JsonSnakeCase struct {
Value interface{}
}
func (JsonSnakeCase) MarshalJSON ¶ added in v0.2.1
func (c JsonSnakeCase) MarshalJSON() ([]byte, error)
func (JsonSnakeCase) UnmarshalJSON ¶ added in v0.2.1
func (c JsonSnakeCase) UnmarshalJSON(b []byte) error
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
Package concurrency contain some functions to support concurrent programming.
|
Package concurrency contain some functions to support concurrent programming. |
Package condition contains some functions for conditional judgment.
|
Package condition contains some functions for conditional judgment. |
Package convertor implements some functions to convert data.
|
Package convertor implements some functions to convert data. |
Package cryptor implements some util functions to encrypt and decrypt.
|
Package cryptor implements some util functions to encrypt and decrypt. |
Package datastructure implements some data structure.
|
Package datastructure implements some data structure. |
hashmap
Package datastructure implements some data structure.
|
Package datastructure implements some data structure. |
heap
Package datastructure implements some data structure.
|
Package datastructure implements some data structure. |
list
Package datastructure implements some data structure.
|
Package datastructure implements some data structure. |
Package datetime implements some functions to format date and time.
|
Package datetime implements some functions to format date and time. |
Package fileutil implements some basic functions for file operations
|
Package fileutil implements some basic functions for file operations |
Package formatter implements some functions to format string, struct.
|
Package formatter implements some functions to format string, struct. |
Package function implements some functions for control the function execution and some is for functional programming.
|
Package function implements some functions for control the function execution and some is for functional programming. |
Package internal is for internal use.
|
Package internal is for internal use. |
Package iterator provides a way to iterate over values stored in containers.
|
Package iterator provides a way to iterate over values stored in containers. |
Package lancetconstraints contain some comstomer constraints.
|
Package lancetconstraints contain some comstomer constraints. |
Package maputil includes some functions to manipulate map.
|
Package maputil includes some functions to manipulate map. |
Package mathutil implements some functions for math calculation.
|
Package mathutil implements some functions for math calculation. |
Package netutil implements some basic functions to send http request and get ip info.
|
Package netutil implements some basic functions to send http request and get ip info. |
Package random implements some basic functions to generate random int and string.
|
Package random implements some basic functions to generate random int and string. |
Package retry is for executing a function repeatedly until it was successful or canceled by the context.
|
Package retry is for executing a function repeatedly until it was successful or canceled by the context. |
Package slice implements some functions to manipulate slice.
|
Package slice implements some functions to manipulate slice. |
Package strutil implements some functions to manipulate string.
|
Package strutil implements some functions to manipulate string. |
Package system contain some functions about os, runtime, shell command.
|
Package system contain some functions about os, runtime, shell command. |
Package validator implements some validate function for string.
|
Package validator implements some validate function for string. |
Package xerror implements helpers for errors
|
Package xerror implements helpers for errors |
Click to show internal directories.
Click to hide internal directories.