utils

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AUTHFAIL = Exception{/* contains filtered or unexported fields */}
View Source
var DATAERR = Exception{/* contains filtered or unexported fields */}
View Source
var DAYLIMIT = Exception{/* contains filtered or unexported fields */}
View Source
var DETACHCONN = Exception{/* contains filtered or unexported fields */}
View Source
var DUPLICATE = Exception{/* contains filtered or unexported fields */}
View Source
var ERROR = Exception{/* contains filtered or unexported fields */}
View Source
var FAIL = Exception{/* contains filtered or unexported fields */}
View Source
var IOERR = Exception{/* contains filtered or unexported fields */}
View Source
var NETCLOSE = Exception{/* contains filtered or unexported fields */}
View Source
var NETDELAY = Exception{/* contains filtered or unexported fields */}
View Source
var NETERR = Exception{/* contains filtered or unexported fields */}
View Source
var NOTCHANGED = Exception{/* contains filtered or unexported fields */}
View Source
var NOTFOUND = Exception{/* contains filtered or unexported fields */}
View Source
var OK = Exception{/* contains filtered or unexported fields */}
View Source
var PARAMERR = Exception{/* contains filtered or unexported fields */}
View Source
var RECVFAIL = Exception{/* contains filtered or unexported fields */}
View Source
var SENDFAIL = Exception{/* contains filtered or unexported fields */}
View Source
var SYSBUSY = Exception{/* contains filtered or unexported fields */}
View Source
var SYSERR = Exception{/* contains filtered or unexported fields */}
View Source
var TIMEOUT = Exception{/* contains filtered or unexported fields */}
View Source
var UNINSTALL = Exception{/* contains filtered or unexported fields */}

Functions

func AssertNoError

func AssertNoError(err error)

func Atof

func Atof(str string) float64

func Atoi

func Atoi(str string) int

func Atol

func Atol(str string) int64

func Atou

func Atou(str string) uint64

func CamelCase

func CamelCase(name string) string

func Capitalize

func Capitalize(str string) string

func Copy

func Copy(dest, src interface{})

func FormatPath

func FormatPath(path string) string

func GetCurrentPath

func GetCurrentPath() string

func GetDateString

func GetDateString(date time.Time, short ...bool) string

func GetDateTimeString

func GetDateTimeString(date time.Time, short ...bool) string

func GetErrorString

func GetErrorString(code int) string

func GetFieldIndexMap

func GetFieldIndexMap(clazz reflect.Type) map[string]int

func GetFieldList

func GetFieldList(data interface{}) []string

func GetFieldString

func GetFieldString(data interface{}) string

func GetFieldValues

func GetFieldValues(data interface{}) []reflect.Value

func GetGid

func GetGid() uint64

func GetHttpEtag

func GetHttpEtag(response *http.Response) string

func GetHttpResult

func GetHttpResult(link string, params ...map[string]string) (*http.Response, error)

func GetHttpResultEx

func GetHttpResultEx(method string, link string, params ...map[string]string) (*http.Response, error)

func GetHttpStatus

func GetHttpStatus(response *http.Response) int

func GetHttpString

func GetHttpString(link string, params ...map[string]string) (string, error)
func GetLink(host string, port int, path string, crypted ...bool) string

func GetSimpleFields

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

func GetTimeString

func GetTimeString(date time.Time, short ...bool) string

func IsBaseValue

func IsBaseValue(kind reflect.Kind) bool

func IsFile added in v0.0.2

func IsFile(filename string) bool

func IsFloat

func IsFloat(kind reflect.Kind) bool

func IsInt

func IsInt(kind reflect.Kind) bool

func IsUint

func IsUint(kind reflect.Kind) bool

func ReadAll

func ReadAll(file io.Reader, buffer []byte, timeout ...int64) (int, error)

func ReadFromHttpResponse

func ReadFromHttpResponse(response *http.Response) ([]byte, error)

func SetFieldValue

func SetFieldValue(field reflect.Value, val string) bool

func SetSimpleFields

func SetSimpleFields(dest interface{}, src map[string]string)

func Sprint

func Sprint(args ...interface{}) string

func String

func String(val interface{}) string

func TimeCost

func TimeCost(callback func(), names ...string)

func Title

func Title(str string) string

func UnderScoreCase

func UnderScoreCase(name string) string

func UnpackZipBuffer

func UnpackZipBuffer(buffer []byte) (map[string][]byte, error)

func UnpackZipFile

func UnpackZipFile(path string) (map[string][]byte, error)

func WriteAll

func WriteAll(file io.Writer, buffer []byte, timeout ...time.Duration) (int, error)

Types

type CacheMap

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

func NewCacheMap

func NewCacheMap(maxsz int, timeout time.Duration) *CacheMap

func (*CacheMap) Capacity

func (m *CacheMap) Capacity() int

func (*CacheMap) Clear

func (m *CacheMap) Clear()

func (*CacheMap) Delete

func (m *CacheMap) Delete(key interface{})

func (*CacheMap) Get

func (m *CacheMap) Get(key interface{}) (interface{}, bool)

func (*CacheMap) Init

func (m *CacheMap) Init(maxsz int, timeout time.Duration)

func (*CacheMap) Range

func (m *CacheMap) Range(proc func(interface{}, interface{}) bool) int

func (*CacheMap) Set

func (m *CacheMap) Set(key, value interface{})

func (*CacheMap) Size

func (m *CacheMap) Size() int

type Exception

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

func (Exception) Code

func (err Exception) Code() int

func (Exception) Copy

func (err Exception) Copy(desc ...interface{}) Exception

func (Exception) Error

func (err Exception) Error() string

func (Exception) Extra

func (err Exception) Extra(fields map[string]interface{}) Exception

func (Exception) Fields

func (err Exception) Fields() map[string]interface{}

func (Exception) JsonBuffer

func (err Exception) JsonBuffer() []byte

func (Exception) Panic

func (err Exception) Panic(desc ...interface{})

func (Exception) String

func (err Exception) String() string

Jump to

Keyboard shortcuts

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