pkg

package
v1.6.1-0...-5e9cea2 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2020 License: Unlicense Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckScene

func CheckScene(scene string, scenes []string) (bool, error)

func Contains

func Contains(target []string, sub string) bool

func Contains_TO_remove deprecated

func Contains_TO_remove(obj interface{}, objContainer interface{}) bool

Deprecated:

func CopyFile

func CopyFile(src, dst string) (int64, error)

func CopyfileRemove

func CopyfileRemove(src, dst string) (int64, error)

CopyFile copies from src to dst until either EOF is reached on src or an error occurs. It verifies src exists and removes the dst if it exists.

func CreateDirectories

func CreateDirectories(dir string, perm os.FileMode) error

CreateDirectories creates directories for storing photos, metadata and cache files.

func CrossOrigin

func CrossOrigin(ctx *gin.Context)

CrossOrigin add cross info to header

func DownloadFileToResponse

func DownloadFileToResponse(url string, ctx *gin.Context)

DownloadFileToResponse

func Exist

func Exist(filename string) bool

func ExpandFilename

func ExpandFilename(filename string) string

Returns full path of a file, "~" is replaced with home directory

func FileAndExists

func FileAndExists(fileName string) bool

FileAndExists check is the file exists, not dir

func FileExists

func FileExists(fileName string) bool

func FormatTimeByDay

func FormatTimeByDay(t time.Time) string

func FormatTimeByHour

func FormatTimeByHour(t time.Time) string

func GetClientIp

func GetClientIp(r *http.Request) string

func GetDayFromTimeStamp

func GetDayFromTimeStamp(timeStamp int64) string

func GetFileMd5

func GetFileMd5(file *os.File) string

func GetFileServerRunningAbsDir

func GetFileServerRunningAbsDir(appName string) (path string, err error)

func GetFileSha1Sum

func GetFileSha1Sum(file *os.File) string

func GetFileSum

func GetFileSum(file *os.File, alg string) string

func GetFileSumByName

func GetFileSumByName(filepath string, alg string) (string, error)

func GetPublicIP

func GetPublicIP() string

func GetRequestURI

func GetRequestURI(action string) string

GetRequestURI returns the request url, if group-manage is enable, add the group info to req url

func GetServerURI

func GetServerURI(r *http.Request) string

GetServerURI

func GetUUID

func GetUUID() string

TODO: the uuid method is not good enough, to change

func GetUUIDOp

func GetUUIDOp() string

func HumanSize

func HumanSize(size float64) string

func InsideContainer

func InsideContainer() (bool, error)

InsideContainer check if running inside container

func JsonEncodePretty

func JsonEncodePretty(o interface{}) string

func MD5

func MD5(str string) string

func MapSetToStr

func MapSetToStr(set mapSet.Set, sep string) string

func Match

func Match(matcher string, content string) []string

func NotPermit

func NotPermit(w http.ResponseWriter)

NotPermit adds 401 code to header

func RandInt

func RandInt(min, max int) int

func ReadFile

func ReadFile(path string) ([]byte, error)

func ReadFileByOffSet

func ReadFileByOffSet(filepath string, offset int64, length int) ([]byte, error)

func ReadLinesOffsetN

func ReadLinesOffsetN(filename string, offset uint, n int) ([]string, error)

ReadLinesOffsetN reads contents from file and splits them by new line. The offset tells at which line number to start. The count determines the number of lines to read (starting from offset):

n >= 0: at most n lines
n < 0: whole file

func RemoveEmptyDir

func RemoveEmptyDir(pathName string)

func ResizeImage

func ResizeImage(w http.ResponseWriter, fullPath string, width, height uint)

ResizeImage

func ResizeImageByBytes

func ResizeImageByBytes(w http.ResponseWriter, data []byte, width, height uint)

ResizeImageByBytes

func SetDownloadHeader

func SetDownloadHeader(ctx *gin.Context)

SetDownloadHeader add download info to header

func StrToMapSet

func StrToMapSet(str string, sep string) mapSet.Set

func Today

func Today() string

Today get today's string info

func UrlDecodeToMap

func UrlDecodeToMap(body string) (map[string]string, error)

func UrlEncode

func UrlEncode(v interface{}) string

func UrlEncodeFromMap

func UrlEncodeFromMap(m map[string]string) string

func WriteBinFile

func WriteBinFile(path string, data []byte) bool

func WriteFile

func WriteFile(path string, data string) bool

func WriteFileByOffSet

func WriteFileByOffSet(filepath string, offset int64, data []byte) error

Types

type CommonMap

type CommonMap struct {
	// contains filtered or unexported fields
}

func NewCommonMap

func NewCommonMap() *CommonMap

func (*CommonMap) Add

func (cMap *CommonMap) Add(key string)

func (*CommonMap) AddCount

func (cMap *CommonMap) AddCount(key string, count int)

func (*CommonMap) AddCountInt64

func (cMap *CommonMap) AddCountInt64(key string, count int64) int64

func (*CommonMap) AddUniq

func (cMap *CommonMap) AddUniq(key string)

func (*CommonMap) Clear

func (cMap *CommonMap) Clear()

func (*CommonMap) Contains

func (cMap *CommonMap) Contains(i ...interface{}) bool

func (*CommonMap) Get

func (cMap *CommonMap) Get() map[string]interface{}

func (*CommonMap) GetValue

func (cMap *CommonMap) GetValue(k string) (interface{}, bool)

func (*CommonMap) IsLock

func (cMap *CommonMap) IsLock(k string) bool

func (*CommonMap) Iter

func (cMap *CommonMap) Iter() <-chan Tuple

func (*CommonMap) Keys

func (cMap *CommonMap) Keys() []string

func (*CommonMap) LockKey

func (cMap *CommonMap) LockKey(k string)

func (*CommonMap) Put

func (cMap *CommonMap) Put(k string, v interface{})

func (*CommonMap) Remove

func (cMap *CommonMap) Remove(key string)

func (*CommonMap) UnLockKey

func (cMap *CommonMap) UnLockKey(k string)

func (*CommonMap) Zero

func (cMap *CommonMap) Zero()

type Mail

type Mail struct {
	User     string `json:"user"`
	Password string `json:"password"`
	Host     string `json:"host"`
}

type Tuple

type Tuple struct {
	Key string
	Val interface{}
}

Jump to

Keyboard shortcuts

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