utils

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MulanPSL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultTraceLog = &TraceLogNull{}
)

Functions

This section is empty.

Types

type KeyValueCache

type KeyValueCache interface {
	Set(k, v string, tm *time.Time) error
	Get(k string) (string, bool)
	Del(k string) error
}

type LogMode

type LogMode int
const (
	LogModeIgnore  LogMode = 100
	LogModeDebug   LogMode = 1
	LogModeWarming LogMode = 2
	LogModeError   LogMode = 3
)

type MapCache

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

func NewMapCache

func NewMapCache() *MapCache

func (*MapCache) Del

func (m *MapCache) Del(k string) error

func (*MapCache) Get

func (m *MapCache) Get(k string) (string, bool)

func (*MapCache) Set

func (m *MapCache) Set(k, v string, tm *time.Time) error

type MapCacheItem

type MapCacheItem struct {
	Value  string
	Expire *time.Time
}

type ParamsChainManager

type ParamsChainManager interface {
	ParamsManager
	SetPrev(ParamsChainManager)
	NewNext() ParamsChainManager
}

type ParamsManager

type ParamsManager interface {
	Add(k, v string) ParamsManager
	Del(k string) ParamsManager
	Get(k string) (string, bool)
	Map() map[string]string
}

type SimpleParamsChainManager

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

SimpleParamsChainManager 链式参数管理器

func ConvertSimpleParamsChainManager

func ConvertSimpleParamsChainManager(pm ParamsManager) *SimpleParamsChainManager

func NewSimpleChainParamsManager

func NewSimpleChainParamsManager() *SimpleParamsChainManager

func (*SimpleParamsChainManager) Add

func (*SimpleParamsChainManager) Del

func (*SimpleParamsChainManager) Get

func (*SimpleParamsChainManager) Map

func (pm *SimpleParamsChainManager) Map() map[string]string

func (*SimpleParamsChainManager) NewNext

func (*SimpleParamsChainManager) SetPrev

func (pm *SimpleParamsChainManager) SetPrev(prev ParamsChainManager)

type SimpleParamsManager

type SimpleParamsManager map[string]string

SimpleParamsManager 单点参数管理器

func NewSimpleParamManager

func NewSimpleParamManager() SimpleParamsManager

func (SimpleParamsManager) Add

func (SimpleParamsManager) Del

func (SimpleParamsManager) Get

func (pm SimpleParamsManager) Get(k string) (string, bool)

func (SimpleParamsManager) Map

func (pm SimpleParamsManager) Map() map[string]string

type TraceLog

type TraceLog interface {
	LogMode() LogMode

	Debug(func() string)
	Warn(func() string)
	Error(func() string)

	DebugForce(func() string)
	WarnForce(func() string)
	ErrorForce(func() string)
}

type TraceLogConsole

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

func (*TraceLogConsole) Debug

func (output *TraceLogConsole) Debug(f func() string)

func (*TraceLogConsole) DebugForce

func (output *TraceLogConsole) DebugForce(f func() string)

func (*TraceLogConsole) Error

func (output *TraceLogConsole) Error(f func() string)

func (*TraceLogConsole) ErrorForce

func (output *TraceLogConsole) ErrorForce(f func() string)

func (*TraceLogConsole) Init

func (output *TraceLogConsole) Init(level LogMode, colorful bool, normal, err io.Writer)

func (*TraceLogConsole) LogMode

func (output *TraceLogConsole) LogMode() LogMode

func (*TraceLogConsole) SetLevel

func (output *TraceLogConsole) SetLevel(val LogMode) LogMode

func (*TraceLogConsole) Warn

func (output *TraceLogConsole) Warn(f func() string)

func (*TraceLogConsole) WarnForce

func (output *TraceLogConsole) WarnForce(f func() string)

type TraceLogNull added in v0.0.2

type TraceLogNull struct {
}

func (*TraceLogNull) Debug added in v0.0.2

func (t *TraceLogNull) Debug(f func() string)

func (*TraceLogNull) DebugForce added in v0.0.2

func (t *TraceLogNull) DebugForce(f func() string)

func (*TraceLogNull) Error added in v0.0.2

func (t *TraceLogNull) Error(f func() string)

func (*TraceLogNull) ErrorForce added in v0.0.2

func (t *TraceLogNull) ErrorForce(f func() string)

func (*TraceLogNull) LogMode added in v0.0.2

func (t *TraceLogNull) LogMode() LogMode

func (*TraceLogNull) Warn added in v0.0.2

func (t *TraceLogNull) Warn(f func() string)

func (*TraceLogNull) WarnForce added in v0.0.2

func (t *TraceLogNull) WarnForce(f func() string)

Jump to

Keyboard shortcuts

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