MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / cmdGET

Function cmdGET

strings.go:744–762  ·  view source on GitHub ↗
(m uhaha.Machine, args []string)

Source from the content-addressed store, hash-verified

742}
743
744func cmdGET(m uhaha.Machine, args []string) (interface{}, error) {
745 if len(args) != 2 {
746 return nil, uhaha.ErrWrongNumArgs
747 }
748
749 // Retrieve the value associated with the key
750 val, err := ldb.Get([]byte(args[1]))
751 if err != nil {
752 return nil, err
753 }
754
755 // If val is nil, the key does not exist
756 if val == nil {
757 return nil, nil
758 }
759
760 // Return the value if the key exists
761 return val, nil
762}
763
764// This is different from the RESP standard. For the sake of transaction consistency, there is no key existence judgment.
765func cmdDEL(m uhaha.Machine, args []string) (interface{}, error) {

Callers

nothing calls this directly

Calls 1

GetMethod · 0.45

Tested by

no test coverage detected