Documentation
¶
Index ¶
- func Open(connStr string) (*sql.DB, error)
- func OpenTestDB(t *testing.T) *sql.DB
- func TerminateTestContainer()
- type AuthMethodRepo
- type ConditionJSON
- type DeliveryRepo
- func (r *DeliveryRepo) DeleteByFulfillment(ctx context.Context, fID domain.FulfillmentID) error
- func (r *DeliveryRepo) Get(ctx context.Context, id domain.DeliveryID) (domain.Delivery, error)
- func (r *DeliveryRepo) GetByFulfillmentTarget(ctx context.Context, fID domain.FulfillmentID, tgtID domain.TargetID) (domain.Delivery, error)
- func (r *DeliveryRepo) ListActive(ctx context.Context, targetIDs []domain.TargetID) ([]domain.Delivery, error)
- func (r *DeliveryRepo) ListByFulfillment(ctx context.Context, fID domain.FulfillmentID) ([]domain.Delivery, error)
- func (r *DeliveryRepo) Put(ctx context.Context, d domain.Delivery) error
- type DeploymentRepo
- func (r *DeploymentRepo) Create(ctx context.Context, d domain.Deployment) error
- func (r *DeploymentRepo) Delete(ctx context.Context, name domain.ResourceName) error
- func (r *DeploymentRepo) Get(ctx context.Context, name domain.ResourceName) (domain.Deployment, error)
- func (r *DeploymentRepo) GetView(ctx context.Context, name domain.ResourceName) (domain.DeploymentView, error)
- func (r *DeploymentRepo) ListView(ctx context.Context) ([]domain.DeploymentView, error)
- type ExtensionResourceRepo
- func (r *ExtensionResourceRepo) ApplyInventoryDeltas(ctx context.Context, deltas []domain.InventoryDelta) error
- func (r *ExtensionResourceRepo) Create(ctx context.Context, er *domain.ExtensionResource) error
- func (r *ExtensionResourceRepo) CreateType(ctx context.Context, def domain.ExtensionResourceType) error
- func (r *ExtensionResourceRepo) Delete(ctx context.Context, name domain.FullResourceName) error
- func (r *ExtensionResourceRepo) DeleteType(ctx context.Context, rt domain.ResourceType) error
- func (r *ExtensionResourceRepo) Get(ctx context.Context, name domain.FullResourceName) (*domain.ExtensionResource, error)
- func (r *ExtensionResourceRepo) GetByUID(ctx context.Context, uid domain.ExtensionResourceUID) (*domain.ExtensionResource, error)
- func (r *ExtensionResourceRepo) GetIntent(ctx context.Context, uid domain.ExtensionResourceUID, ...) (domain.ResourceIntent, error)
- func (r *ExtensionResourceRepo) GetType(ctx context.Context, rt domain.ResourceType) (domain.ExtensionResourceType, error)
- func (r *ExtensionResourceRepo) GetView(ctx context.Context, name domain.FullResourceName) (domain.ExtensionResourceView, error)
- func (r *ExtensionResourceRepo) ListByResourceType(ctx context.Context, rt domain.ResourceType) ([]*domain.ExtensionResource, error)
- func (r *ExtensionResourceRepo) ListConditionTransitions(ctx context.Context, uid domain.ExtensionResourceUID, ...) ([]domain.ConditionTransition, error)
- func (r *ExtensionResourceRepo) ListObservations(ctx context.Context, uid domain.ExtensionResourceUID, limit int) ([]domain.Observation, error)
- func (r *ExtensionResourceRepo) ListTypes(ctx context.Context) ([]domain.ExtensionResourceType, error)
- func (r *ExtensionResourceRepo) ListViewsByType(ctx context.Context, rt domain.ResourceType) ([]domain.ExtensionResourceView, error)
- func (r *ExtensionResourceRepo) ReplaceInventory(ctx context.Context, replacements []domain.InventoryReplacement) error
- func (r *ExtensionResourceRepo) UpdateType(ctx context.Context, def domain.ExtensionResourceType) error
- type FulfillmentRepo
- func (r *FulfillmentRepo) Create(ctx context.Context, f *domain.Fulfillment) error
- func (r *FulfillmentRepo) Delete(ctx context.Context, id domain.FulfillmentID) error
- func (r *FulfillmentRepo) Get(ctx context.Context, id domain.FulfillmentID) (*domain.Fulfillment, error)
- func (r *FulfillmentRepo) Update(ctx context.Context, f *domain.Fulfillment) error
- type InventoryRepo
- func (r *InventoryRepo) Create(ctx context.Context, item domain.InventoryItem) error
- func (r *InventoryRepo) CreateOrUpdate(ctx context.Context, item domain.InventoryItem) error
- func (r *InventoryRepo) Delete(ctx context.Context, id domain.InventoryItemID) error
- func (r *InventoryRepo) Get(ctx context.Context, id domain.InventoryItemID) (domain.InventoryItem, error)
- func (r *InventoryRepo) List(ctx context.Context) ([]domain.InventoryItem, error)
- func (r *InventoryRepo) ListByType(ctx context.Context, t domain.InventoryItemType) ([]domain.InventoryItem, error)
- func (r *InventoryRepo) Update(ctx context.Context, item domain.InventoryItem) error
- type QueryRepo
- type ResourceIdentityRepo
- func (r *ResourceIdentityRepo) Create(ctx context.Context, pr *domain.PlatformResource) error
- func (r *ResourceIdentityRepo) GetByName(ctx context.Context, name domain.ResourceName) (*domain.PlatformResource, error)
- func (r *ResourceIdentityRepo) ListByCollection(ctx context.Context, collection domain.CollectionName) ([]*domain.PlatformResource, error)
- func (r *ResourceIdentityRepo) ResolveAliasesBatch(ctx context.Context, aliases []domain.Alias) (map[domain.Alias]domain.ResourceName, error)
- func (r *ResourceIdentityRepo) Update(ctx context.Context, pr *domain.PlatformResource) error
- type SignerEnrollmentRepo
- func (r *SignerEnrollmentRepo) Create(ctx context.Context, e domain.SignerEnrollment) error
- func (r *SignerEnrollmentRepo) Get(ctx context.Context, id domain.SignerEnrollmentID) (domain.SignerEnrollment, error)
- func (r *SignerEnrollmentRepo) ListBySubject(ctx context.Context, identity domain.FederatedIdentity) ([]domain.SignerEnrollment, error)
- type Store
- type TargetRepo
- func (r *TargetRepo) Create(ctx context.Context, t domain.TargetInfo) error
- func (r *TargetRepo) CreateOrUpdate(ctx context.Context, t domain.TargetInfo) error
- func (r *TargetRepo) Delete(ctx context.Context, id domain.TargetID) error
- func (r *TargetRepo) Get(ctx context.Context, id domain.TargetID) (domain.TargetInfo, error)
- func (r *TargetRepo) List(ctx context.Context) ([]domain.TargetInfo, error)
- type VaultStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TerminateTestContainer ¶
func TerminateTestContainer()
Types ¶
type AuthMethodRepo ¶
AuthMethodRepo implements domain.AuthMethodRepository backed by Postgres. Unlike other repos in this package, it operates on *sql.DB directly because auth method operations do not participate in cross-repo transactions.
func (*AuthMethodRepo) Get ¶
func (r *AuthMethodRepo) Get(ctx context.Context, id domain.AuthMethodID) (domain.AuthMethod, error)
func (*AuthMethodRepo) List ¶
func (r *AuthMethodRepo) List(ctx context.Context) ([]domain.AuthMethod, error)
func (*AuthMethodRepo) Save ¶
func (r *AuthMethodRepo) Save(ctx context.Context, method domain.AuthMethod) error
type ConditionJSON ¶
type ConditionJSON struct {
Status domain.ConditionStatus `json:"status"`
Reason string `json:"reason"`
Message string `json:"message"`
LastTransitionTime protoJSONTimestamp `json:"lastTransitionTime"`
LastTransitionTimeNorm string `json:"_lastTransitionTimeNorm"`
}
ConditionJSON is the JSON shape of a single entry within extension_resource_inventory.conditions, which stores a *map* of these keyed by condition type rather than an array -- see that column's migration doc comment for why.
LastTransitionTime is ProtoJSON (Z-normalized; 0/3/6/9 fractional digits) so direct CEL string filters match the QueryResources response spelling and GIN containment can participate. LastTransitionTimeNorm is the fixed-width UTC sibling used only by timestamp() filters; it is derived from the same time.Time on write and must not appear in API responses.
type DeliveryRepo ¶
DeliveryRepo implements domain.DeliveryRepository backed by Postgres.
func (*DeliveryRepo) DeleteByFulfillment ¶
func (r *DeliveryRepo) DeleteByFulfillment(ctx context.Context, fID domain.FulfillmentID) error
func (*DeliveryRepo) Get ¶
func (r *DeliveryRepo) Get(ctx context.Context, id domain.DeliveryID) (domain.Delivery, error)
func (*DeliveryRepo) GetByFulfillmentTarget ¶
func (r *DeliveryRepo) GetByFulfillmentTarget(ctx context.Context, fID domain.FulfillmentID, tgtID domain.TargetID) (domain.Delivery, error)
func (*DeliveryRepo) ListActive ¶
func (*DeliveryRepo) ListByFulfillment ¶
func (r *DeliveryRepo) ListByFulfillment(ctx context.Context, fID domain.FulfillmentID) ([]domain.Delivery, error)
type DeploymentRepo ¶
DeploymentRepo implements domain.DeploymentRepository backed by Postgres.
func (*DeploymentRepo) Create ¶
func (r *DeploymentRepo) Create(ctx context.Context, d domain.Deployment) error
func (*DeploymentRepo) Delete ¶
func (r *DeploymentRepo) Delete(ctx context.Context, name domain.ResourceName) error
func (*DeploymentRepo) Get ¶
func (r *DeploymentRepo) Get(ctx context.Context, name domain.ResourceName) (domain.Deployment, error)
func (*DeploymentRepo) GetView ¶
func (r *DeploymentRepo) GetView(ctx context.Context, name domain.ResourceName) (domain.DeploymentView, error)
func (*DeploymentRepo) ListView ¶
func (r *DeploymentRepo) ListView(ctx context.Context) ([]domain.DeploymentView, error)
type ExtensionResourceRepo ¶
type ExtensionResourceRepo struct {
DB interface {
ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row
}
}
ExtensionResourceRepo implements domain.ExtensionResourceRepository for Postgres.
func (*ExtensionResourceRepo) ApplyInventoryDeltas ¶
func (r *ExtensionResourceRepo) ApplyInventoryDeltas(ctx context.Context, deltas []domain.InventoryDelta) error
ApplyInventoryDeltas implements domain.ExtensionResourceRepository.ApplyInventoryDeltas in one statement against Postgres. ReplaceLabels/ReplaceConditions are whole-column JSONB assignments; UpsertLabels/DeleteLabels and UpsertConditions/DeleteConditions merge inside SQL against each row's current state, so concurrent incremental writers compose through Postgres row locking and EvalPlanQual re-evaluation instead of through a Go-side read-modify-write.
func (*ExtensionResourceRepo) Create ¶
func (r *ExtensionResourceRepo) Create(ctx context.Context, er *domain.ExtensionResource) error
func (*ExtensionResourceRepo) CreateType ¶
func (r *ExtensionResourceRepo) CreateType(ctx context.Context, def domain.ExtensionResourceType) error
func (*ExtensionResourceRepo) Delete ¶
func (r *ExtensionResourceRepo) Delete(ctx context.Context, name domain.FullResourceName) error
func (*ExtensionResourceRepo) DeleteType ¶
func (r *ExtensionResourceRepo) DeleteType(ctx context.Context, rt domain.ResourceType) error
func (*ExtensionResourceRepo) Get ¶
func (r *ExtensionResourceRepo) Get(ctx context.Context, name domain.FullResourceName) (*domain.ExtensionResource, error)
func (*ExtensionResourceRepo) GetByUID ¶
func (r *ExtensionResourceRepo) GetByUID(ctx context.Context, uid domain.ExtensionResourceUID) (*domain.ExtensionResource, error)
func (*ExtensionResourceRepo) GetIntent ¶
func (r *ExtensionResourceRepo) GetIntent(ctx context.Context, uid domain.ExtensionResourceUID, version domain.IntentVersion) (domain.ResourceIntent, error)
func (*ExtensionResourceRepo) GetType ¶
func (r *ExtensionResourceRepo) GetType(ctx context.Context, rt domain.ResourceType) (domain.ExtensionResourceType, error)
func (*ExtensionResourceRepo) GetView ¶
func (r *ExtensionResourceRepo) GetView(ctx context.Context, name domain.FullResourceName) (domain.ExtensionResourceView, error)
func (*ExtensionResourceRepo) ListByResourceType ¶
func (r *ExtensionResourceRepo) ListByResourceType(ctx context.Context, rt domain.ResourceType) ([]*domain.ExtensionResource, error)
func (*ExtensionResourceRepo) ListConditionTransitions ¶
func (r *ExtensionResourceRepo) ListConditionTransitions(ctx context.Context, uid domain.ExtensionResourceUID, conditionType *domain.ConditionType, limit int) ([]domain.ConditionTransition, error)
func (*ExtensionResourceRepo) ListObservations ¶
func (r *ExtensionResourceRepo) ListObservations(ctx context.Context, uid domain.ExtensionResourceUID, limit int) ([]domain.Observation, error)
func (*ExtensionResourceRepo) ListTypes ¶
func (r *ExtensionResourceRepo) ListTypes(ctx context.Context) ([]domain.ExtensionResourceType, error)
func (*ExtensionResourceRepo) ListViewsByType ¶
func (r *ExtensionResourceRepo) ListViewsByType(ctx context.Context, rt domain.ResourceType) ([]domain.ExtensionResourceView, error)
func (*ExtensionResourceRepo) ReplaceInventory ¶
func (r *ExtensionResourceRepo) ReplaceInventory(ctx context.Context, replacements []domain.InventoryReplacement) error
func (*ExtensionResourceRepo) UpdateType ¶
func (r *ExtensionResourceRepo) UpdateType(ctx context.Context, def domain.ExtensionResourceType) error
type FulfillmentRepo ¶
FulfillmentRepo implements domain.FulfillmentRepository backed by Postgres.
func (*FulfillmentRepo) Create ¶
func (r *FulfillmentRepo) Create(ctx context.Context, f *domain.Fulfillment) error
func (*FulfillmentRepo) Delete ¶
func (r *FulfillmentRepo) Delete(ctx context.Context, id domain.FulfillmentID) error
func (*FulfillmentRepo) Get ¶
func (r *FulfillmentRepo) Get(ctx context.Context, id domain.FulfillmentID) (*domain.Fulfillment, error)
func (*FulfillmentRepo) Update ¶
func (r *FulfillmentRepo) Update(ctx context.Context, f *domain.Fulfillment) error
type InventoryRepo ¶
InventoryRepo implements domain.InventoryRepository backed by Postgres.
func (*InventoryRepo) Create ¶
func (r *InventoryRepo) Create(ctx context.Context, item domain.InventoryItem) error
func (*InventoryRepo) CreateOrUpdate ¶
func (r *InventoryRepo) CreateOrUpdate(ctx context.Context, item domain.InventoryItem) error
func (*InventoryRepo) Delete ¶
func (r *InventoryRepo) Delete(ctx context.Context, id domain.InventoryItemID) error
func (*InventoryRepo) Get ¶
func (r *InventoryRepo) Get(ctx context.Context, id domain.InventoryItemID) (domain.InventoryItem, error)
func (*InventoryRepo) List ¶
func (r *InventoryRepo) List(ctx context.Context) ([]domain.InventoryItem, error)
func (*InventoryRepo) ListByType ¶
func (r *InventoryRepo) ListByType(ctx context.Context, t domain.InventoryItemType) ([]domain.InventoryItem, error)
func (*InventoryRepo) Update ¶
func (r *InventoryRepo) Update(ctx context.Context, item domain.InventoryItem) error
type QueryRepo ¶
type QueryRepo struct {
DB *sql.Tx
// Compiler defaults to querysql.Compiler with this package's
// queryFieldResolver and dollarParams when nil (see compiler()).
// Overridable for tests that need to exercise QueryResources
// against a stub compiler; in that case SchemaProvider is ignored
// since the override owns its own field resolution, if any.
Compiler querysql.CELSQLCompiler
// SchemaProvider is threaded into the default compiler so
// resource.spec.*/resource.observation.* field paths can be
// validated against real descriptors when known, and is also used
// to scope QueryResources to activated types (see
// [domain.ResolveQueryResourceTypeScope]). Nil is a valid,
// permissive default (no activation IN constraint).
SchemaProvider domain.QuerySchemaProvider
}
QueryRepo implements domain.QueryRepository for Postgres. It is the read model query surface over extension resources -- see domain.QueryRepository's doc for why this is not an aggregate repository.
TODO: do not restore platform aggregate search by re-adding a platform_rows CTE union in buildQueryResourcesSQL. Platform rows are reserved for a future identity/query model with its own indexes; a derived approximation over extension_resources is not the intended surface.
func (*QueryRepo) QueryResources ¶
func (r *QueryRepo) QueryResources(ctx context.Context, req domain.QueryResourcesRequest) (domain.QueryResourcesPage, error)
type ResourceIdentityRepo ¶
ResourceIdentityRepo implements domain.ResourceIdentityRepository backed by Postgres.
func (*ResourceIdentityRepo) Create ¶
func (r *ResourceIdentityRepo) Create(ctx context.Context, pr *domain.PlatformResource) error
func (*ResourceIdentityRepo) GetByName ¶
func (r *ResourceIdentityRepo) GetByName(ctx context.Context, name domain.ResourceName) (*domain.PlatformResource, error)
func (*ResourceIdentityRepo) ListByCollection ¶
func (r *ResourceIdentityRepo) ListByCollection(ctx context.Context, collection domain.CollectionName) ([]*domain.PlatformResource, error)
func (*ResourceIdentityRepo) ResolveAliasesBatch ¶
func (r *ResourceIdentityRepo) ResolveAliasesBatch(ctx context.Context, aliases []domain.Alias) (map[domain.Alias]domain.ResourceName, error)
ResolveAliasesBatch implements domain.ResourceIdentityRepository.ResolveAliasesBatch as a single round trip against resource_alias_claims, whose rows already carry the owning resource's name directly -- no join needed, and no DISTINCT needed either: UNIQUE(namespace, key, value) (see the migration's doc comment) guarantees at most one row per requested alias regardless of how many contributors back it.
This never consults extension_resources.reported_aliases -- an alias absent here simply isn't in the map ResolveAliasesBatch returns, whether it was never reported or is still pending reconciliation.
func (*ResourceIdentityRepo) Update ¶
func (r *ResourceIdentityRepo) Update(ctx context.Context, pr *domain.PlatformResource) error
type SignerEnrollmentRepo ¶
SignerEnrollmentRepo implements domain.SignerEnrollmentRepository backed by Postgres.
func (*SignerEnrollmentRepo) Create ¶
func (r *SignerEnrollmentRepo) Create(ctx context.Context, e domain.SignerEnrollment) error
func (*SignerEnrollmentRepo) Get ¶
func (r *SignerEnrollmentRepo) Get(ctx context.Context, id domain.SignerEnrollmentID) (domain.SignerEnrollment, error)
func (*SignerEnrollmentRepo) ListBySubject ¶
func (r *SignerEnrollmentRepo) ListBySubject(ctx context.Context, identity domain.FederatedIdentity) ([]domain.SignerEnrollment, error)
type Store ¶
type Store struct {
DB *sql.DB
// SchemaProvider is threaded into every QueryRepo this store
// hands out (see storeTx.Queries), so query-time
// resource.spec.*/resource.observation.* field validation and
// activation scoping can use the activated type set (see
// [domain.QuerySchemaProvider] and
// [domain.ResolveQueryResourceTypeScope]). Nil is a valid,
// permissive default (no activation IN constraint).
SchemaProvider domain.QuerySchemaProvider
}
Store implements domain.Store backed by Postgres.
type TargetRepo ¶
TargetRepo implements domain.TargetRepository backed by Postgres.
func (*TargetRepo) Create ¶
func (r *TargetRepo) Create(ctx context.Context, t domain.TargetInfo) error
func (*TargetRepo) CreateOrUpdate ¶
func (r *TargetRepo) CreateOrUpdate(ctx context.Context, t domain.TargetInfo) error
func (*TargetRepo) Get ¶
func (r *TargetRepo) Get(ctx context.Context, id domain.TargetID) (domain.TargetInfo, error)
func (*TargetRepo) List ¶
func (r *TargetRepo) List(ctx context.Context) ([]domain.TargetInfo, error)
type VaultStore ¶
VaultStore implements domain.Vault backed by Postgres. It operates on *sql.DB directly (not within the transactional Store) because vault operations are independent of domain entity transactions.
Source Files
¶
- auth_method_repo.go
- db.go
- delivery_record_repo.go
- deployment_repo.go
- extension_resource_repo.go
- fulfillment_repo.go
- helpers.go
- inventory_repo.go
- param_binder.go
- protojson_timestamp.go
- query_expr_json.go
- query_expr_string.go
- query_expr_timestamp.go
- query_filter.go
- query_filter_membership.go
- query_filter_presence.go
- query_pagination.go
- query_repo.go
- query_sql.go
- resource_identity_repo.go
- signer_enrollment_repo.go
- store.go
- target_repo.go
- testdb.go
- vault.go