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)
| 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" |
| 118 | func (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 |
nothing calls this directly
no test coverage detected