MCPcopy Index your code
hub / github.com/ByteStorage/FlyDB / Get

Method Get

structure/string.go:78–100  ·  view source on GitHub ↗

Get gets the value of a key If the key does not exist, it will return nil If the key exists, it will return the value If the key is expired, it will be deleted and return nil If the key is not expired, it will be updated and return the value

(k string)

Source from the content-addressed store, hash-verified

76// If the key is expired, it will be deleted and return nil
77// If the key is not expired, it will be updated and return the value
78func (s *StringStructure) Get(k string) (interface{}, error) {
79 key := stringToBytesWithKey(k)
80
81 // Get the value
82 value, err := s.db.Get(key)
83 if err != nil {
84 return nil, err
85 }
86
87 interValue, _, err := decodeStringValue(value)
88 if err != nil {
89 return nil, err
90 }
91
92 valueType := s.valueType
93
94 valueToInterface, err := byteToInterface(interValue, valueType)
95 if err != nil {
96 return nil, err
97 }
98
99 return valueToInterface, nil
100}
101
102// Del deletes the value of a key
103// If the key does not exist, it will return nil

Callers 13

GetSetMethod · 0.95
AppendMethod · 0.95
IncrMethod · 0.95
IncrByMethod · 0.95
IncrByFloatMethod · 0.95
DecrMethod · 0.95
DecrByMethod · 0.95
KeysMethod · 0.95
ExistsMethod · 0.95
ExpireMethod · 0.95
PersistMethod · 0.95
SizeMethod · 0.95

Calls 4

stringToBytesWithKeyFunction · 0.85
decodeStringValueFunction · 0.85
byteToInterfaceFunction · 0.85
GetMethod · 0.65

Tested by

no test coverage detected