39 lines
1.3 KiB
Go
39 lines
1.3 KiB
Go
// Code generated by BobGen psql v0.41.1. DO NOT EDIT.
|
|
// This file is meant to be re-generated in place and/or deleted at any time.
|
|
|
|
package factory
|
|
|
|
import "context"
|
|
|
|
type contextKey string
|
|
|
|
var (
|
|
// Relationship Contexts for goose_db_version
|
|
gooseDBVersionWithParentsCascadingCtx = newContextual[bool]("gooseDBVersionWithParentsCascading")
|
|
|
|
// Relationship Contexts for organization
|
|
organizationWithParentsCascadingCtx = newContextual[bool]("organizationWithParentsCascading")
|
|
organizationRelUserCtx = newContextual[bool]("organization.user_.user_.user__organization_id_fkey")
|
|
|
|
// Relationship Contexts for user_
|
|
userWithParentsCascadingCtx = newContextual[bool]("userWithParentsCascading")
|
|
userRelOrganizationCtx = newContextual[bool]("organization.user_.user_.user__organization_id_fkey")
|
|
)
|
|
|
|
// Contextual is a convienience wrapper around context.WithValue and context.Value
|
|
type contextual[V any] struct {
|
|
key contextKey
|
|
}
|
|
|
|
func newContextual[V any](key string) contextual[V] {
|
|
return contextual[V]{key: contextKey(key)}
|
|
}
|
|
|
|
func (k contextual[V]) WithValue(ctx context.Context, val V) context.Context {
|
|
return context.WithValue(ctx, k.key, val)
|
|
}
|
|
|
|
func (k contextual[V]) Value(ctx context.Context) (V, bool) {
|
|
v, ok := ctx.Value(k.key).(V)
|
|
return v, ok
|
|
}
|