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

Method queryExec

wasm/postgres.go:162–189  ·  view source on GitHub ↗
(args []driver.Value)

Source from the content-addressed store, hash-verified

160}
161
162func (s *PgStmt) queryExec(args []driver.Value) (js.Value, error) {
163 m := map[string]interface{}{
164 "rowMode": "array",
165 "types": getPGTypeParser(),
166 "name": s.key,
167 "text": s.query,
168 }
169
170 vals := make([]interface{}, len(args))
171 for i, a := range args {
172 switch v := a.(type) {
173 case []byte:
174 vals[i] = js.ValueOf(string(v))
175 default:
176 vals[i] = js.ValueOf(v)
177 }
178 }
179 m["values"] = vals
180
181 res, rej := await(s.client.Call("query", m))
182
183 if len(rej) != 0 {
184 err := errors.New(rej[0].Get("message").String())
185 return js.Null(), err
186 }
187
188 return res[0], nil
189}

Callers 2

ExecMethod · 0.95
QueryMethod · 0.95

Calls 5

getPGTypeParserFunction · 0.85
awaitFunction · 0.85
CallMethod · 0.65
GetMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected