Documentation ¶
Index ¶
- Constants
- func EasyCodecItemToJsonStr(items []*EasyCodecItem) string
- func EasyCodecItemToParamsMap(items []*EasyCodecItem) map[string][]byte
- func EasyMarshal(items []*EasyCodecItem) []byte
- type EasyCodec
- func (e *EasyCodec) AddBytes(key string, value []byte)
- func (e *EasyCodec) AddInt32(key string, value int32)
- func (e *EasyCodec) AddItem(item *EasyCodecItem)
- func (e *EasyCodec) AddMap(value map[string][]byte)
- func (e *EasyCodec) AddString(key string, value string)
- func (e *EasyCodec) AddValue(keyType EasyKeyType, key string, valueType EasyValueType, value interface{})
- func (e *EasyCodec) GetBytes(key string) ([]byte, error)
- func (e *EasyCodec) GetInt32(key string) (int32, error)
- func (e *EasyCodec) GetItem(key string, keyType EasyKeyType) (*EasyCodecItem, error)
- func (e *EasyCodec) GetItems() []*EasyCodecItem
- func (e *EasyCodec) GetString(key string) (string, error)
- func (e *EasyCodec) GetValue(key string, keyType EasyKeyType) (interface{}, error)
- func (e *EasyCodec) Marshal() []byte
- func (e *EasyCodec) RemoveKey(key string)
- func (e *EasyCodec) ToJson() string
- func (e *EasyCodec) ToMap() map[string][]byte
- type EasyCodecItem
- type EasyKeyType
- type EasyValueType
Constants ¶
View Source
const ( EasyKeyType_SYSTEM EasyKeyType = 0 EasyKeyType_USER EasyKeyType = 1 EasyValueType_INT32 EasyValueType = 0 EasyValueType_STRING EasyValueType = 1 EasyValueType_BYTES EasyValueType = 2 MAX_KEY_COUNT = 128 MAX_KEY_LEN = 64 MAX_VALUE_LEN = 1024 * 1024 MIN_LEN = 20 EC_MAGIC_NUM_LEN = 4 EC_VERSION_LEN = 4 EC_RESERVED_LEN = 8 )
Variables ¶
This section is empty.
Functions ¶
func EasyCodecItemToJsonStr ¶
func EasyCodecItemToJsonStr(items []*EasyCodecItem) string
EasyCodecItemToJsonStr simple json, no nesting, rule: int32->strconv.itoa(val) []byte->string([]byte)
func EasyCodecItemToParamsMap ¶
func EasyCodecItemToParamsMap(items []*EasyCodecItem) map[string][]byte
EasyCodecItemToParamsMap easyCodecItem converter
func EasyMarshal ¶
func EasyMarshal(items []*EasyCodecItem) []byte
EasyMarshal serialize item into binary
Types ¶
type EasyCodec ¶
type EasyCodec struct {
// contains filtered or unexported fields
}
func NewEasyCodecWithItems ¶
func NewEasyCodecWithItems(items []*EasyCodecItem) *EasyCodec
func (*EasyCodec) AddItem ¶
func (e *EasyCodec) AddItem(item *EasyCodecItem)
func (*EasyCodec) AddValue ¶
func (e *EasyCodec) AddValue(keyType EasyKeyType, key string, valueType EasyValueType, value interface{})
func (*EasyCodec) GetItem ¶
func (e *EasyCodec) GetItem(key string, keyType EasyKeyType) (*EasyCodecItem, error)
func (*EasyCodec) GetItems ¶
func (e *EasyCodec) GetItems() []*EasyCodecItem
func (*EasyCodec) GetValue ¶
func (e *EasyCodec) GetValue(key string, keyType EasyKeyType) (interface{}, error)
func (*EasyCodec) ToJson ¶
toJson simple json, no nesting, rule: int32->strconv.itoa(val) []byte->string([]byte)
type EasyCodecItem ¶
type EasyCodecItem struct { KeyType EasyKeyType Key string ValueType EasyValueType Value interface{} }
func EasyUnmarshal ¶
func EasyUnmarshal(data []byte) []*EasyCodecItem
EasyUnmarshal Deserialized from binary to item
func ParamsMapToEasyCodecItem ¶
func ParamsMapToEasyCodecItem(params map[string][]byte) []*EasyCodecItem
ParamsMapToEasyCodecItem Params map converter
func (*EasyCodecItem) GetValue ¶
func (e *EasyCodecItem) GetValue(key string, keyType EasyKeyType) (interface{}, bool)
GetValue get value from item
Click to show internal directories.
Click to hide internal directories.