pkg

package
v1.1.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

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 CheckExist added in v0.4.1

func CheckExist(src string) bool

CheckExist 检查文件是否存在

func CheckPermission added in v0.4.1

func CheckPermission(src string) bool

CheckPermission 检查文件权限

func Dsn added in v0.4.1

func Dsn(m *Mysql) string

func FileCreate

func FileCreate(content bytes.Buffer, name string)

func FileMonitoringById

func FileMonitoringById(ctx context.Context, filePth string, id string, group string, hookfn func(context.Context, string, string, []byte))

func Get added in v0.4.1

func Get() []string

func GetCurrentPath

func GetCurrentPath() string

GetCurrentPath 获取当前路径,比如:E:/abc/data/test

func GetDBType added in v0.4.1

func GetDBType(link string) string

func GetExt added in v0.4.1

func GetExt(fileName string) string

GetExt 获取文件后缀

func GetFileSize

func GetFileSize(filename string) int64

GetFileSize 获取文件大小

func GetImgType added in v0.4.1

func GetImgType(p string) (string, error)

GetImgType 获取Img文件类型

func GetLocalHost

func GetLocalHost() string

GetLocalHost 获取局域网ip地址

func GetLocation

func GetLocation(ctx context.Context, ip string) string

GetLocation 获取外网ip地址

func GetSize added in v0.4.1

func GetSize(f multipart.File) (int, error)

GetSize 获取文件大小

func GetType added in v0.4.1

func GetType(p string) (string, error)

GetType 获取文件类型

func IsNotExistMkDir added in v0.4.1

func IsNotExistMkDir(src string) error

IsNotExistMkDir 检查文件夹是否存在 如果不存在则新建文件夹

func MkDir added in v0.4.1

func MkDir(src string) error

MkDir 新建文件夹

func Open added in v0.4.1

func Open(name string, flag int, perm os.FileMode) (*os.File, error)

Open 打开文件

func PathCreate

func PathCreate(dir string) error

func PathExist

func PathExist(addr string) bool

PathExist 判断目录是否存在

func Round

func Round(f float64, n int) float64

func SaveUploadedFile

func SaveUploadedFile(file *multipart.FileHeader, dst string) error

SaveUploadedFile uploads the form file to specific dst.

Types

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"`
}
func GetByLink(link string) Mysql

type ReplaceHelper

type ReplaceHelper struct {
	Root    string //路径
	OldText string //需要替换的文本
	NewText string //新的文本
}

func (*ReplaceHelper) DoWork

func (h *ReplaceHelper) DoWork() error

Directories

Path Synopsis
tus
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.
uid

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL