Documentation
¶
Overview ¶
Package store provides database access helpers and typed queries.
Index ¶
- func IsNotFound(err error) bool
- type DB
- type Store
- func (s *Store) CountQueuedAIJobsByInstance(ctx context.Context, instanceSlug string, limit int) (int, error)
- func (s *Store) DeleteRenderArtifact(ctx context.Context, id string) error
- func (s *Store) GetAIJob(ctx context.Context, id string) (*models.AIJob, error)
- func (s *Store) GetAIResult(ctx context.Context, id string) (*models.AIResult, error)
- func (s *Store) GetAttestation(ctx context.Context, id string) (*models.Attestation, error)
- func (s *Store) GetInstanceKey(ctx context.Context, id string) (*models.InstanceKey, error)
- func (s *Store) GetLinkPreview(ctx context.Context, id string) (*models.LinkPreview, error)
- func (s *Store) GetLinkSafetyBasicResult(ctx context.Context, id string) (*models.LinkSafetyBasicResult, error)
- func (s *Store) GetProvisionJob(ctx context.Context, id string) (*models.ProvisionJob, error)
- func (s *Store) GetRenderArtifact(ctx context.Context, id string) (*models.RenderArtifact, error)
- func (s *Store) GetUpdateJob(ctx context.Context, id string) (*models.UpdateJob, error)
- func (s *Store) ListActiveUpdateJobs(ctx context.Context, limit int) ([]*models.UpdateJob, error)
- func (s *Store) ListExpiredRenderArtifacts(ctx context.Context, now time.Time, limit int) ([]*models.RenderArtifact, error)
- func (s *Store) ListInstanceKeysByInstance(ctx context.Context, slug string, limit int) ([]*models.InstanceKey, error)
- func (s *Store) ListUpdateJobsByInstance(ctx context.Context, slug string, limit int) ([]*models.UpdateJob, error)
- func (s *Store) PutAIJob(ctx context.Context, item *models.AIJob) error
- func (s *Store) PutAIResult(ctx context.Context, item *models.AIResult) error
- func (s *Store) PutAttestation(ctx context.Context, item *models.Attestation) error
- func (s *Store) PutLinkPreview(ctx context.Context, item *models.LinkPreview) error
- func (s *Store) PutLinkSafetyBasicResult(ctx context.Context, item *models.LinkSafetyBasicResult) error
- func (s *Store) PutProvisionJob(ctx context.Context, item *models.ProvisionJob) error
- func (s *Store) PutRenderArtifact(ctx context.Context, item *models.RenderArtifact) error
- func (s *Store) PutUpdateJob(ctx context.Context, item *models.UpdateJob) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsNotFound ¶
IsNotFound reports whether an error represents a not-found condition.
Types ¶
type DB ¶
type DB interface {
core.DB
TransactWrite(ctx context.Context, fn func(core.TransactionBuilder) error) error
}
DB is the storage interface used by Store.
func LambdaInit ¶
LambdaInit initializes the database connection and registers all models.
type Store ¶
type Store struct {
DB DB
}
Store provides access to the application's persisted models.
func (*Store) CountQueuedAIJobsByInstance ¶
func (s *Store) CountQueuedAIJobsByInstance(ctx context.Context, instanceSlug string, limit int) (int, error)
CountQueuedAIJobsByInstance returns the number of queued AI jobs for an instance, up to limit.
func (*Store) DeleteRenderArtifact ¶
DeleteRenderArtifact deletes a RenderArtifact by ID.
func (*Store) GetAIResult ¶
GetAIResult loads an AIResult by ID.
func (*Store) GetAttestation ¶
GetAttestation loads an Attestation by ID.
func (*Store) GetInstanceKey ¶
func (*Store) GetLinkPreview ¶
GetLinkPreview loads a LinkPreview by ID.
func (*Store) GetLinkSafetyBasicResult ¶
func (s *Store) GetLinkSafetyBasicResult(ctx context.Context, id string) (*models.LinkSafetyBasicResult, error)
GetLinkSafetyBasicResult loads a LinkSafetyBasicResult by ID.
func (*Store) GetProvisionJob ¶
GetProvisionJob loads a ProvisionJob by ID.
func (*Store) GetRenderArtifact ¶
GetRenderArtifact loads a RenderArtifact by ID.
func (*Store) GetUpdateJob ¶
func (*Store) ListActiveUpdateJobs ¶ added in v0.2.3
func (*Store) ListExpiredRenderArtifacts ¶
func (s *Store) ListExpiredRenderArtifacts(ctx context.Context, now time.Time, limit int) ([]*models.RenderArtifact, error)
ListExpiredRenderArtifacts lists artifacts past their expiry, ordered by expiry time.
func (*Store) ListInstanceKeysByInstance ¶
func (*Store) ListUpdateJobsByInstance ¶
func (*Store) PutAIResult ¶
PutAIResult creates or updates an AIResult.
func (*Store) PutAttestation ¶
PutAttestation creates or updates an Attestation.
func (*Store) PutLinkPreview ¶
PutLinkPreview creates or updates a LinkPreview.
func (*Store) PutLinkSafetyBasicResult ¶
func (s *Store) PutLinkSafetyBasicResult(ctx context.Context, item *models.LinkSafetyBasicResult) error
PutLinkSafetyBasicResult creates or updates a LinkSafetyBasicResult.
func (*Store) PutProvisionJob ¶
PutProvisionJob creates or updates a ProvisionJob.
func (*Store) PutRenderArtifact ¶
PutRenderArtifact creates or updates a RenderArtifact.