raphanuscommon

package
v0.14.5 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2024 License: MIT Imports: 0 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// Version - library/server version
	Version = "0.1"
	// DefaultHost - host for server
	DefaultHost = "localhost"
	// DefaultPort - port for server
	DefaultPort = "8771"
	// MaxStringValueLength - string value max length
	MaxStringValueLength = 1024 * 1024 // 1 MB
)

Variables

View Source
var (
	ErrBadRequest       = RaphError{1, "Bad request"}
	ErrKeyNotExists     = RaphError{2, "Key not exists"}
	ErrKeyTypeMissmatch = RaphError{3, "The type does not match"}
	ErrListOutOfRange   = RaphError{4, "List index is out of range"}
	ErrDictKeyNotExists = RaphError{5, "Dict, key not exists"}
	ErrDictKeyIsEmpty   = RaphError{6, "Key or dict key is empty"}
	ErrTTLIsntCorrect   = RaphError{7, "TTL parameter isn't correct"}
	ErrKeyIsNotValid    = RaphError{8, "Key is not valid"}
)

Common errors

Functions

This section is empty.

Types

type DictValue

type DictValue map[string]string

DictValue - dict value type

type ListValue

type ListValue []string

ListValue - list value type

type OutputCommon

type OutputCommon struct {
	ErrorCode    int    `json:"error_code"`
	ErrorMessage string `json:"error_message,omitempty"`
}

OutputCommon - common part of all responses

type OutputGetDict

type OutputGetDict struct {
	OutputCommon
	ValueDict DictValue `json:"value_dict"`
}

OutputGetDict - output for /dict/:key

type OutputGetInt

type OutputGetInt struct {
	OutputCommon
	ValueInt int64 `json:"value_int"`
}

OutputGetInt - output for /int/:key

type OutputGetList

type OutputGetList struct {
	OutputCommon
	ValueList ListValue `json:"value_list"`
}

OutputGetList - output for /list/:key

type OutputGetStr

type OutputGetStr struct {
	OutputCommon
	ValueStr string `json:"value_str"`
}

OutputGetStr - output for /str/:key

type OutputKeys

type OutputKeys struct {
	OutputCommon
	Keys []string `json:"keys"`
}

OutputKeys - output for /keys

type OutputLength

type OutputLength struct {
	OutputCommon
	Length int `json:"length"`
}

OutputLength - output for /length

type OutputStat

type OutputStat struct {
	OutputCommon
	Stat
}

OutputStat - output for /stat

type RaphError

type RaphError struct {
	Code    int
	Message string
}

RaphError - common error type

func (RaphError) Error

func (err RaphError) Error() string

Error - implement error interface

type Stat

type Stat struct {
	Version        string `json:"version"`
	MemAlloc       uint64 `json:"mem_alloc"`
	MemTotalAlloc  uint64 `json:"mem_total_alloc"`
	MemMallocs     uint64 `json:"mem_malloc"`
	MemFrees       uint64 `json:"mem_frees"`
	MemHeapObjects uint64 `json:"mem_heap_objects"`
	GCPauseTotalNs uint64 `json:"gc_pause_total_ns"`
}

Stat - some stat: version, memory, GC, etc

Jump to

Keyboard shortcuts

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