func queryWithTx(gj *core.GraphJin) js.Func { return js.FuncOf(func(this js.Value, args []js.Value) interface{} { var qa queryArgs if err := processArgsWithTx(&qa, args, "query"); !err.IsUndefined() { return err } c := context.TODO() if qa.userID != nil { c = context.WithValue(c, co
(gj *core.GraphJin)
| 60 | // } |
| 61 | |
| 62 | func queryByName(gj *core.GraphJin) js.Func { |
| 63 | return js.FuncOf(func(this js.Value, args []js.Value) interface{} { |
| 64 | var qa queryArgs |
| 65 | if err := processArgs(&qa, args, "name"); !err.IsUndefined() { |
| 66 | return err |
| 67 | } |
| 68 | |
| 69 | c := context.TODO() |
| 70 | |
| 71 | if qa.userID != nil { |
| 72 | c = context.WithValue(c, core.UserIDKey, qa.userID) |
| 73 | } |
| 74 | |
| 75 | fn := func(resolve, reject js.Value) { |
| 76 | res, err := gj.GraphQLByName(c, qa.query, qa.vars, nil) |
| 77 | if err != nil { |
| 78 | reject.Invoke(toJSError(err)) |
| 79 | } else { |
| 80 | resolve.Invoke(fromResult(res)) |
| 81 | } |
| 82 | } |
| 83 | return toAwait(fn) |
| 84 | }) |
| 85 | } |
| 86 | |
| 87 | func subscribe(gj *core.GraphJin) js.Func { |
| 88 | return js.FuncOf(func(this js.Value, args []js.Value) interface{} { |
no test coverage detected