provider

package
v0.9.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package provider is the domain layer for the Provider entity — the vendor / author of a Model. Anthropic, OpenAI, Meta-Llama, Mistral, Google. Operational concerns (BaseURL, auth) live on Host, not Provider. Provider is essentially display metadata + the identity Model rows hang their Owner.ID off.

store.go is the data-access layer for Provider. It maps Provider domain structs to and from the sqlc-generated row types. Metadata JSONB encoding is delegated to app/meta; this file only knows about Provider's Spec.

Store is concrete — no interface declared here. Consumers (snapshot composer, admin handlers, seed) each declare their own narrow interface locally if they want a test seam.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider struct {
	Meta meta.Metadata `json:"metadata" yaml:"metadata"`
	Spec Spec          `json:"spec"     yaml:"spec"`
}

Provider is the vendor that authors Models.

func (*Provider) IsEnabled

func (p *Provider) IsEnabled() bool

IsEnabled returns true when Enabled is unset or explicitly true.

func (*Provider) Validate

func (p *Provider) Validate() error

Validate runs intra-row rules via the shared meta.Validator and enforces the Provider-specific invariant that Owner.Kind, when set, is system. Empty is accepted — Providers are inherently system-defined, so YAML authors are not required to spell that out.

type Spec

type Spec struct {
	Enabled *bool `json:"enabled,omitempty" yaml:"enabled,omitempty"` // nil = true

	// Display metadata — operator-set, optional.
	HomepageURL   string     `json:"homepageURL,omitempty"   yaml:"homepageURL,omitempty"   validate:"omitempty,http_url"`
	DocsURL       string     `json:"docsURL,omitempty"       yaml:"docsURL,omitempty"       validate:"omitempty,http_url"`
	StatusPageURL string     `json:"statusPageURL,omitempty" yaml:"statusPageURL,omitempty" validate:"omitempty,http_url"`
	Icon          *meta.Icon `json:"icon,omitempty"          yaml:"icon,omitempty"`
}

Spec is display-only. There is no BaseURL on Provider — that lives on Host, since the same Provider (e.g. Anthropic) is served by multiple Hosts (Anthropic direct, Bedrock, Vertex). Per-Host serving info lives on standalone HostBinding entities (app/binding).

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store is the Provider data-access type. Holds a sqlc Queries handle.

func NewStore

func NewStore(q *gen.Queries) *Store

NewStore constructs a Store from an existing sqlc Queries handle. The caller owns the pgxpool / transaction; Store performs no connection mgmt.

func (*Store) Delete

func (s *Store) 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 (*Store) Get

func (s *Store) Get(ctx context.Context, id string) (*Provider, error)

Get returns the Provider with the given id, or (nil, nil) if not found.

func (*Store) List

func (s *Store) List(ctx context.Context) ([]*Provider, error)

List returns every Provider row in slug order. Cheap — catalog is small.

func (*Store) Upsert

func (s *Store) Upsert(ctx context.Context, p *Provider) error

Upsert writes p. Caller is responsible for stamping Meta.ID.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL