utils

package
v0.0.0-...-66c7839 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TIME_FORMAT           = "2006-01-02 15:04:05"
	TIME_FORMAT_FILE_NAME = "2006_01_02_15_04_05"
)
View Source
const (
	UUID_LEN      = 30
	UUID_TIME_LEN = 24
)

Variables

This section is empty.

Functions

func CMDDir

func CMDDir() (string, error)

获取执行文件的路径

func CheckAndCreatePath

func CheckAndCreatePath(p string, msg string) error

检测和创建目录是否存在

func ConverSQLType

func ConverSQLType(row []interface{}) ([]interface{}, error)

将row转化为相关类型interface

func CreateDir

func CreateDir(p string) error

创建一个目录

func DownloadFile

func DownloadFile(url string, std string) error

下载文件

func Equal

func Equal(v1 interface{}, v2 interface{}) bool

等于

func FileAbs

func FileAbs(filePath string) (string, error)

获取文件绝对路径

func Filename

func Filename(filePath string) string

func GetBytes

func GetBytes(data interface{}) ([]byte, error)

func GetCrc32ByInterfaceSlice

func GetCrc32ByInterfaceSlice(cols []interface{}) uint32

一共有分几片计算出 所在分片号

func GetCrc32ByStr

func GetCrc32ByStr(data string) int64

func GetSQLStmtHearderComment

func GetSQLStmtHearderComment(stmt *string) string

func GetSqlStrValue

func GetSqlStrValue(data string, wrapStr string) (string, error)

data: 源数据 warpStr: 最后元数据需要使用什么包括 如: data: aabb, wrapStr: ' 最后: 'aabb'

func GetURL

func GetURL(url string, query string) (interface{}, error)

get请求

func GetURLQuery

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

func GetURLRaw

func GetURLRaw(url string, query string) ([]byte, error)

get请求

func GetUUID

func GetUUID() string

获取唯一自增ID

func Int64ToByte

func Int64ToByte(num int64) ([]byte, error)

func InterfaceToFloat64

func InterfaceToFloat64(val interface{}) (float64, error)

func InterfaceToInt64

func InterfaceToInt64(val interface{}) (int64, error)

func InterfaceToStr

func InterfaceToStr(val interface{}) string

func InterfaceToUint64

func InterfaceToUint64(val interface{}) (uint64, error)

func IsNull

func IsNull(v interface{}) bool

为空

func KindIntToByte

func KindIntToByte(num interface{}) ([]byte, error)

func Less

func Less(v1 interface{}, v2 interface{}) bool

小于

func LessEqual

func LessEqual(v1 interface{}, v2 interface{}) bool

小于等于

func NewTime

func NewTime(timeStr string) (time.Time, error)

func NotEqual

func NotEqual(v1 interface{}, v2 interface{}) bool

不等于

func NowTimestamp

func NowTimestamp() int64

func PathExists

func PathExists(p string) (bool, error)

文件/目录 是否存在

func PostURL

func PostURL(url string, data interface{}) (interface{}, error)

post访问url

func PutURL

func PutURL(url string, data interface{}) (interface{}, error)

func RandRangeUint32

func RandRangeUint32(min, max int32) uint32

func RandString

func RandString(n int) string

func Rather

func Rather(v1 interface{}, v2 interface{}) bool

大于

func RatherEqual

func RatherEqual(v1 interface{}, v2 interface{}) bool

大于等于

func ReplaceSqlPlaceHolder

func ReplaceSqlPlaceHolder(sqlStr string, row []interface{}, crc32 uint32, timeStr string, threadId uint32) string

将row转化为相关类型interface

func SqlExprPlaceholderByColumns

func SqlExprPlaceholderByColumns(names []string, symbol string, holder string, sep string) string

获取sql表达表达式, 通过字段

func StrRepeat

func StrRepeat(d string, cnt int, sep string) string

字符串重复

func StrTime2Int

func StrTime2Int(tsStr string) (int64, error)

func TS2String

func TS2String(ts int64, format string) string

func Uint64ToByte

func Uint64ToByte(num uint64) ([]byte, error)

Types

type BoolNode

type BoolNode struct {
	Data bool
	Next *BoolNode
}

func NewBoolNode

func NewBoolNode(d bool) *BoolNode

type CalcStack

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

func NewCalcStack

func NewCalcStack() *CalcStack

func (*CalcStack) Calc

func (this *CalcStack) Calc(op opcode.Op)

func (*CalcStack) IsEmpty

func (this *CalcStack) IsEmpty() bool

func (*CalcStack) Pop

func (this *CalcStack) Pop() (bool, bool)

func (*CalcStack) Push

func (this *CalcStack) Push(data bool)

func (*CalcStack) PushOrCalc

func (this *CalcStack) PushOrCalc(data interface{})

func (*CalcStack) Result

func (this *CalcStack) Result() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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