Documentation
¶
Overview ¶
Package catalogstore is the Postgres data-access layer for the catalog kinds (provider, host, model, pricing, binding, policy, ratelimit). The kinds' types and validation live in pkg/catalogkind, free of storage, so tools that read the catalog without a database share them. Each store is concrete, with no interface declared here; consumers declare their own narrow interface if they want a test seam. Other entities keep their stores beside their types.
Index ¶
- type BindingStore
- func (s *BindingStore) Delete(ctx context.Context, id string) error
- func (s *BindingStore) DeleteAtVersion(ctx context.Context, id, version string) error
- func (s *BindingStore) Get(ctx context.Context, id string) (*binding.Binding, error)
- func (s *BindingStore) List(ctx context.Context) ([]*binding.Binding, error)
- func (s *BindingStore) Upsert(ctx context.Context, b *binding.Binding) error
- type DetachedStore
- type HostStore
- func (s *HostStore) Delete(ctx context.Context, id string) error
- func (s *HostStore) DeleteAtVersion(ctx context.Context, id, version string) error
- func (s *HostStore) Get(ctx context.Context, id string) (*host.Host, error)
- func (s *HostStore) List(ctx context.Context) ([]*host.Host, error)
- func (s *HostStore) Upsert(ctx context.Context, h *host.Host) error
- type ModelStore
- func (s *ModelStore) Delete(ctx context.Context, id string) error
- func (s *ModelStore) DeleteAtVersion(ctx context.Context, id, version string) error
- func (s *ModelStore) Get(ctx context.Context, id string) (*model.Model, error)
- func (s *ModelStore) List(ctx context.Context) ([]*model.Model, error)
- func (s *ModelStore) Upsert(ctx context.Context, m *model.Model) error
- type PolicyStore
- func (s *PolicyStore) Delete(ctx context.Context, id string) error
- func (s *PolicyStore) DeleteAtVersion(ctx context.Context, id, version string) error
- func (s *PolicyStore) Get(ctx context.Context, id string) (*policy.Policy, error)
- func (s *PolicyStore) List(ctx context.Context) ([]*policy.Policy, error)
- func (s *PolicyStore) Upsert(ctx context.Context, p *policy.Policy) error
- type PricingStore
- func (s *PricingStore) Delete(ctx context.Context, id string) error
- func (s *PricingStore) DeleteAtVersion(ctx context.Context, id, version string) error
- func (s *PricingStore) Get(ctx context.Context, id string) (*pricing.Pricing, error)
- func (s *PricingStore) List(ctx context.Context) ([]*pricing.Pricing, error)
- func (s *PricingStore) Upsert(ctx context.Context, p *pricing.Pricing) error
- type ProviderStore
- func (s *ProviderStore) Delete(ctx context.Context, id string) error
- func (s *ProviderStore) DeleteAtVersion(ctx context.Context, id, version string) error
- func (s *ProviderStore) Get(ctx context.Context, id string) (*provider.Provider, error)
- func (s *ProviderStore) List(ctx context.Context) ([]*provider.Provider, error)
- func (s *ProviderStore) Upsert(ctx context.Context, p *provider.Provider) error
- type RateLimitStore
- func (s *RateLimitStore) Delete(ctx context.Context, id string) error
- func (s *RateLimitStore) DeleteAtVersion(ctx context.Context, id, version string) error
- func (s *RateLimitStore) Get(ctx context.Context, id string) (*ratelimit.RateLimit, error)
- func (s *RateLimitStore) List(ctx context.Context) ([]*ratelimit.RateLimit, error)
- func (s *RateLimitStore) Upsert(ctx context.Context, rl *ratelimit.RateLimit) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BindingStore ¶
type BindingStore struct {
// contains filtered or unexported fields
}
BindingStore is the HostBinding data-access type.
func NewBindingStore ¶
func NewBindingStore(db gen.DBTX) *BindingStore
NewBindingStore constructs a BindingStore bound to a pool or an open transaction.
func (*BindingStore) Delete ¶
func (s *BindingStore) Delete(ctx context.Context, id string) error
Delete removes a HostBinding by id.
func (*BindingStore) DeleteAtVersion ¶ added in v0.21.0
func (s *BindingStore) DeleteAtVersion(ctx context.Context, id, version string) error
DeleteAtVersion removes the HostBinding while it still has version.
func (*BindingStore) Get ¶
Get returns the HostBinding with the given id, or (nil, nil) if not found.
type DetachedStore ¶ added in v0.21.0
type DetachedStore struct {
// contains filtered or unexported fields
}
DetachedStore answers whether any catalog row is detached, in one query cheap enough to ask on every catalog poll.
func NewDetachedStore ¶ added in v0.21.0
func NewDetachedStore(q *gen.Queries) *DetachedStore
NewDetachedStore constructs a DetachedStore from an existing sqlc Queries handle.
type HostStore ¶
type HostStore struct {
// contains filtered or unexported fields
}
HostStore is the Host data-access type. Holds a sqlc Queries handle.
func NewHostStore ¶
NewHostStore constructs a HostStore from an existing sqlc Queries handle. The caller owns the pgxpool / transaction; the store performs no connection mgmt.
func (*HostStore) Delete ¶
Delete removes a Host by id. sqlc returns nil on a no-rows delete; callers can pre-check existence via the snapshot if they need a 404.
func (*HostStore) DeleteAtVersion ¶ added in v0.21.0
DeleteAtVersion removes the Host while it still has version.
type ModelStore ¶
type ModelStore struct {
// contains filtered or unexported fields
}
ModelStore is the Model data-access type.
func NewModelStore ¶
func NewModelStore(q *gen.Queries) *ModelStore
NewModelStore constructs a ModelStore from an existing sqlc Queries handle.
func (*ModelStore) Delete ¶
func (s *ModelStore) Delete(ctx context.Context, id string) error
Delete removes a Model by id.
func (*ModelStore) DeleteAtVersion ¶ added in v0.21.0
func (s *ModelStore) DeleteAtVersion(ctx context.Context, id, version string) error
DeleteAtVersion removes the Model while it still has version.
type PolicyStore ¶
type PolicyStore struct {
// contains filtered or unexported fields
}
PolicyStore is the Policy data-access type. Holds a DB rather than Queries so Upsert can run a multi-table transaction; List reads without one.
func NewPolicyStore ¶
func NewPolicyStore(db storage.DB) *PolicyStore
NewPolicyStore constructs a PolicyStore bound to a pool or an open transaction.
func (*PolicyStore) Delete ¶
func (s *PolicyStore) Delete(ctx context.Context, id string) error
Delete removes a Policy by id. Junction rows cascade via FK.
func (*PolicyStore) DeleteAtVersion ¶ added in v0.21.0
func (s *PolicyStore) DeleteAtVersion(ctx context.Context, id, version string) error
DeleteAtVersion removes the Policy while it still has version.
func (*PolicyStore) Get ¶
Get returns the Policy with the given id and its links, or (nil, nil) if not found.
type PricingStore ¶
type PricingStore struct {
// contains filtered or unexported fields
}
PricingStore is the Pricing data-access type. Holds a DB rather than Queries so Upsert can run a multi-table transaction.
func NewPricingStore ¶
func NewPricingStore(db storage.DB) *PricingStore
NewPricingStore constructs a PricingStore bound to a pool or an open transaction.
func (*PricingStore) Delete ¶
func (s *PricingStore) Delete(ctx context.Context, id string) error
Delete removes a Pricing by id. Junction rows cascade via FK.
func (*PricingStore) DeleteAtVersion ¶ added in v0.21.0
func (s *PricingStore) DeleteAtVersion(ctx context.Context, id, version string) error
DeleteAtVersion removes the Pricing while it still has version.
func (*PricingStore) Get ¶
Get returns the Pricing with the given id, hydrating TargetModelIDs. Returns (nil, nil) if not found.
type ProviderStore ¶
type ProviderStore struct {
// contains filtered or unexported fields
}
ProviderStore is the Provider data-access type. Holds a sqlc Queries handle.
func NewProviderStore ¶
func NewProviderStore(q *gen.Queries) *ProviderStore
NewProviderStore constructs a ProviderStore from an existing sqlc Queries handle. The caller owns the pgxpool / transaction; the store performs no connection mgmt.
func (*ProviderStore) Delete ¶
func (s *ProviderStore) Delete(ctx context.Context, id string) error
Delete removes a Provider by id. sqlc returns nil on a no-rows delete; callers can pre-check existence via the snapshot if they need a 404.
func (*ProviderStore) DeleteAtVersion ¶ added in v0.21.0
func (s *ProviderStore) DeleteAtVersion(ctx context.Context, id, version string) error
DeleteAtVersion removes the Provider while it still has version.
type RateLimitStore ¶
type RateLimitStore struct {
// contains filtered or unexported fields
}
RateLimitStore is the RateLimit data-access type.
func NewRateLimitStore ¶
func NewRateLimitStore(q *gen.Queries) *RateLimitStore
NewRateLimitStore constructs a RateLimitStore from an existing sqlc Queries handle.
func (*RateLimitStore) Delete ¶
func (s *RateLimitStore) Delete(ctx context.Context, id string) error
Delete removes a RateLimit by id.
func (*RateLimitStore) DeleteAtVersion ¶ added in v0.21.0
func (s *RateLimitStore) DeleteAtVersion(ctx context.Context, id, version string) error
DeleteAtVersion removes the RateLimit while it still has version.
func (*RateLimitStore) Get ¶
Get returns the RateLimit with the given id, or (nil, nil) if not found.