Documentation
¶
Overview ¶
Package store is the API server's PostgreSQL-backed repo configuration store. It is a concrete integration adapter (analogous to internal/github): it owns the SQL connection, embedded migrations, and the sqlc-generated query layer. Only the server/api layer consumes it; nothing in core (engine/git) or actions may import it.
Index ¶
- Variables
- type Repo
- type Store
- func (s *Store) AddRepo(ctx context.Context, r Repo) (Repo, error)
- func (s *Store) Close() error
- func (s *Store) DB() *sql.DB
- func (s *Store) DeleteRepo(ctx context.Context, id string) error
- func (s *Store) GetRepo(ctx context.Context, id string) (Repo, error)
- func (s *Store) ListRepos(ctx context.Context) ([]Repo, error)
Constants ¶
This section is empty.
Variables ¶
var ErrRepoNotFound = errors.New("repo not found")
ErrRepoNotFound is returned by GetRepo when no row matches the given ID.
Functions ¶
This section is empty.
Types ¶
type Repo ¶
type Repo struct {
ID string
DisplayName string
Owner string
Name string
Path string
Remote string
// AddedBy is the GitHub login of the user who onboarded the repo at
// runtime, or empty for operator-seeded repos (shared with everyone).
AddedBy string
CreatedAt time.Time
UpdatedAt time.Time
}
Repo is a persisted repo-configuration row. Fields mirror the server's repoConfig minus reposRoot, which is a server-level resolution input rather than a per-repo property: keeping it out of the row lets two hosts point the same table at different checkout roots. Path is the RAW stored value (may be empty, relative, or owner/name-derivable); the server resolves it after loading via normalizeRepoEntry.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store holds the Postgres connection pool and the generated query layer.
func Open ¶
Open connects to Postgres at connString, applies pending migrations, and returns a ready-to-use Store. The connection is closed if migrations fail.
func (*Store) AddRepo ¶
AddRepo inserts r and returns the stored row with its server-assigned timestamps. The caller is responsible for validating r.ID (see repoIDPattern in apps/server) before calling.
func (*Store) DB ¶
DB exposes the underlying pool so other server-scoped stores (e.g. a future session store) can share the same connection.
func (*Store) DeleteRepo ¶
DeleteRepo removes the repo with the given ID. Deleting a missing row is a no-op (no error), matching DELETE semantics.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package testpostgres provisions a Postgres backend for store tests.
|
Package testpostgres provisions a Postgres backend for store tests. |