Documentation ¶
Index ¶
- Constants
- func CheckExist(src string) bool
- func CheckPermission(src string) bool
- func DefaultFieldFunc(obj any, tag string) []string
- func DefaultHeaderFunc(ctx context.Context, l LangFunc, excel *excelize.File, fieldList []string, ...) (headerCols []interface{}, err error)
- func DefaultStatusFunc(ctx context.Context, l LangFunc, fieldList []string, ...) (statusEnums map[string]map[string]string)
- func DefaultTranslateFunc(obj any, tag, desc string) map[string]string
- func Dsn(m *Mysql) string
- func FileCreate(content bytes.Buffer, name string)
- func FileMonitoringById(ctx context.Context, filePth string, id string, group string, ...)
- func Get() []string
- func GetCurrentPath() string
- func GetDBType(link string) string
- func GetExt(fileName string) string
- func GetFileSize(filename string) int64
- func GetImgType(p string) (string, error)
- func GetLocalHost() string
- func GetLocation(ctx context.Context, ip string) string
- func GetNonEmptyFields(obj interface{}, tagName string) (map[string]any, error)
- func GetSize(f multipart.File) (int, error)
- func GetTags(obj any, tagName string) []string
- func GetTagsMap(obj any, tagName, vTagName string) map[string]string
- func GetType(p string) (string, error)
- func HasLocalIP(ip net.IP) bool
- func HasLocalIPAddr(ip string) bool
- func InSlice(needle string, haystack []string) bool
- func IsNotExistMkDir(src string) error
- func IsSlice(obj any) bool
- func MkDir(src string) error
- func Open(name string, flag int, perm os.FileMode) (*os.File, error)
- func PathCreate(dir string) error
- func PathExist(addr string) bool
- func Round(f float64, n int) float64
- func SaveUploadedFile(file *multipart.FileHeader, dst string) error
- func WithExportOptionsDescTag(tag string) func(*ExportOptions)
- func WithExportOptionsErrorFunc(f ErrorFunc) func(*ExportOptions)
- func WithExportOptionsFieldFunc(f FieldFunc) func(*ExportOptions)
- func WithExportOptionsFileName(fileName string) func(*ExportOptions)
- func WithExportOptionsFinishFunc(f FinishFunc) func(*ExportOptions)
- func WithExportOptionsGraphicOptions(g *GraphicOptions) func(*ExportOptions)
- func WithExportOptionsHeaderFunc(f HeaderFunc) func(*ExportOptions)
- func WithExportOptionsI18n(i18n *gi18n.Manager) func(*ExportOptions)
- func WithExportOptionsLimitSize(limit int) func(*ExportOptions)
- func WithExportOptionsListFunc(f ListFunc) func(*ExportOptions)
- func WithExportOptionsPageSize(pageSize int) func(*ExportOptions)
- func WithExportOptionsParamsFunc(f RawFunc) func(*ExportOptions)
- func WithExportOptionsPictureFunc(f PictureFunc) func(*ExportOptions)
- func WithExportOptionsPictureKeys(keys []string) func(*ExportOptions)
- func WithExportOptionsSheetPrefix(prefix string) func(*ExportOptions)
- func WithExportOptionsSheetSize(sheetSize int) func(*ExportOptions)
- func WithExportOptionsStatusFunc(f StatusFunc) func(*ExportOptions)
- func WithExportOptionsSummaryFunc(f RawFunc) func(*ExportOptions)
- func WithExportOptionsTagName(tag string) func(*ExportOptions)
- func WithExportOptionsTotalFunc(f TotalFunc) func(*ExportOptions)
- func WithExportOptionsTranslateFunc(f TranslateFunc) func(*ExportOptions)
- type ErrorFunc
- type Export
- type ExportOptions
- type FieldFunc
- type FinishFunc
- type GraphicOptions
- type HeaderFunc
- type LangFunc
- type ListFunc
- type LocationResp
- type Mysql
- type PictureFunc
- type RawFunc
- type RawStruct
- type ReplaceHelper
- type StatusFunc
- type TotalFunc
- type TranslateFunc
Constants ¶
View Source
const ( DefaultTagName = "json" DefaultDescTag = "description" DefaultPageSize = 5000 DefaultSheetSize = 100000 DefaultLimitSize = 100000 DefaultSheetName = "Sheet" )
View Source
const (
UserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36"
)
Variables ¶
This section is empty.
Functions ¶
func DefaultFieldFunc ¶
func DefaultHeaderFunc ¶
func DefaultStatusFunc ¶
func FileCreate ¶
func FileMonitoringById ¶
func GetNonEmptyFields ¶
GetNonEmptyFields returns a map of non-empty fields of a struct
func GetTagsMap ¶
GetTagsMap returns a map of any tags of a struct
func HasLocalIP ¶ added in v2.0.13
HasLocalIP 检测 IP 地址是否是内网地址 通过直接对比ip段范围效率更高
func HasLocalIPAddr ¶ added in v2.0.13
HasLocalIPAddr 检测 IP 地址字符串是否是内网地址
func PathCreate ¶
func SaveUploadedFile ¶
func SaveUploadedFile(file *multipart.FileHeader, dst string) error
SaveUploadedFile uploads the form file to specific dst.
func WithExportOptionsDescTag ¶
func WithExportOptionsDescTag(tag string) func(*ExportOptions)
func WithExportOptionsErrorFunc ¶
func WithExportOptionsErrorFunc(f ErrorFunc) func(*ExportOptions)
func WithExportOptionsFieldFunc ¶
func WithExportOptionsFieldFunc(f FieldFunc) func(*ExportOptions)
func WithExportOptionsFileName ¶
func WithExportOptionsFileName(fileName string) func(*ExportOptions)
func WithExportOptionsFinishFunc ¶
func WithExportOptionsFinishFunc(f FinishFunc) func(*ExportOptions)
func WithExportOptionsGraphicOptions ¶
func WithExportOptionsGraphicOptions(g *GraphicOptions) func(*ExportOptions)
func WithExportOptionsHeaderFunc ¶
func WithExportOptionsHeaderFunc(f HeaderFunc) func(*ExportOptions)
func WithExportOptionsI18n ¶
func WithExportOptionsI18n(i18n *gi18n.Manager) func(*ExportOptions)
func WithExportOptionsLimitSize ¶
func WithExportOptionsLimitSize(limit int) func(*ExportOptions)
func WithExportOptionsListFunc ¶
func WithExportOptionsListFunc(f ListFunc) func(*ExportOptions)
func WithExportOptionsPageSize ¶
func WithExportOptionsPageSize(pageSize int) func(*ExportOptions)
func WithExportOptionsParamsFunc ¶
func WithExportOptionsParamsFunc(f RawFunc) func(*ExportOptions)
func WithExportOptionsPictureFunc ¶
func WithExportOptionsPictureFunc(f PictureFunc) func(*ExportOptions)
func WithExportOptionsPictureKeys ¶
func WithExportOptionsPictureKeys(keys []string) func(*ExportOptions)
func WithExportOptionsSheetPrefix ¶
func WithExportOptionsSheetPrefix(prefix string) func(*ExportOptions)
func WithExportOptionsSheetSize ¶
func WithExportOptionsSheetSize(sheetSize int) func(*ExportOptions)
func WithExportOptionsStatusFunc ¶
func WithExportOptionsStatusFunc(f StatusFunc) func(*ExportOptions)
func WithExportOptionsSummaryFunc ¶
func WithExportOptionsSummaryFunc(f RawFunc) func(*ExportOptions)
func WithExportOptionsTagName ¶
func WithExportOptionsTagName(tag string) func(*ExportOptions)
func WithExportOptionsTotalFunc ¶
func WithExportOptionsTotalFunc(f TotalFunc) func(*ExportOptions)
func WithExportOptionsTranslateFunc ¶
func WithExportOptionsTranslateFunc(f TranslateFunc) func(*ExportOptions)
Types ¶
type ExportOptions ¶
type ExportOptions struct { FileName string PageSize int SheetSize int LimitSize int SheetPrefix string TagName string DescTag string PictureKeys []string FieldFunc FieldFunc TranslateFunc TranslateFunc StatusFunc StatusFunc HeaderFunc HeaderFunc TotalFunc TotalFunc ListFunc ListFunc SummaryFunc RawFunc ParamsFunc RawFunc FinishFunc FinishFunc ErrorFunc ErrorFunc PictureFunc PictureFunc GraphicOptions *GraphicOptions // contains filtered or unexported fields }
type FinishFunc ¶
type GraphicOptions ¶
type GraphicOptions excelize.GraphicOptions
type HeaderFunc ¶
type LocationResp ¶
type LocationResp struct { Status string `json:"status"` // success Country string `json:"country"` CountryCode string `json:"countryCode"` Region string `json:"region"` RegionName string `json:"regionName"` City string `json:"city"` Zip string `json:"zip"` Lat float64 `json:"lat"` Lon float64 `json:"lon"` Timezone string `json:"timezone"` Isp string `json:"isp"` Org string `json:"org"` As string `json:"as"` Query string `json:"query"` }
type Mysql ¶
type Mysql struct { Path string `json:"path" yaml:"path"` Config string `json:"config" yaml:"config"` Dbname string `json:"dbname" yaml:"db-name"` Username string `json:"username" yaml:"username"` Password string `json:"password" yaml:"password"` MaxIdleConnes int `json:"maxIdleConnes" yaml:"max-idle-connes"` MaxOpenConnes int `json:"maxOpenConnes" yaml:"max-open-connes"` LogMode bool `json:"logMode" yaml:"log-mode"` LogZap string `json:"logZap" yaml:"log-zap"` }
type ReplaceHelper ¶
func (*ReplaceHelper) DoWork ¶
func (h *ReplaceHelper) DoWork() error
Directories ¶
Path | Synopsis |
---|---|
filelocker
Package filelocker provide an upload locker based on the local file system.
|
Package filelocker provide an upload locker based on the local file system. |
filestore
Package filestore provide a storage backend based on the local file system.
|
Package filestore provide a storage backend based on the local file system. |
memorylocker
Package memorylocker provides an in-memory locking mechanism.
|
Package memorylocker provides an in-memory locking mechanism. |
Click to show internal directories.
Click to hide internal directories.