kit

package module
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2022 License: MIT Imports: 23 Imported by: 90

Documentation

Index

Constants

View Source
const (
	// 结构
	MDB_DICT = "dict"
	MDB_META = "meta"
	MDB_HASH = "hash"
	MDB_LIST = "list"
	MDB_UNIQ = "uniq"

	MDB_FOREACH = "*"
	MDB_RANDOMS = "%"

	// 存储
	MDB_SHORT = "short"
	MDB_FIELD = "field"
	MDB_TOTAL = "total"
	MDB_COUNT = "count"
	MDB_LIMIT = "limit"
	MDB_LEAST = "least"
	MDB_STORE = "store"
	MDB_FSIZE = "fsize"

	// 索引
	MDB_INDEX  = "index"
	MDB_VALUE  = "value"
	MDB_EXTRA  = "extra"
	MDB_ALIAS  = "alias"
	MDB_EXPIRE = "expire"
	MDB_STATUS = "status"
	MDB_STREAM = "stream"

	// 文件
	MDB_LINK = "link"
	MDB_SCAN = "scan"
	MDB_SHOW = "show"
	MDB_HELP = "help"
	MDB_DATA = "data"
	MDB_PATH = "path"
	MDB_FILE = "file"
	MDB_LINE = "line"
	MDB_SIZE = "size"
	MDB_COST = "cost"

	// 数据
	MDB_TEXT = "text"
	MDB_NAME = "name"
	MDB_TYPE = "type"
	MDB_ZONE = "zone"
	MDB_TIME = "time"
	MDB_KEY  = "key"
	MDB_ID   = "id"
)

Variables

This section is empty.

Functions

func AddUniq added in v0.7.1

func AddUniq(list []string, arg ...string) []string

func BeginEnd added in v0.7.1

func BeginEnd(begin, end func()) func()

func CSV

func CSV(file string, limit int, cb func(index int, value map[string]string, head []string)) error

func Capital

func Capital(str string) string

func Close added in v0.5.0

func Close(p interface{})

func Contains

func Contains(str, sub Any) bool

func Create

func Create(p string) (*os.File, string, error)

func DayBegin added in v0.7.1

func DayBegin(t string) time.Time

func Default added in v0.7.1

func Default(list []string, arg ...string) []string

func Duration

func Duration(str Any) time.Duration

func Env added in v0.5.0

func Env(key string) string

func EnvSimple added in v0.7.1

func EnvSimple(arg ...string) []string

func Ext

func Ext(str string) string

func ExtChange added in v0.7.1

func ExtChange(file, ext string) string

func ExtIsImage

func ExtIsImage(str string) bool

func ExtIsVideo added in v0.7.1

func ExtIsVideo(str string) bool

func ExtReg added in v0.7.1

func ExtReg(ext string) string

func Fields added in v0.3.7

func Fields(arg ...Any) string

func FileExists

func FileExists(name string) bool

func FileLine

func FileLine(p interface{}, n int) string

func FileName

func FileName(p interface{}) string

func FileReg added in v0.7.1

func FileReg(ext ...string) string

func Filter added in v0.6.1

func Filter(arg []string, cb ...func(string) bool) (res []string)

func Filters added in v0.7.1

func Filters(list []string, arg ...string) (res []string)

func FmtDuration added in v0.6.8

func FmtDuration(t time.Duration) string

func FmtSize

func FmtSize(size int64) string

func ForEach

func ForEach(arg []string, cb func(string))

func Format

func Format(val Any, arg ...Any) string

func FormatKV

func FormatKV(data Map, args ...string) string

func FormatShow added in v0.6.4

func FormatShow(arg ...Any) string

func Formats

func Formats(val Any) string

func FuncAddr added in v0.7.0

func FuncAddr(p interface{}) uintptr

func FuncName

func FuncName(p interface{}) string

func GetValid added in v0.7.1

func GetValid(cb ...func() string) (res string)

func HasPrefix added in v0.7.0

func HasPrefix(text string, arg ...string) bool

func HasSuffix added in v0.7.1

func HasSuffix(text string, arg ...string) bool

func Hash

func Hash(arg ...Any) (string, []string)

func Hashs

func Hashs(arg ...Any) string

func HashsPath added in v0.5.1

func HashsPath(arg ...Any) string

func HomePath added in v0.5.4

func HomePath(str string, rest ...string) string

func If added in v0.7.1

func If(exp Any, cb ...func())

func IfNoKey added in v0.7.1

func IfNoKey(list Map, p string, cb func(string))

func IndexOf

func IndexOf(str []string, sub string) int

func Int

func Int(val Any) int

func Int64

func Int64(val Any) int64

func IsDir added in v0.6.0

func IsDir(p string) bool

func Join

func Join(str []string, arg ...string) string

func JoinKV added in v0.7.0

func JoinKV(inner, outer string, arg ...string) string

func KeyExtra added in v0.4.0

func KeyExtra(arg ...Any) string

func KeyHash

func KeyHash(arg ...Any) string

func Keycb

func Keycb(arg ...Any) string

func Keym

func Keym(arg ...Any) string

func Keys

func Keys(arg ...Any) string

func LowerCapital added in v0.6.1

func LowerCapital(str string) string

func Max added in v0.4.3

func Max(list ...int) (max int)

func MergePOD

func MergePOD(url string, pod string, arg ...Any) string

func MergeURL

func MergeURL(str string, arg ...Any) string

func MergeURL2

func MergeURL2(str string, uri string, arg ...Any) string

func Min added in v0.7.1

func Min(arg ...int) (res int)

func ModName

func ModName(p interface{}) string

func ModPath added in v0.3.8

func ModPath(p interface{}, arg ...string) string

func Now added in v0.4.9

func Now(arg ...string) string

func ParseQuery added in v0.7.1

func ParseQuery(str string) url.Values

func ParseURL

func ParseURL(str string) *url.URL

func ParseURLMap

func ParseURLMap(str string) map[string]string

func Path

func Path(str string, rest ...string) string

func PathName

func PathName(p interface{}) string

func Pwd

func Pwd() string

func QueryUnescape added in v0.7.1

func QueryUnescape(value string) string

func ReadFile added in v0.5.0

func ReadFile(p string) string

func Reflect added in v0.5.7

func Reflect(obj Any, cb func(name string, value Any)) (reflect.Type, reflect.Value)

func Regexp

func Regexp(arg string) *regexp.Regexp

func Render

func Render(str string, arg Any) (b []byte, e error)

func Renders added in v0.7.0

func Renders(str string, arg Any) string

func Replace

func Replace(str string, arg ...string) string

func ReplaceAll added in v0.4.4

func ReplaceAll(str string, arg ...string) string

func Revert

func Revert(str []string) []string

func Rewrite

func Rewrite(file string, cb func(string) string) error

func Select

func Select(def string, arg ...Any) string

func ShortKey

func ShortKey(list Map, min int, arg ...Any) string

func Simple

func Simple(val ...Any) []string

func SimpleKV added in v0.4.3

func SimpleKV(key string, arg ...Any) (res []string)

func Slice

func Slice(list []string, index ...int) []string

func SliceRemove added in v0.7.1

func SliceRemove(list []string, key string) ([]string, int)

func Sort

func Sort(list []string, cb ...func(a, b string) bool) []string

func SortedKey added in v0.5.8

func SortedKey(obj Any) (res []string)

func SortedValue added in v0.7.0

func SortedValue(obj Any) (res []string)

func Split

func Split(str string, arg ...string) (res []string)

func SplitKV added in v0.7.1

func SplitKV(inner, outer string, text string, cb func(text string, ls []string))

func SplitLine added in v0.7.1

func SplitLine(text string) []string

func SplitWord added in v0.7.1

func SplitWord(text string) []string

func Time

func Time(arg ...string) int64

func TransArg

func TransArg(arg []string, key string, trans Any) []string

func TrimExt

func TrimExt(str string, ext ...string) string

func TrimPath added in v0.7.1

func TrimPath(p string) string

func UserName added in v0.5.7

func UserName() string

func Width

func Width(str string, mul int) int

func WriteFile added in v0.5.1

func WriteFile(p string, value interface{}) string

Types

type Any added in v0.6.4

type Any = interface{}

func Fetch

func Fetch(val Any, cbs Any) Any

func List

func List(arg ...Any) []Any

func Parse

func Parse(value Any, key string, val ...string) Any

func Switch added in v0.7.1

func Switch(exp Any, arg ...Any) Any

func UnMarshal

func UnMarshal(buf Any) (res Any)

func Value

func Value(root Any, args ...Any) Any

type Map added in v0.6.4

type Map = map[string]Any

func Data

func Data(arg ...Any) Map

func Dict

func Dict(arg ...Any) Map

func DictList added in v0.7.1

func DictList(arg ...string) Map

func GetMeta

func GetMeta(value Map) Map

func KeyValue

func KeyValue(res Map, key string, arg Any) Map

type Maps added in v0.6.5

type Maps = map[string]string

Directories

Path Synopsis
util

Jump to

Keyboard shortcuts

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