Documentation
¶
Index ¶
- Constants
- Variables
- func B2S(b []byte) string
- func JoinErrors(errs []error) error
- func JsonUnmarshal(data []byte, v interface{}) error
- func NewBoolAtomic() *atomic.Value
- func Recover()
- func RecoverWithFunc(f func(r any))
- type LogLevel
- type Logger
- type ResponseError
- type SyncMap
- func (m *SyncMap[V]) Delete(key string)
- func (m *SyncMap[V]) IsEmpty() bool
- func (m *SyncMap[V]) Load(key string) (value V, ok bool)
- func (m *SyncMap[V]) LoadAndDelete(key string) (value V, loaded bool)
- func (m *SyncMap[V]) LoadOrStore(key string, value V) (actual V, loaded bool)
- func (m *SyncMap[V]) Range(f func(key string, value V) bool)
- func (m *SyncMap[V]) Store(key string, value V)
Constants ¶
View Source
const ( LogLevelDebug = LogLevel(0) LogLevelInfo = LogLevel(1) LogLevelWarn = LogLevel(2) LogLevelError = LogLevel(3) )
Variables ¶
View Source
var ( ErrServerNotSupport = errors.New("this feature server not support") ErrRequestInvalid = errors.New("request invalid") ErrLackResponseChan = errors.New("lack response chan") ErrDuplicateResponseReceived = errors.New("duplicate response received") ErrMethodNotSupport = errors.New("method not support") ErrJsonUnmarshal = errors.New("json unmarshal error") ErrSessionHasNotInitialized = errors.New("the session has not been initialized") ErrLackSession = errors.New("lack session") )
Functions ¶
func JoinErrors ¶
func JsonUnmarshal ¶
func NewBoolAtomic ¶
func RecoverWithFunc ¶
func RecoverWithFunc(f func(r any))
Types ¶
type Logger ¶
type Logger interface {
Debugf(format string, a ...any)
Infof(format string, a ...any)
Warnf(format string, a ...any)
Errorf(format string, a ...any)
}
var DefaultLogger Logger = &defaultLogger{ logLevel: LogLevelInfo, }
type ResponseError ¶
func NewResponseError ¶
func NewResponseError(code int, message string, data interface{}) *ResponseError
func (*ResponseError) Error ¶
func (e *ResponseError) Error() string
type SyncMap ¶
type SyncMap[V any] struct { // contains filtered or unexported fields }
func (*SyncMap[V]) LoadAndDelete ¶
func (*SyncMap[V]) LoadOrStore ¶
Click to show internal directories.
Click to hide internal directories.