MCPcopy Create free account
hub / github.com/distributedio/titan / Type

Function Type

command/keys.go:234–245  ·  view source on GitHub ↗

Type returns the string representation of the type of the value stored at key

(ctx *Context, txn *db.Transaction)

Source from the content-addressed store, hash-verified

232
233// Type returns the string representation of the type of the value stored at key
234func Type(ctx *Context, txn *db.Transaction) (OnCommit, error) {
235 key := []byte(ctx.Args[0])
236 obj, err := txn.Object(key)
237 if err != nil {
238 if err == db.ErrKeyNotFound {
239 return SimpleString(ctx.Out, "none"), nil
240 }
241 return nil, errors.New("ERR " + err.Error())
242 }
243
244 return SimpleString(ctx.Out, obj.Type.String()), nil
245}
246
247// Keys returns all keys matching pattern
248func Keys(ctx *Context, txn *db.Transaction) (OnCommit, error) {

Callers

nothing calls this directly

Calls 4

SimpleStringFunction · 0.85
ObjectMethod · 0.80
ErrorMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected