Documentation
¶
Overview ¶
Package skillpg stores Skills and their versions in PostgreSQL. Version archives are sealed with the credential key and bound to their tenant, Skill, version ID and number.
Index ¶
- func LockSkills(ctx context.Context, q *sqlc.Queries, tenant pgtype.UUID, ids []string) (map[string]skills.Skill, error)
- func ReadVersionForFreeze(ctx context.Context, q *sqlc.Queries, cipher *credentialcrypto.Cipher, ...) (skills.Content, error)
- type Store
- func (s *Store) CreateSkill(ctx context.Context, in skills.NewSkill) (skills.Skill, error)
- func (s *Store) CreateVersion(ctx context.Context, in skills.NewVersion) (skills.Version, error)
- func (s *Store) DefaultVersionContent(ctx context.Context, tenantID string, skillID uuid.UUID) (skills.Content, error)
- func (s *Store) DeleteSkill(ctx context.Context, tenantID string, skillID uuid.UUID) error
- func (s *Store) SetDefaultVersion(ctx context.Context, tenantID string, skillID uuid.UUID, version int64) (skills.Skill, error)
- func (s *Store) Skill(ctx context.Context, tenantID string, id uuid.UUID) (skills.Skill, error)
- func (s *Store) Skills(ctx context.Context, tenantID string, page skills.SkillPageQuery) (skills.Page, error)
- func (s *Store) Version(ctx context.Context, tenantID string, skillID uuid.UUID, version int64) (skills.Version, error)
- func (s *Store) VersionByID(ctx context.Context, tenantID string, id uuid.UUID) (skills.Version, error)
- func (s *Store) VersionContent(ctx context.Context, tenantID string, skillID uuid.UUID, version int64) (skills.Content, error)
- func (s *Store) Versions(ctx context.Context, tenantID string, skillID uuid.UUID, ...) (skills.VersionPage, error)
- func (s *Store) WithVersionDeletion(ctx context.Context, tenantID string, skillID uuid.UUID, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LockSkills ¶ added in v0.0.10
func LockSkills(ctx context.Context, q *sqlc.Queries, tenant pgtype.UUID, ids []string) (map[string]skills.Skill, error)
LockSkills locks, on q, the tenant's Skills in ID order, whatever the order of ids, so callers never lock them in opposite orders. It returns them by ID; a malformed or missing one is skills.ErrNotFound.
func ReadVersionForFreeze ¶ added in v0.0.10
func ReadVersionForFreeze(ctx context.Context, q *sqlc.Queries, cipher *credentialcrypto.Cipher, tenant pgtype.UUID, skillID string, version int64) (skills.Content, error)
ReadVersionForFreeze reads, on q, a version of the tenant's Skill, opens it with cipher and verifies it is still the archive the version records. A missing version is skills.ErrNotFound; one that does not open or verify is corrupt stored data, an internal error.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the Skills storage and Reader.
func New ¶
func New(pool *pgunit.Pool, cipher *credentialcrypto.Cipher) *Store
New builds the Skill store, which seals archives with cipher.