util

package
v3.0.6-alpha+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2018 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCommonFlags

func AddCommonFlags(cmdline *pflag.FlagSet) *bool

AddCommonFlags add common flags that is needed by all modules

func ArrayUnique

func ArrayUnique(a interface{}) (ret []interface{})

func CalSliceDiff

func CalSliceDiff(oldslice, newslice []string) (subs, plugs []string)

func CalSliceInt64Diff

func CalSliceInt64Diff(oldslice, newslice []int64) (subs, inter, plugs []int64)

func CheckLen

func CheckLen(sInput string, min, max int) bool

字符串输入长度

func Contains

func Contains(set []string, substr string) bool

func ContainsInt64

func ContainsInt64(set []int64, sub int64) bool

func ConvParamsTime

func ConvParamsTime(data interface{}) interface{}

func FileExists

func FileExists(name string) bool

func GetActionLanguage

func GetActionLanguage(req *restful.Request) string

GetActionLanguage returns language form hender

func GetActionOnwerID

func GetActionOnwerID(req *restful.Request) string

GetActionOnwerID returns owner_uin form hender

func GetActionOnwerIDAndUser

func GetActionOnwerIDAndUser(req *restful.Request) (string, string)

GetActionOnwerID returns owner_uin and user form hender

func GetActionUser

func GetActionUser(req *restful.Request) string

GetActionLanguage returns user form hender

func GetCurrentTimeStr

func GetCurrentTimeStr() string

func GetInt64ByInterface

func GetInt64ByInterface(a interface{}) (int64, error)

func GetIntByInterface

func GetIntByInterface(a interface{}) (int, error)

func GetMapInterfaceByInerface

func GetMapInterfaceByInerface(data interface{}) ([]interface{}, error)

func GetObjIDByType

func GetObjIDByType(objType string) string

func InArray

func InArray(obj interface{}, target interface{}) bool

func InitFlags

func InitFlags()

InitFlags normalizes and parses the command line flags

func IsChar

func IsChar(sInput string) bool

是否大、小写字母组合

func IsDate

func IsDate(sInput string) bool

是否日期

func IsNumChar

func IsNumChar(sInput string) bool

是否字母、数字组合

func IsTime

func IsTime(sInput string) bool

是否时间

func IsTimeZone

func IsTimeZone(sInput string) bool

是否时区

func MapMatch

func MapMatch(src, tar interface{}) bool

MapMatch return whether src is partial match to tar, means src is smaller than tar

func NewMapFromJSON

func NewMapFromJSON(data string) map[string]interface{}

func RemoveDuplicatesAndEmpty

func RemoveDuplicatesAndEmpty(slice []string) (ret []string)

func SliceStrToInt

func SliceStrToInt(sliceStr []string) ([]int, error)

SliceStrToInt: 将字符串切片转换为整型切片

func Str2Time

func Str2Time(timeStr string) time.Time

str2time

func StrArrDiff

func StrArrDiff(slice1 []string, slice2 []string) []string

func StrArrayUnique

func StrArrayUnique(a []string) (ret []string)

StrArrayUnique get unique string array

func WarnWordSepNormalizeFunc

func WarnWordSepNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedName

WarnWordSepNormalizeFunc changes and warns for flags that contain "_" separators

func WordSepNormalizeFunc

func WordSepNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedName

WordSepNormalizeFunc changes all flags that contain "_" separators

Types

type MapBuiler

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

func NewMapBuilder

func NewMapBuilder(kvpairs ...interface{}) *MapBuiler

func (*MapBuiler) Append

func (m *MapBuiler) Append(k string, vs ...interface{})

func (*MapBuiler) Build

func (m *MapBuiler) Build() map[string]interface{}

func (*MapBuiler) Delete

func (m *MapBuiler) Delete(k string)

func (*MapBuiler) Set

func (m *MapBuiler) Set(k string, v interface{})

type ParseInterface

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

ParseInterface parse interface use struct

func NewParseInterface

func NewParseInterface(data interface{}) *ParseInterface

NewParseInterface return a struct

func (*ParseInterface) ArrayInterface

func (p *ParseInterface) ArrayInterface() ([]interface{}, error)

ArrayInterface return interface val

func (*ParseInterface) Get

func (p *ParseInterface) Get(key string) *ParseInterface

Get get key from interface to ParseInterface

func (*ParseInterface) Interface

func (p *ParseInterface) Interface() (interface{}, error)

Interface return interface val

func (*ParseInterface) String

func (p *ParseInterface) String() (string, error)

String return string val

Jump to

Keyboard shortcuts

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