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

Method saveToAllowList

core/core.go:208–235  ·  view source on GitHub ↗

Saved the query qcode to the allow list

(qc *qcode.QCode, ns string)

Source from the content-addressed store, hash-verified

206
207// Saved the query qcode to the allow list
208func (gj *graphjinEngine) saveToAllowList(qc *qcode.QCode, ns string) (err error) {
209 if qc == nil || gj.conf.DisableAllowList {
210 return nil
211 }
212
213 item := allow.Item{
214 Namespace: ns,
215 Name: qc.Name,
216 Query: qc.Query,
217 Fragments: make([]allow.Fragment, len(qc.Fragments)),
218 }
219
220 if len(qc.ActionVal) != 0 {
221 var buf bytes.Buffer
222 if err = jsn.Clear(&buf, qc.ActionVal); err != nil {
223 return
224 }
225 item.ActionJSON = map[string]json.RawMessage{
226 qc.ActionVar: json.RawMessage(buf.Bytes()),
227 }
228 }
229
230 for i, f := range qc.Fragments {
231 item.Fragments[i] = allow.Fragment{Name: f.Name, Value: f.Value}
232 }
233
234 return gj.allowList.Set(item)
235}
236
237// Starts tracing with the given name
238func (gj *graphjinEngine) spanStart(c context.Context, name string) (context.Context, Spaner) {

Callers 2

initSubMethod · 0.95
GraphQLMethod · 0.80

Calls 1

SetMethod · 0.65

Tested by

no test coverage detected