MCPcopy Create free account
hub / github.com/devld/go-drive / getData

Method getData

drive/script/index.go:70–84  ·  view source on GitHub ↗
(vm *s.VM, args s.Values)

Source from the content-addressed store, hash-verified

68}
69
70func (sd *ScriptDrive) getData(vm *s.VM, args s.Values) any {
71 key := args.Get(0).String()
72 sd.mu.RLock()
73 encoded, ok := sd.data[key]
74 encoded = append(json.RawMessage(nil), encoded...)
75 sd.mu.RUnlock()
76 if !ok {
77 vm.ThrowError(errors.New(key + " not found"))
78 }
79 value, e := vm.DecodeJSONValue(encoded)
80 if e != nil {
81 vm.ThrowError(e)
82 }
83 return value
84}
85
86func (sd *ScriptDrive) call(ctx context.Context, vm *s.VM, fn string, args ...any) (*s.Value, error) {
87 fn = "__drive_" + fn

Callers 2

downloadFunction · 0.80
onDropFunction · 0.80

Calls 4

ThrowErrorMethod · 0.80
DecodeJSONValueMethod · 0.80
StringMethod · 0.65
GetMethod · 0.65

Tested by

no test coverage detected