FuncWithDynamicInputs is like Func but lets a resolver customize request/cache behavior for each call (for example argument rewrites, TTL, do-not-cache, or concurrency key).
( name string, fn FuncHandler[T, A, R], cacheFn DynamicInputFunc[T, A], )
| 748 | // behavior for each call (for example argument rewrites, TTL, do-not-cache, or |
| 749 | // concurrency key). |
| 750 | func FuncWithDynamicInputs[T Typed, A any, R any]( |
| 751 | name string, |
| 752 | fn FuncHandler[T, A, R], |
| 753 | cacheFn DynamicInputFunc[T, A], |
| 754 | ) Field[T] { |
| 755 | return NodeFuncWithDynamicInputs(name, func(ctx context.Context, self ObjectResult[T], args A) (R, error) { |
| 756 | return fn(ctx, self.Self(), args) |
| 757 | }, cacheFn) |
| 758 | } |
| 759 | |
| 760 | // NodeFunc is the same as Func, except it passes the ObjectResult instead of the |
| 761 | // receiver so that you can access its ID. |
no test coverage detected