dramautils

package
v0.0.0-...-c31020f Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package dramautils is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidArrayLength - invalid array length
	ErrInvalidArrayLength = errors.New("invalid array length")
	// ErrInvalidJsonString - invalid json string
	ErrInvalidJsonString = errors.New("invalid json string")
	// ErrInvalidJsonInt - invalid json int
	ErrInvalidJsonInt = errors.New("invalid json int")
)

Functions

func AppendString

func AppendString(strs ...string) string

AppendString - append string

func ClearLogs

func ClearLogs() error

ClearLogs - clear logs

func CloneArr3

func CloneArr3(src [][][]int) [][][]int

CloneArr3 - clone a [][][]int

func Debug

func Debug(message string, fields ...zap.Field)

Debug logs a debug message with the given fields

func Error

func Error(message string, fields ...zap.Field)

Error logs a debug message with the given fields

func Fatal

func Fatal(message string, fields ...zap.Field)

Fatal logs a message than calls os.Exit(1)

func FindInt

func FindInt(arr []int, val int) int

FindInt - find a int into []int

func FindInt3

func FindInt3(arr []int, x, y, z int) int

FindInt3 - find 3 ints into []int

func FindIntArr

func FindIntArr(arr [][]int, vals []int) int

FindIntArr - find a int array into [][]int

func FormatNow

func FormatNow(t ITime) string

FormatNow - format time

func GenHashCode

func GenHashCode(length int) string

GenHashCode - generator a hash code

func GetCurTimestamp

func GetCurTimestamp() int64

func GetJsonFloat

func GetJsonFloat(data []byte, keys ...string) (val float64, err error)

func GetJsonInt

func GetJsonInt(data []byte, keys ...string) (val int64, err error)

func GetJsonString

func GetJsonString(data []byte, keys ...string) (val string, err error)

GetJsonString - number to string

func GetLogger

func GetLogger() *zap.Logger

GetLogger - get zap.Logger

func Info

func Info(message string, fields ...zap.Field)

Info logs a debug message with the given fields

func InitLogger

func InitLogger(logname string, appVersion string, level string, isConsole bool, logpath string)

InitLogger - initializes a thread-safe singleton logger

func Int32ArrToIntArr2

func Int32ArrToIntArr2(arr []int32, x, y int) ([][]int, error)

Int32ArrToIntArr2 - []int32 to [][]int

func Int32ArrToIntArr3

func Int32ArrToIntArr3(arr []int32, x, y, z int) ([][][]int, error)

Int32ArrToIntArr3 - []int32 to [][][]int

func Int3Arr2ToInt4Arr2

func Int3Arr2ToInt4Arr2(arr [][]int, val int) [][]int

Int3Arr2ToInt4Arr2 - []int{x,y,z} -> []int{x,y,z,v}

func IntArr2ToInt32Arr

func IntArr2ToInt32Arr(arr [][]int) ([]int32, int, int)

IntArr2ToInt32Arr - [][]int to []int32

func IntArr3ToInt32Arr

func IntArr3ToInt32Arr(arr [][][]int) ([]int32, int, int, int)

IntArr3ToInt32Arr - [][][]int to []int32

func IsSameIntArr2

func IsSameIntArr2(arr0 [][]int, arr1 [][]int) bool

IsSameIntArr2 -

func IsSameIntArr2Ex

func IsSameIntArr2Ex(arr0 [][]int, arr1 [][]int32) bool

IsSameIntArr2Ex -

func IsSameIntArr2Ex2

func IsSameIntArr2Ex2(arr0 [][]int, arr1 [][]int, x int) bool

IsSameIntArr2Ex - 只比较前x个

func JSON

func JSON(name string, jobj interface{}) zap.Field

JSON - It's like zap.String(name, str)

func String2Float64

func String2Float64(str string) (float64, error)

func String2Int64

func String2Int64(str string) (int64, error)

func SyncLogger

func SyncLogger()

SyncLogger - sync logger

func Warn

func Warn(message string, fields ...zap.Field)

Warn logs a debug message with the given fields

Types

type ITime

type ITime interface {
	// Now - get now time
	Now() time.Time
}

ITime - Time

type MockITime

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

MockITime is a mock of ITime interface

func NewMockITime

func NewMockITime(ctrl *gomock.Controller) *MockITime

NewMockITime creates a new mock instance

func (*MockITime) EXPECT

func (m *MockITime) EXPECT() *MockITimeMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockITime) Now

func (m *MockITime) Now() time.Time

Now mocks base method

type MockITimeMockRecorder

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

MockITimeMockRecorder is the mock recorder for MockITime

func (*MockITimeMockRecorder) Now

func (mr *MockITimeMockRecorder) Now() *gomock.Call

Now indicates an expected call of Now

type Time

type Time struct {
}

Time - default Time

func (Time) Now

func (t Time) Now() time.Time

Now - get now time

Jump to

Keyboard shortcuts

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