MCPcopy Create free account
hub / github.com/ByteStorage/FlyDB / Type

Method Type

structure/string.go:118–134  ·  view source on GitHub ↗

Type returns the type of a key If the key does not exist, it will return "" If the key exists, it will return "string" If the key is expired, it will be deleted and return "" If the key is not expired, it will be updated and return "string"

(k string)

Source from the content-addressed store, hash-verified

116// If the key is expired, it will be deleted and return ""
117// If the key is not expired, it will be updated and return "string"
118func (s *StringStructure) Type(k string) (string, error) {
119 key := stringToBytesWithKey(k)
120 // Get the value
121 value, err := s.db.Get(key)
122 if err != nil {
123 return "", err
124 }
125
126 // Decode the value
127 _, _, err = decodeStringValue(value)
128 if err != nil {
129 return "", err
130 }
131
132 // Return the type
133 return "string", nil
134}
135
136// StrLen returns the length of the value of a key
137// If the key does not exist, it will return 0

Callers

nothing calls this directly

Calls 3

stringToBytesWithKeyFunction · 0.85
decodeStringValueFunction · 0.85
GetMethod · 0.65

Tested by

no test coverage detected