utils

package
v0.0.0-...-a79bcea Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2021 License: Apache-2.0 Imports: 28 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DateLayout      = "2006-01-02"
	DateTimeLayout  = "2006-01-02 15:04:05"
	BuildTimeLayout = "2006.0102.150405"
	TimestampLayout = "20060102150405"
)

Variables

View Source
var Debug = true
View Source
var FlagVarConfFile string
View Source
var FlagVarDBFile string
View Source
var StartTime = time.Now()

Functions

func CWD

func CWD() string

func CloseLogWriter

func CloseLogWriter()

func Conf

func Conf() *ini.File

func ConfFile

func ConfFile() string

func ConfFileDev

func ConfFileDev() string

func DBFile

func DBFile() string

func DBFileDev

func DBFileDev() string

func DataDir

func DataDir() string

func EXEName

func EXEName() string

func Ellipsis

func Ellipsis(text string, length int) string

func EnsureDir

func EnsureDir(dir string) (err error)

func ErrorLogFilename

func ErrorLogFilename() string

func Exist

func Exist(path string) bool

func ExpandHomeDir

func ExpandHomeDir(path string) string

func GetHttpCustomPath

func GetHttpCustomPath(roomName string) (string, error)

func GetLogWriter

func GetLogWriter() io.Writer

func GetOutPutUrl

func GetOutPutUrl(roomName, transType, customPath string) string

func GetRequestHostname

func GetRequestHostname(r *http.Request) (hostname string)

func GetRequestHref

func GetRequestHref(r *http.Request) string

func HasChinese

func HasChinese(str string) bool

func HomeDir

func HomeDir() string

func IsPortInUse

func IsPortInUse(port int) bool

func LocalIP

func LocalIP() string

func Log

func Log(msg ...interface{})

func LogDir

func LogDir() string

func Logf

func Logf(format string, msg ...interface{})

func MD5

func MD5(str string) string

func PauseExit

func PauseExit()

func RedirectStderr

func RedirectStderr() (err error)

RedirectStderr to the file passed in

func ReloadConf

func ReloadConf() *ini.File

func ShortID

func ShortID() string

func UpTime

func UpTime() time.Duration

func UpTimeString

func UpTimeString() string

Types

type DateTime

type DateTime time.Time

func (DateTime) MarshalJSON

func (dt DateTime) MarshalJSON() ([]byte, error)

func (*DateTime) Scan

func (dt *DateTime) Scan(v interface{}) error

func (DateTime) String

func (dt DateTime) String() string

func (*DateTime) UnmarshalJSON

func (dt *DateTime) UnmarshalJSON(data []byte) (err error)

func (DateTime) Value

func (dt DateTime) Value() (driver.Value, error)

type PageForm

type PageForm struct {
	Start int    `form:"start"`
	Limit int    `form:"limit"`
	Q     string `form:"q"`
	Sort  string `form:"sort"`
	Order string `form:"order"`
}

func NewPageForm

func NewPageForm() *PageForm

func (PageForm) String

func (p PageForm) String() string

type PageResult

type PageResult struct {
	Total int         `json:"total"`
	Rows  interface{} `json:"rows"`
}

func NewPageResult

func NewPageResult(rows interface{}) *PageResult

func (*PageResult) Slice

func (pr *PageResult) Slice(start, limit int) *PageResult

func (*PageResult) Sort

func (pr *PageResult) Sort(by, order string) *PageResult

type StatikFileSystem

type StatikFileSystem struct {
	http.FileSystem
}

func (*StatikFileSystem) Exists

func (s *StatikFileSystem) Exists(prefix string, filepath string) bool

type StringArray

type StringArray string

func (StringArray) MarshalJSON

func (r StringArray) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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