chore: upgrade deps + code-gen (#249)

This commit is contained in:
Hayden 2023-01-28 12:03:51 -09:00 committed by GitHub
parent 3d295b5132
commit 6ed1f3695a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
42 changed files with 664 additions and 563 deletions

View file

@ -31,6 +31,7 @@ type (
Hook = ent.Hook
Value = ent.Value
Query = ent.Query
QueryContext = ent.QueryContext
Querier = ent.Querier
QuerierFunc = ent.QuerierFunc
Interceptor = ent.Interceptor
@ -525,10 +526,11 @@ func withHooks[V Value, M any, PM interface {
return nv, nil
}
// newQueryContext returns a new context with the given QueryContext attached in case it does not exist.
func newQueryContext(ctx context.Context, typ, op string) context.Context {
// setContextOp returns a new context with the given QueryContext attached (including its op) in case it does not exist.
func setContextOp(ctx context.Context, qc *QueryContext, op string) context.Context {
if ent.QueryFromContext(ctx) == nil {
ctx = ent.NewQueryContext(ctx, &ent.QueryContext{Type: typ, Op: op})
qc.Op = op
ctx = ent.NewQueryContext(ctx, qc)
}
return ctx
}