MCPcopy
hub / github.com/dosco/graphjin / fromResult

Function fromResult

wasm/query.go:135–157  ·  view source on GitHub ↗
(res *core.Result)

Source from the content-addressed store, hash-verified

133}
134
135func fromResult(res *core.Result) map[string]interface{} {
136 sql := res.SQL()
137 sqlFn := js.FuncOf(func(this js.Value, args []js.Value) interface{} {
138 return sql
139 })
140
141 data := string(res.Data)
142 dataFn := js.FuncOf(func(this js.Value, args []js.Value) interface{} {
143 return js.Global().Get("JSON").Call("parse", data)
144 })
145
146 hash := res.Hash
147 hashFn := js.FuncOf(func(this js.Value, args []js.Value) interface{} {
148 return hex.EncodeToString(hash[:])
149 })
150
151 return map[string]interface{}{
152 "sql": sqlFn,
153 "data": dataFn,
154 "hash": hashFn,
155 "role": res.Role(),
156 }
157}
158
159func fromMember(m *core.Member) map[string]interface{} {
160 dataFn := js.FuncOf(func(this js.Value, args []js.Value) interface{} {

Callers 3

queryFunction · 0.85
queryByNameFunction · 0.85
fromMemberFunction · 0.85

Calls 4

RoleMethod · 0.80
SQLMethod · 0.65
CallMethod · 0.65
GetMethod · 0.65

Tested by

no test coverage detected