common

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 27, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NA       = "N/A"
	ENABLED  = "enabled"
	DISABLED = "disabled"
)

Variables

View Source
var (
	TIME_LAYOUT  = "2006-01-02 15:04:05"
	EmptyList    = []interface{}{}
	EmptyTime, _ = time.Parse("2006-01-02 15:04:05 Z0700 MST", "1979-11-30 00:00:00 +0000 GMT")
)
View Source
var Fontb64 = `` /* 320784-byte string literal not displayed */

Functions

func Base642file

func Base642file(b64str string, file string) error

func CopyFile

func CopyFile(dstName, srcName string, perm os.FileMode) (written int64, err error)

func DirExists

func DirExists(file string) bool

判断文件目录是否存在

func EmptyToNA

func EmptyToNA(src string) string

func File2Base64

func File2Base64(file string) string

func FileExists

func FileExists(file string) bool

判断文件是否存在

func If

func If(condition bool, trueVal, falseVal interface{}) interface{}

func IfEmptyStr

func IfEmptyStr(src string, defval string) string

func IfNA

func IfNA(src string, defval string) string

func IgnoreError

func IgnoreError(v interface{}, err error) interface{}

func InSlice

func InSlice(v string, sl []string) bool

判断字符串是否在列表中

func MakeDir

func MakeDir(path string)

创建目录

func Must

func Must(err error)

panic error

func Must2

func Must2(v interface{}, err error) interface{}

func ParseFormTime

func ParseFormTime(t, hms string) (time.Time, error)

解析表单时间 t 表单时间字符串 hms 时分秒

func SetEmptyStrToNA

func SetEmptyStrToNA(t interface{})

func Sha256Hash

func Sha256Hash(src string) string

hash 方法

func ToCamelCase

func ToCamelCase(str string) string

转换到大驼峰格式

func ToSnakeCase

func ToSnakeCase(str string) string

转换到下划线格式

func UUID

func UUID() string

生成 UUID

func UUIDBase32

func UUIDBase32() (string, error)

func UUIDint64

func UUIDint64() int64

生成 int64

func Usage

func Usage(str string)

print usage

func ValidateEmail

func ValidateEmail(email string) (matchedString bool)

验证Email格式

Types

This section is empty.

Jump to

Keyboard shortcuts

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