nidus-sync/factory/bobfactory_context.bob.go
Eli Ribble 486c148bf7
Add user sessions and login
This isn't quite perfect, but gets much of the hard work done.
2025-11-05 17:15:33 +00:00

42 lines
1.4 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 sessions
sessionWithParentsCascadingCtx = newContextual[bool]("sessionWithParentsCascading")
// 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
}