updated deps + regen ent

This commit is contained in:
2023-01-20 12:48:38 +01:00
parent f60e8479bc
commit 4431e906c3
7 changed files with 50 additions and 46 deletions

View File

@@ -20,6 +20,7 @@ type (
Hook = ent.Hook
Value = ent.Value
Query = ent.Query
QueryContext = ent.QueryContext
Querier = ent.Querier
QuerierFunc = ent.QuerierFunc
Interceptor = ent.Interceptor
@@ -503,10 +504,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
}