Documentation
¶
Index ¶
- Variables
- func CreateDir(dirs ...string) (err error)
- func FormatToString(originStr interface{}) string
- func GenerateBaseSnowId(num int, n *snowflake.Node) string
- func GeneratePasswordHash(password string, salt string) string
- func GenerateUuid(size int) string
- func GetIpAddr() string
- func GetProjectModuleName() string
- func GetStructColumnName(s interface{}, _type int) ([]string, error)
- func InAnySlice[T string | int | int64 | float32 | float64](haystack []T, needle T) bool
- func IsPathExist(path string) bool
- func MakeFileOrPath(path string) bool
- func MakeMultiDir(filePath string) error
- func ParseURL(str string, component int) (map[string]string, error)
- func PathExists(path string) (bool, error)
- func String2Int(strArr []string) []int
- func SubStr(str string, start int, length ...int) (substr string)
- type FileHeader
- type Fn
- type FormatTime
- type MyTicker
- type TreeList
- type Zap
Constants ¶
This section is empty.
Variables ¶
View Source
var ( MaxUploadSize = 10 * 1024 * 1024 AllowTypes = []string{"jpg", "jpeg", "png", "svg", "gif", "bmp", "mp3", "mp4", "avi", "pdf", "xls", "xlsx", "ppt", "doc", "docx"} )
最大上传资源大小是10M
Functions ¶
func GenerateBaseSnowId ¶
GenerateBaseSnowId 生成雪花算法ID
func GeneratePasswordHash ¶
GeneratePasswordHash 生成密码hash值
func GetStructColumnName ¶
GetStructColumnName 获取结构体中的字段名称 _type: 1: 获取tag字段值 2:获取结构体字段值
func InAnySlice ¶
InAnySlice 判断某个字符串是否在字符串切片中
Types ¶
type FileHeader ¶
type FileHeader struct { Filename string `json:"file_name"` // 图片新名称 FileSize int64 `json:"file_size"` // 图片大小 FilePath string `json:"file_path"` // 相对路径地址 OriginName string `json:"origin_name"` // 图片原名称 MimeType string `json:"mime_type"` // 附件mime类型 Extension string `json:"extension"` // 附件后缀名 }
func UploadFile ¶
func UploadFile(path string, ctx *app.RequestContext) (*FileHeader, error)
UploadFile 上传图片
type FormatTime ¶
func (FormatTime) MarshalJSON ¶
func (t FormatTime) MarshalJSON() ([]byte, error)
MarshalJSON 实现时间的json序列化
func (*FormatTime) Scan ¶
func (t *FormatTime) Scan(v interface{}) error
Scan implements the Scanner interface
func (*FormatTime) UnmarshalJSON ¶
func (t *FormatTime) UnmarshalJSON(b []byte) error
UnmarshalJSON 反序列化
type TreeList ¶
type Zap ¶
type Zap struct { Level string `yaml:"level"` // 级别 Prefix string `yaml:"prefix"` // 日志前缀 Format string `yaml:"format"` // 输出 Director string `yaml:"director"` // 日志文件夹 EncodeLevel string `yaml:"encodeLevel"` // 编码级 StacktraceKey string `yaml:"stacktraceKey"` // 栈名 MaxAge int `yaml:"maxAge"` // 日志留存时间 ShowLine bool `yaml:"showLine"` // 显示行 LogInConsole bool `yaml:"logInConsole"` // 输出控制台 }
func (*Zap) TransportLevel ¶
TransportLevel 根据字符串转化为 zapcore.Level Author [SliverHorn](https://github.com/SliverHorn)
func (*Zap) ZapEncodeLevel ¶
func (z *Zap) ZapEncodeLevel() zapcore.LevelEncoder
ZapEncodeLevel 根据 EncodeLevel 返回 zapcore.LevelEncoder Author [SliverHorn](https://github.com/SliverHorn)
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
Package utils provides some utility functions for internal usage.
|
Package utils provides some utility functions for internal usage. |
Package empty provides functions for checking empty/nil variables.
|
Package empty provides functions for checking empty/nil variables. |
encoding
|
|
gbinary
Package gbinary provides useful API for handling binary/bytes data.
|
Package gbinary provides useful API for handling binary/bytes data. |
Package gconv implements powerful and convenient converting functionality for any types of variables.
|
Package gconv implements powerful and convenient converting functionality for any types of variables. |
Package gstructs provides functions for struct information retrieving.
|
Package gstructs provides functions for struct information retrieving. |
Package gtag providing tag content storing for struct.
|
Package gtag providing tag content storing for struct. |
Package gtime provides functionality for measuring and displaying time.
|
Package gtime provides functionality for measuring and displaying time. |
Package json provides json operations wrapping ignoring stdlib or third-party lib json.
|
Package json provides json operations wrapping ignoring stdlib or third-party lib json. |
Package reflection provides some reflection functions for internal usage.
|
Package reflection provides some reflection functions for internal usage. |
text
|
|
gregex
Package gregex provides high performance API for regular expression functionality.
|
Package gregex provides high performance API for regular expression functionality. |
gstr
Package gstr provides functions for string handling.
|
Package gstr provides functions for string handling. |
Click to show internal directories.
Click to hide internal directories.