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 IsNotExistMkDir(src string) error
- 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 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 WithExportOptionsRespItemStruct(obj any) 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 HeaderFunc
- type LangFunc
- type ListFunc
- type LocationResp
- type Mysql
- 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 ¶ added in v1.1.20
func DefaultHeaderFunc ¶ added in v1.1.20
func DefaultStatusFunc ¶ added in v1.1.20
func DefaultTranslateFunc ¶ added in v1.1.20
func FileCreate ¶
func FileMonitoringById ¶
func GetNonEmptyFields ¶ added in v1.1.20
GetNonEmptyFields returns a map of non-empty fields of a struct
func GetTagsMap ¶ added in v1.1.20
GetTagsMap returns a map of any tags of a struct
func IsNotExistMkDir ¶ added in v0.4.1
IsNotExistMkDir 检查文件夹是否存在 如果不存在则新建文件夹
func PathCreate ¶
func SaveUploadedFile ¶
func SaveUploadedFile(file *multipart.FileHeader, dst string) error
SaveUploadedFile uploads the form file to specific dst.
func WithExportOptionsDescTag ¶ added in v1.1.20
func WithExportOptionsDescTag(tag string) func(*ExportOptions)
func WithExportOptionsErrorFunc ¶ added in v1.1.23
func WithExportOptionsErrorFunc(f ErrorFunc) func(*ExportOptions)
func WithExportOptionsFieldFunc ¶ added in v1.1.20
func WithExportOptionsFieldFunc(f FieldFunc) func(*ExportOptions)
func WithExportOptionsFileName ¶ added in v1.1.20
func WithExportOptionsFileName(fileName string) func(*ExportOptions)
func WithExportOptionsFinishFunc ¶ added in v1.1.23
func WithExportOptionsFinishFunc(f FinishFunc) func(*ExportOptions)
func WithExportOptionsHeaderFunc ¶ added in v1.1.20
func WithExportOptionsHeaderFunc(f HeaderFunc) func(*ExportOptions)
func WithExportOptionsI18n ¶ added in v1.1.23
func WithExportOptionsI18n(i18n *gi18n.Manager) func(*ExportOptions)
func WithExportOptionsLimitSize ¶ added in v1.1.23
func WithExportOptionsLimitSize(limit int) func(*ExportOptions)
func WithExportOptionsListFunc ¶ added in v1.1.20
func WithExportOptionsListFunc(f ListFunc) func(*ExportOptions)
func WithExportOptionsPageSize ¶ added in v1.1.20
func WithExportOptionsPageSize(pageSize int) func(*ExportOptions)
func WithExportOptionsParamsFunc ¶ added in v1.1.22
func WithExportOptionsParamsFunc(f RawFunc) func(*ExportOptions)
func WithExportOptionsRespItemStruct ¶ added in v1.1.20
func WithExportOptionsRespItemStruct(obj any) func(*ExportOptions)
func WithExportOptionsSheetPrefix ¶ added in v1.1.20
func WithExportOptionsSheetPrefix(prefix string) func(*ExportOptions)
func WithExportOptionsSheetSize ¶ added in v1.1.20
func WithExportOptionsSheetSize(sheetSize int) func(*ExportOptions)
func WithExportOptionsStatusFunc ¶ added in v1.1.20
func WithExportOptionsStatusFunc(f StatusFunc) func(*ExportOptions)
func WithExportOptionsSummaryFunc ¶ added in v1.1.20
func WithExportOptionsSummaryFunc(f RawFunc) func(*ExportOptions)
func WithExportOptionsTagName ¶ added in v1.1.20
func WithExportOptionsTagName(tag string) func(*ExportOptions)
func WithExportOptionsTotalFunc ¶ added in v1.1.20
func WithExportOptionsTotalFunc(f TotalFunc) func(*ExportOptions)
func WithExportOptionsTranslateFunc ¶ added in v1.1.20
func WithExportOptionsTranslateFunc(f TranslateFunc) func(*ExportOptions)
Types ¶
type Export ¶ added in v1.1.20
type Export struct {
// contains filtered or unexported fields
}
type ExportOptions ¶ added in v1.1.20
type ExportOptions struct { FileName string PageSize int SheetSize int LimitSize int SheetPrefix string TagName string DescTag string RespItemStruct any FieldFunc FieldFunc TranslateFunc TranslateFunc StatusFunc StatusFunc HeaderFunc HeaderFunc TotalFunc TotalFunc ListFunc ListFunc SummaryFunc RawFunc ParamsFunc RawFunc FinishFunc FinishFunc ErrorFunc ErrorFunc // contains filtered or unexported fields }
type FinishFunc ¶ added in v1.1.23
type HeaderFunc ¶ added in v1.1.20
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 ¶ added in v0.4.1
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
type StatusFunc ¶ added in v1.1.20
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.