Documentation
¶
Overview ¶
Package templatepg stores Environment Templates in PostgreSQL. Confidential configuration (env, setup commands, Skill and Plugin archives and initial file contents) is sealed with the credential key, each field bound to its tenant, Template and field; safe metadata is stored beside it in plaintext.
Index ¶
- type Store
- func (s *Store) Create(ctx context.Context, tenantID string, in environmenttemplates.Input) (environmenttemplates.Template, error)
- func (s *Store) Delete(ctx context.Context, tenantID, templateID string) (string, error)
- func (s *Store) Get(ctx context.Context, tenantID, templateID string) (environmenttemplates.Template, error)
- func (s *Store) List(ctx context.Context, tenantID string, query environmenttemplates.ListQuery) (environmenttemplates.Page, error)
- func (s *Store) Resolve(ctx context.Context, tenantID, templateID string) (environmenttemplates.Resolved, error)
- func (s *Store) Update(ctx context.Context, tenantID, templateID string, ...) (environmenttemplates.Template, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store implements environmenttemplates.Storage and environmenttemplates.Reader.
func New ¶
func New(pool *pgunit.Pool, cipher *credentialcrypto.Cipher) *Store
New returns a Store that seals and opens confidential configuration with cipher.
func (*Store) Create ¶
func (s *Store) Create(ctx context.Context, tenantID string, in environmenttemplates.Input) (environmenttemplates.Template, error)
func (*Store) List ¶
func (s *Store) List(ctx context.Context, tenantID string, query environmenttemplates.ListQuery) (environmenttemplates.Page, error)
List reads the cursor Template and the page in one snapshot. A cursor that names no Template of the tenant returns ErrNotFound.
func (*Store) Resolve ¶
func (s *Store) Resolve(ctx context.Context, tenantID, templateID string) (environmenttemplates.Resolved, error)
Resolve reads one row, so the metadata and every confidential field come from the same committed version. Stored data that does not decode or match its sealed contents is corrupt, an internal error; configuration that decodes but fails current validation is ErrInvalidInput. Any malformed ID resolves to ErrNotFound.
func (*Store) Update ¶
func (s *Store) Update(ctx context.Context, tenantID, templateID string, in environmenttemplates.Input) (environmenttemplates.Template, error)
Update seals before it looks the Template up, so a malformed ID takes the path of a missing one. Each supplied field replaces atomically in one statement, so concurrent updates of other fields are kept.