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

Method GetSet

structure/string.go:160–175  ·  view source on GitHub ↗

GetSet sets the value of a key and returns its old value

(key string, value interface{}, ttl int64)

Source from the content-addressed store, hash-verified

158
159// GetSet sets the value of a key and returns its old value
160func (s *StringStructure) GetSet(key string, value interface{}, ttl int64) (interface{}, error) {
161 // Get the old value
162 oldValue, err := s.Get(key)
163 if err != nil {
164 return nil, err
165 }
166
167 // Set the value
168 err = s.Set(key, value, ttl)
169 if err != nil {
170 return nil, err
171 }
172
173 // Return the old value
174 return oldValue, nil
175}
176
177// Append appends a value to the value of a key
178func (s *StringStructure) Append(key string, v interface{}, ttl int64) error {

Callers

nothing calls this directly

Calls 2

GetMethod · 0.95
SetMethod · 0.95

Tested by

no test coverage detected