utils

package
v1.0.17 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2025 License: GPL-2.0 Imports: 12 Imported by: 5

Documentation

Index

Constants

View Source
const (
	INT8_SIZE     int32 = 1
	INT16_SIZE    int32 = 2
	INT32_SIZE    int32 = 4
	INT64_SIZE    int32 = 8
	STRING_PREFIX int32 = 2
	BYTES_PREFIX  int32 = 2
)
View Source
const (
	VipDateFormat string = "2006-01-02 15:04:05"
)

Variables

This section is empty.

Functions

func ByteToInt16

func ByteToInt16(buf []byte) (ret int16)

func ByteToInt16LD added in v1.0.11

func ByteToInt16LD(buf []byte) (ret int16)

func ByteToInt32

func ByteToInt32(buf []byte) (ret int32)

func ByteToInt32LD added in v1.0.11

func ByteToInt32LD(buf []byte) (ret int32)

func ByteToInt64

func ByteToInt64(buf []byte) (ret int64)

func CheckError

func CheckError(err error)

func ConvertInterface2Bool

func ConvertInterface2Bool(v interface{}) (bool, error)

func ConvertInterface2Int

func ConvertInterface2Int(v interface{}) (int, error)

func ConvertInterface2Int16

func ConvertInterface2Int16(v interface{}) (int16, error)

func ConvertInterface2Int32

func ConvertInterface2Int32(v interface{}) (int32, error)

func ConvertInterface2Int32Array

func ConvertInterface2Int32Array(v interface{}) ([]int32, error)

func ConvertInterface2Int64

func ConvertInterface2Int64(v interface{}) (int64, error)

func ConvertInterface2Int8

func ConvertInterface2Int8(v interface{}) (int8, error)

func ConvertInterface2String

func ConvertInterface2String(v interface{}) (string, error)

func ConvertString2Int

func ConvertString2Int(value string) (iValue int, err error)

func ConvertString2Int16

func ConvertString2Int16(value string) (iValue int16, err error)

func ConvertString2Int32

func ConvertString2Int32(value string) (iValue int32, err error)

func ConvertString2Int64

func ConvertString2Int64(value string) (iValue int64, err error)

func ConvertString2Int8

func ConvertString2Int8(value string) (iValue int8, err error)

func ConvertTime2Int64

func ConvertTime2Int64(value string) (iValue int64, err error)

func Int16ToByte

func Int16ToByte(v int16) (buf []byte)

func Int16ToByteLD added in v1.0.11

func Int16ToByteLD(v int16) (buf []byte)

func Int32ToByte

func Int32ToByte(v int32) (buf []byte)

func Int32ToByteLD added in v1.0.11

func Int32ToByteLD(v int32) (buf []byte)

func Int64ToByte

func Int64ToByte(v int64) (buf []byte)

func ParseIP

func ParseIP(r *http.Request) string

func Stack

func Stack(skip int) []byte

stack returns a nicely formated stack frame, skipping skip frames

func UUID added in v1.0.3

func UUID() string

Types

type Attr

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

func NewAttr

func NewAttr(params map[string]interface{}) *Attr

func (*Attr) Copy

func (attr *Attr) Copy(srcAttr IAttr)

func (*Attr) CopyFromMap

func (attr *Attr) CopyFromMap(newAttr map[string]interface{})

func (*Attr) CopyToMap

func (attr *Attr) CopyToMap() map[string]interface{}

func (*Attr) Get

func (attr *Attr) Get(key string) (value interface{})

func (*Attr) GetBool

func (attr *Attr) GetBool(key string) bool

func (*Attr) GetInt

func (attr *Attr) GetInt(key string) int

func (*Attr) GetInt16

func (attr *Attr) GetInt16(key string) int16

func (*Attr) GetInt32

func (attr *Attr) GetInt32(key string) int32

func (*Attr) GetInt64

func (attr *Attr) GetInt64(key string) int64

func (*Attr) GetInt8

func (attr *Attr) GetInt8(key string) int8

func (*Attr) GetString

func (attr *Attr) GetString(key string) string

func (*Attr) Set

func (attr *Attr) Set(key string, value interface{})

type IAttr

type IAttr interface {
	Get(key string) (value interface{})
	GetBool(key string) bool
	GetInt8(key string) (value int8)
	GetInt16(key string) (value int16)
	GetInt32(key string) (value int32)
	GetInt64(key string) (value int64)
	GetInt(key string) (value int)
	GetString(key string) (value string)
	Set(key string, value interface{})
	CopyToMap() map[string]interface{}
	CopyFromMap(newAttr map[string]interface{})
	Copy(newAttr IAttr)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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