utils

package
v0.0.0-...-3040a6a Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Debug   = "debug"
	Info    = "info"
	Warning = "warning"
	Error   = "error"
	Nil     = "nil"
)
View Source
const (
	DaySeconds = 24 * 60 * 60
)

Variables

This section is empty.

Functions

func GetDaySlot

func GetDaySlot(t time.Time) int64

func GetRandString

func GetRandString(n int) string

func GetSlots

func GetSlots(t time.Time) (int64, int, int)

func Hash64

func Hash64(s []byte) uint64

Hash64 returns a 64-bit hash for a slice of bytes.

func HashKeysUint32

func HashKeysUint32(iData map[uint32]struct{}) (uint64, []uint32)

func HashMapUint32

func HashMapUint32(iData map[uint32]uint32) (uint64, []uint32)

func HashSliceUint32

func HashSliceUint32(keys []uint32) (uint64, []uint32)

func HashUint32

func HashUint32(v ...uint32) uint64

func Random

func Random(min, max int) int

func Range

func Range(v uint64) int

Types

type ILoggerHandler

type ILoggerHandler interface {
	SetOutput(w io.Writer)
	Output(calldepth int, s string) error
	Printf(format string, v ...interface{})
	Print(v ...interface{})
	Println(v ...interface{})
	Fatal(v ...interface{})
	Fatalf(format string, v ...interface{})
	Fatalln(v ...interface{})
	Panic(v ...interface{})
	Panicf(format string, v ...interface{})
	Panicln(v ...interface{})
	Flags() int
	SetFlags(flag int)
	Prefix() string
	SetPrefix(prefix string)
}

type Logger

type Logger struct {
	Debug   ILoggerHandler
	Info    ILoggerHandler
	Warning ILoggerHandler
	Error   ILoggerHandler
	Any     ILoggerHandler
}

func GetLogger

func GetLogger(mode string) *Logger

type LoggerNil

type LoggerNil struct {
}

func NewLoggerNil

func NewLoggerNil() *LoggerNil

func (*LoggerNil) Fatal

func (l *LoggerNil) Fatal(v ...interface{})

func (*LoggerNil) Fatalf

func (l *LoggerNil) Fatalf(format string, v ...interface{})

func (*LoggerNil) Fatalln

func (l *LoggerNil) Fatalln(v ...interface{})

func (*LoggerNil) Flags

func (l *LoggerNil) Flags() int

func (*LoggerNil) Output

func (l *LoggerNil) Output(calldepth int, s string) error

func (*LoggerNil) Panic

func (l *LoggerNil) Panic(v ...interface{})

func (*LoggerNil) Panicf

func (l *LoggerNil) Panicf(format string, v ...interface{})

func (*LoggerNil) Panicln

func (l *LoggerNil) Panicln(v ...interface{})

func (*LoggerNil) Prefix

func (l *LoggerNil) Prefix() string

func (*LoggerNil) Print

func (l *LoggerNil) Print(v ...interface{})

func (*LoggerNil) Printf

func (l *LoggerNil) Printf(format string, v ...interface{})

func (*LoggerNil) Println

func (l *LoggerNil) Println(v ...interface{})

func (*LoggerNil) SetFlags

func (l *LoggerNil) SetFlags(flag int)

func (*LoggerNil) SetOutput

func (l *LoggerNil) SetOutput(w io.Writer)

Set fake handlers that do nothing

func (*LoggerNil) SetPrefix

func (l *LoggerNil) SetPrefix(prefix string)

type Uint32Slice

type Uint32Slice []uint32

func (Uint32Slice) Len

func (p Uint32Slice) Len() int

func (Uint32Slice) Less

func (p Uint32Slice) Less(i, j int) bool

func (Uint32Slice) Swap

func (p Uint32Slice) Swap(i, j int)

Jump to

Keyboard shortcuts

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