Saved the query qcode to the allow list
(qc *qcode.QCode, ns string)
| 206 | |
| 207 | // Saved the query qcode to the allow list |
| 208 | func (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 |
| 238 | func (gj *graphjinEngine) spanStart(c context.Context, name string) (context.Context, Spaner) { |