postgres

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: Apache-2.0 Imports: 21 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 postgres is the Postgres store engine (story #85, ADR 0028), through pgx/v5 behind database/sql. Store implements store.APIStore with the same semantics as the SQLite engine; queries are generated by sqlc from queries.sql and the migrations in store/migrations/postgres.

This file holds the schema side: the schema key that scopes every advisory lock to the current schema, and the goose migrations, run under a session advisory lock so that processes starting at once migrate one after the other.

Index

Constants

View Source
const DriverName = "pgx"

DriverName is the database/sql driver name of pgx/v5/stdlib.

Variables

View Source
var ErrNoDatabase = errors.New("store: postgres: the database does not exist")

ErrNoDatabase says that the database named by the DSN does not exist on the server. Reader.Initialized tells whether Angelia ever created its tables in it.

View Source
var ErrNoSchema = errors.New("store: postgres: the search_path names no existing schema")

ErrNoSchema says that the connection's search_path names no existing schema, so current_schema() is NULL and there is nowhere to create the tables.

Functions

func Migrate

func Migrate(ctx context.Context, db *sql.DB, logger *slog.Logger) (int, error)

Migrate applies the pending Postgres migrations to the current schema and returns how many it applied. Running it on an up-to-date schema is a no-op. It holds a session advisory lock, scoped to the schema, while it runs, so processes that start at once on an empty schema both succeed and goose records each version once. A nil logger means slog.Default.

func SchemaKey

func SchemaKey(ctx context.Context, db *sql.DB) (int32, error)

SchemaKey returns the advisory-lock key of the connection's current schema, hashtext(current_schema()) (ADR 0028 §4). Two schemas, for example two Angelia instances in one database or two tests, get different keys, so their locks do not contend; a hash collision only adds waiting. It returns ErrNoSchema when current_schema() is NULL.

Types

type AckConsumerParams

type AckConsumerParams struct {
	Seq  int64
	Now  int64
	Name string
}

type AcquireLeaseParams

type AcquireLeaseParams struct {
	Name      string
	Holder    string
	ExpiresAt int64
}

type AddPendingReleaseParams

type AddPendingReleaseParams struct {
	WatchID     string
	TargetID    string
	Raw         string
	HeldAt      int64
	ReleaseJson string
}

type AddVersionParams

type AddVersionParams struct {
	TargetID    string
	Raw         string
	Normalized  string
	PublishedAt sql.NullInt64
	Prerelease  bool
	Yanked      bool
	FirstSeenAt int64
	RemovedAt   sql.NullInt64
}

type AdvisoryXactLockParams

type AdvisoryXactLockParams struct {
	SchemaKey int32
	Kind      int32
}

type ApiToken

type ApiToken struct {
	ID         string
	Name       string
	Scope      string
	Hash       []byte
	CreatedAt  int64
	CreatedBy  string
	ExpiresAt  sql.NullInt64
	LastUsedAt sql.NullInt64
	RevokedAt  sql.NullInt64
	RevokedBy  sql.NullString
}

type Consumer

type Consumer struct {
	ID         string
	Name       string
	FilterJson string
	AckedSeq   int64
	AckedAt    sql.NullInt64
	CreatedAt  int64
	UpdatedAt  int64
}

type CountDeliveriesByStatusRow

type CountDeliveriesByStatusRow struct {
	Status string
	N      int64
}

type CountSecretsByKeyIDRow

type CountSecretsByKeyIDRow struct {
	KeyID string
	N     int64
}

type CreateAPITokenParams

type CreateAPITokenParams struct {
	ID        string
	Name      string
	Scope     string
	Hash      []byte
	CreatedAt int64
	CreatedBy string
	ExpiresAt sql.NullInt64
}

type CreateConsumerParams

type CreateConsumerParams struct {
	ID         string
	Name       string
	FilterJson string
	AckedSeq   int64
	AckedAt    sql.NullInt64
	CreatedAt  int64
	UpdatedAt  int64
}

type CreateEventParams

type CreateEventParams struct {
	ID          string
	WatchID     string
	Type        string
	PayloadJson string
	CreatedAt   int64
	RefEventID  sql.NullString
}

type CreateSecretParams

type CreateSecretParams struct {
	ID         string
	Name       string
	HostsJson  string
	KeyID      string
	Ciphertext []byte
	CreatedAt  int64
	UpdatedAt  int64
}

type CreateSinkParams

type CreateSinkParams struct {
	ID         string
	Kind       string
	ConfigJson []byte
	Name       sql.NullString
	ManagedBy  string
}

type CreateSubscriptionParams

type CreateSubscriptionParams struct {
	ID         string
	FilterJson string
	SinkID     string
	Template   string
	Name       sql.NullString
	ManagedBy  string
	PolicyJson string
}

type CreateTargetParams

type CreateTargetParams struct {
	ID              string
	Kind            string
	CoordinatesJson string
	FetchStateJson  string
	LastCheckedAt   sql.NullInt64
	NextCheckAt     int64
	ErrorCount      int64
	IntervalMs      sql.NullInt64
	SourceKind      sql.NullString
}

type CreateWatchParams

type CreateWatchParams struct {
	ID           string
	TargetID     string
	PolicyJson   string
	LabelsJson   string
	BaselineDone bool
	Name         sql.NullString
	ManagedBy    string
	IntervalMs   sql.NullInt64
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type DeleteExpiredLeaseParams

type DeleteExpiredLeaseParams struct {
	Name      string
	ExpiresAt int64
}

type DeleteHeldDeliveriesOfEventParams

type DeleteHeldDeliveriesOfEventParams struct {
	EventID string
	Now     sql.NullInt64
}

type DeletePendingReleaseParams

type DeletePendingReleaseParams struct {
	WatchID  string
	TargetID string
	Raw      string
}

type Delivery

type Delivery struct {
	ID                  string
	EventID             string
	SubscriptionID      string
	Status              string
	Attempts            int64
	NextAttemptAt       sql.NullInt64
	LastError           sql.NullString
	HeldUntil           sql.NullInt64
	HoldStartedAt       sql.NullInt64
	HoldWatchCooldownMs sql.NullInt64
	HoldPrerelease      sql.NullBool
	HoldWatchID         sql.NullString
	HoldRaw             sql.NullString
	HoldInput           sql.NullString
	Traceparent         sql.NullString
	ReplayBaseAttempts  int64
}

type Event

type Event struct {
	Seq         int64
	ID          string
	WatchID     string
	Type        string
	PayloadJson string
	CreatedAt   int64
	RefEventID  sql.NullString
}

type EventPrune

type EventPrune struct {
	ID               int64
	HighestPrunedSeq int64
}

type FailHeldDeliveryParams

type FailHeldDeliveryParams struct {
	Reason string
	ID     string
	Now    sql.NullInt64
}

type FailPendingDeliveriesParams

type FailPendingDeliveriesParams struct {
	LastError      sql.NullString
	SubscriptionID string
}

type FinishLeasedDeliveryParams

type FinishLeasedDeliveryParams struct {
	Status        string
	NextAttemptAt sql.NullInt64
	LastError     sql.NullString
	ID            string
	Attempt       int64
	LeaseName     string
	Holder        string
}

type GetLatestEventBySubjectParams

type GetLatestEventBySubjectParams struct {
	WatchID   string
	Subject   string
	TypesJson json.RawMessage
}

type GetTargetByCoordinatesParams

type GetTargetByCoordinatesParams struct {
	Kind            string
	CoordinatesJson string
}

type Lease

type Lease struct {
	Name      string
	Holder    string
	ExpiresAt int64
}

type ListAPITokensPageParams

type ListAPITokensPageParams struct {
	AfterID string
	MaxRows int32
}

type ListActiveAPITokensPageParams

type ListActiveAPITokensPageParams struct {
	AfterID string
	MaxRows int32
}

type ListConsumersPageParams

type ListConsumersPageParams struct {
	AfterName string
	AfterID   string
	MaxRows   int32
}

type ListDeliveriesPageParams

type ListDeliveriesPageParams struct {
	StatusesJson        json.RawMessage
	SubscriptionIdsJson string
	EventID             string
	BeforeSeq           int64
	BeforeID            string
	MaxRows             int32
}

type ListDeliveriesPageRow

type ListDeliveriesPageRow struct {
	Delivery Delivery
	EventSeq int64
}

type ListEventsAfterParams

type ListEventsAfterParams struct {
	Seq   int64
	Limit int32
}

type ListHeldDeliveriesParams

type ListHeldDeliveriesParams struct {
	SubscriptionID string
	Now            int64
}

type ListLeasableDueDeliveriesParams

type ListLeasableDueDeliveriesParams struct {
	Now     int64
	MaxRows int32
}

type ListLeasableDueTargetsParams

type ListLeasableDueTargetsParams struct {
	Now     int64
	MaxRows int32
}

type ListNamedSinksPageParams

type ListNamedSinksPageParams struct {
	AfterName string
	AfterID   string
	MaxRows   int32
}

type ListNamedSubscriptionsPageParams

type ListNamedSubscriptionsPageParams struct {
	AfterName string
	AfterID   string
	MaxRows   int32
}

type ListNamedWatchesPageParams

type ListNamedWatchesPageParams struct {
	AfterName string
	AfterID   string
	MaxRows   int32
}

type ListPendingReleasesRow

type ListPendingReleasesRow struct {
	WatchID     string
	TargetID    string
	Raw         string
	HeldAt      int64
	ReleaseJson string
	Yanked      bool
	RemovedAt   sql.NullInt64
}

type ListReplayCandidatesParams

type ListReplayCandidatesParams struct {
	StatusesJson   json.RawMessage
	EventID        string
	SubscriptionID string
}

type ListReplayCandidatesRow

type ListReplayCandidatesRow struct {
	Delivery    Delivery
	EventSeq    int64
	PayloadJson string
}

type ListTargetDemandRow

type ListTargetDemandRow struct {
	Kind       string
	IntervalMs sql.NullInt64
	Targets    int64
}

type ListTargetSourcesRow

type ListTargetSourcesRow struct {
	Kind       string
	SourceKind sql.NullString
	Targets    int64
}

type PendingRelease

type PendingRelease struct {
	WatchID     string
	TargetID    string
	Raw         string
	HeldAt      int64
	ReleaseJson string
}

type PruneBatchEndParams

type PruneBatchEndParams struct {
	AfterSeq int64
	Before   int64
	Batch    int32
}

type PruneDeliveriesParams

type PruneDeliveriesParams struct {
	AfterSeq int64
	UpToSeq  int64
	Before   int64
}

type PruneEventsParams

type PruneEventsParams struct {
	AfterSeq int64
	UpToSeq  int64
	Before   int64
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) AckConsumer

func (q *Queries) AckConsumer(ctx context.Context, arg AckConsumerParams) (Consumer, error)

One statement, so concurrent acks never move the cursor back: the UPDATE re-reads the newest row version under READ COMMITTED.

func (*Queries) AcquireLease

func (q *Queries) AcquireLease(ctx context.Context, arg AcquireLeaseParams) (int64, error)

func (*Queries) AddPendingRelease

func (q *Queries) AddPendingRelease(ctx context.Context, arg AddPendingReleaseParams) (int64, error)

func (*Queries) AddVersion

func (q *Queries) AddVersion(ctx context.Context, arg AddVersionParams) (int64, error)

func (*Queries) AdvisoryXactLock

func (q *Queries) AdvisoryXactLock(ctx context.Context, arg AdvisoryXactLockParams) error

Postgres twin of sqlite/queries.sql (story #85, ADR 0028). The queries keep the SQLite names and semantics; the differences are Postgres syntax ($n, greatest, NULLS FIRST), booleans for the 0/1 flags, and lists passed as JSON text (json_array_elements_text) instead of sqlc.slice (ADR 0028 §5). Advisory locks (ADR 0028 §4): the first argument is the schema key, the second the kind (1 config, 2 event, 3 lease).

func (*Queries) CountAPITokens

func (q *Queries) CountAPITokens(ctx context.Context) (int64, error)

func (*Queries) CountActiveAdminTokens

func (q *Queries) CountActiveAdminTokens(ctx context.Context, now int64) (int64, error)

func (*Queries) CountDeliveriesByStatus

func (q *Queries) CountDeliveriesByStatus(ctx context.Context) ([]CountDeliveriesByStatusRow, error)

func (*Queries) CountLeasableDueTargets

func (q *Queries) CountLeasableDueTargets(ctx context.Context, now int64) (int64, error)

func (*Queries) CountSecretsByKeyID

func (q *Queries) CountSecretsByKeyID(ctx context.Context) ([]CountSecretsByKeyIDRow, error)

func (*Queries) CreateAPIToken

func (q *Queries) CreateAPIToken(ctx context.Context, arg CreateAPITokenParams) error

API tokens (story #72, ADR 0030 T3). Every write is one statement and takes no config lock: the races (same active name, same id) end on the primary key and the partial unique index.

func (*Queries) CreateConsumer

func (q *Queries) CreateConsumer(ctx context.Context, arg CreateConsumerParams) error

Named consumers (story #79-B).

func (*Queries) CreateDeliveries

func (q *Queries) CreateDeliveries(ctx context.Context, deliveriesJson json.RawMessage) error

All deliveries of an event in one statement (ADR 0028 §1: the event lock is held for one round trip per event, whatever the number of subscriptions). deliveries_json is an array of objects keyed by column name.

func (*Queries) CreateEvent

func (q *Queries) CreateEvent(ctx context.Context, arg CreateEventParams) error

func (*Queries) CreateSecret

func (q *Queries) CreateSecret(ctx context.Context, arg CreateSecretParams) error

Stored secrets (story #75, ADR 0024 section 6).

func (*Queries) CreateSink

func (q *Queries) CreateSink(ctx context.Context, arg CreateSinkParams) error

func (*Queries) CreateSubscription

func (q *Queries) CreateSubscription(ctx context.Context, arg CreateSubscriptionParams) error

func (*Queries) CreateTarget

func (q *Queries) CreateTarget(ctx context.Context, arg CreateTargetParams) error

func (*Queries) CreateWatch

func (q *Queries) CreateWatch(ctx context.Context, arg CreateWatchParams) error

func (*Queries) DeleteConsumer

func (q *Queries) DeleteConsumer(ctx context.Context, id string) (int64, error)

func (*Queries) DeleteExpiredLease

func (q *Queries) DeleteExpiredLease(ctx context.Context, arg DeleteExpiredLeaseParams) error

func (*Queries) DeleteExpiredTargetLeases

func (q *Queries) DeleteExpiredTargetLeases(ctx context.Context, expiresAt int64) (int64, error)

func (*Queries) DeleteHeldDeliveriesOfEvent

func (q *Queries) DeleteHeldDeliveriesOfEvent(ctx context.Context, arg DeleteHeldDeliveriesOfEventParams) (int64, error)

A yank cancels the deliveries of the original event that are still held (ADR 0014 section 4, ADR 0018).

func (*Queries) DeletePendingRelease

func (q *Queries) DeletePendingRelease(ctx context.Context, arg DeletePendingReleaseParams) (int64, error)

func (*Queries) DeletePendingReleasesOfWatch

func (q *Queries) DeletePendingReleasesOfWatch(ctx context.Context, watchID string) (int64, error)

func (*Queries) DeleteSecret

func (q *Queries) DeleteSecret(ctx context.Context, id string) (int64, error)

func (*Queries) DeleteSink

func (q *Queries) DeleteSink(ctx context.Context, id string) (int64, error)

func (*Queries) DeleteSubscription

func (q *Queries) DeleteSubscription(ctx context.Context, id string) (int64, error)

func (*Queries) DeleteTargetIfUnused

func (q *Queries) DeleteTargetIfUnused(ctx context.Context, id string) (int64, error)

func (*Queries) DeleteTargetVersions

func (q *Queries) DeleteTargetVersions(ctx context.Context, targetID string) error

func (*Queries) DeleteWatch

func (q *Queries) DeleteWatch(ctx context.Context, id string) (int64, error)

func (*Queries) FailHeldDelivery

func (q *Queries) FailHeldDelivery(ctx context.Context, arg FailHeldDeliveryParams) (int64, error)

func (*Queries) FailPendingDeliveries

func (q *Queries) FailPendingDeliveries(ctx context.Context, arg FailPendingDeliveriesParams) (int64, error)

func (*Queries) FinishLeasedDelivery

func (q *Queries) FinishLeasedDelivery(ctx context.Context, arg FinishLeasedDeliveryParams) (int64, error)

The end of an attempt, fenced by its lease: it applies only while holder still owns the lease row, expired or not, and the row is still at this attempt.

func (*Queries) GetAPIToken

func (q *Queries) GetAPIToken(ctx context.Context, id string) (ApiToken, error)

func (*Queries) GetConsumerByName

func (q *Queries) GetConsumerByName(ctx context.Context, name string) (Consumer, error)

func (*Queries) GetDelivery

func (q *Queries) GetDelivery(ctx context.Context, id string) (Delivery, error)

func (*Queries) GetEvent

func (q *Queries) GetEvent(ctx context.Context, id string) (Event, error)

func (*Queries) GetLatestEventBySubject

func (q *Queries) GetLatestEventBySubject(ctx context.Context, arg GetLatestEventBySubjectParams) (Event, error)

The expression, collation included, is the one of the event_watch_subject index (ADR 0018, ADR 0028 §7), so the lookup walks it.

func (*Queries) GetSecret

func (q *Queries) GetSecret(ctx context.Context, id string) (Secret, error)

func (*Queries) GetSecretByName

func (q *Queries) GetSecretByName(ctx context.Context, name string) (Secret, error)

func (*Queries) GetSink

func (q *Queries) GetSink(ctx context.Context, id string) (Sink, error)

func (*Queries) GetSinkByName

func (q *Queries) GetSinkByName(ctx context.Context, name sql.NullString) (Sink, error)

func (*Queries) GetSubscription

func (q *Queries) GetSubscription(ctx context.Context, id string) (Subscription, error)

func (*Queries) GetSubscriptionByName

func (q *Queries) GetSubscriptionByName(ctx context.Context, name sql.NullString) (Subscription, error)

func (*Queries) GetTarget

func (q *Queries) GetTarget(ctx context.Context, id string) (Target, error)

func (*Queries) GetTargetByCoordinates

func (q *Queries) GetTargetByCoordinates(ctx context.Context, arg GetTargetByCoordinatesParams) (Target, error)

func (*Queries) GetWatch

func (q *Queries) GetWatch(ctx context.Context, id string) (Watch, error)

func (*Queries) GetWatchByName

func (q *Queries) GetWatchByName(ctx context.Context, name sql.NullString) (Watch, error)

func (*Queries) HasEventsAfter

func (q *Queries) HasEventsAfter(ctx context.Context, seq int64) (bool, error)

func (*Queries) HasLeasableDueDeliveries

func (q *Queries) HasLeasableDueDeliveries(ctx context.Context, now int64) (bool, error)

func (*Queries) HasLeasableDueTargets

func (q *Queries) HasLeasableDueTargets(ctx context.Context, now int64) (bool, error)

func (*Queries) HighestPrunedSeq

func (q *Queries) HighestPrunedSeq(ctx context.Context) (int64, error)

Kept current by the event_prune_seq trigger.

func (*Queries) ListAPITokensPage

func (q *Queries) ListAPITokensPage(ctx context.Context, arg ListAPITokensPageParams) ([]ApiToken, error)

func (*Queries) ListActiveAPITokensPage

func (q *Queries) ListActiveAPITokensPage(ctx context.Context, arg ListActiveAPITokensPageParams) ([]ApiToken, error)

func (*Queries) ListConsumersPage

func (q *Queries) ListConsumersPage(ctx context.Context, arg ListConsumersPageParams) ([]Consumer, error)

func (*Queries) ListDeliveries

func (q *Queries) ListDeliveries(ctx context.Context, eventID string) ([]Delivery, error)

func (*Queries) ListDeliveriesPage

func (q *Queries) ListDeliveriesPage(ctx context.Context, arg ListDeliveriesPageParams) ([]ListDeliveriesPageRow, error)

Newest event first, then by delivery id. A subscription_ids_json of 'null' keeps every subscription.

func (*Queries) ListEventsAfter

func (q *Queries) ListEventsAfter(ctx context.Context, arg ListEventsAfterParams) ([]Event, error)

func (*Queries) ListHeldDeliveries

func (q *Queries) ListHeldDeliveries(ctx context.Context, arg ListHeldDeliveriesParams) ([]Delivery, error)

A held delivery is pending and held_until is still ahead.

func (*Queries) ListLeasableDueDeliveries

func (q *Queries) ListLeasableDueDeliveries(ctx context.Context, arg ListLeasableDueDeliveriesParams) ([]string, error)

Dispatcher (story #107, ADR 0017). The same three disjoint branches as on SQLite (story #232), each read in order from delivery_status_next_attempt_at_id, which is built NULLS FIRST.

func (*Queries) ListLeasableDueTargets

func (q *Queries) ListLeasableDueTargets(ctx context.Context, arg ListLeasableDueTargetsParams) ([]string, error)

Due targets that no unexpired lease covers ('target:' || id, see store.TargetLeaseName), oldest due first. #86 adds FOR UPDATE SKIP LOCKED; until then the lease lock serializes lease transactions (ADR 0028 §3).

func (*Queries) ListNamedSinksPage

func (q *Queries) ListNamedSinksPage(ctx context.Context, arg ListNamedSinksPageParams) ([]Sink, error)

func (*Queries) ListNamedSubscriptionsPage

func (q *Queries) ListNamedSubscriptionsPage(ctx context.Context, arg ListNamedSubscriptionsPageParams) ([]Subscription, error)

func (*Queries) ListNamedWatchesPage

func (q *Queries) ListNamedWatchesPage(ctx context.Context, arg ListNamedWatchesPageParams) ([]Watch, error)

REST API (story #71).

func (*Queries) ListPendingReleases

func (q *Queries) ListPendingReleases(ctx context.Context, targetID string) ([]ListPendingReleasesRow, error)

Rows of watches that moved to another target are left out.

func (*Queries) ListReplayCandidates

func (q *Queries) ListReplayCandidates(ctx context.Context, arg ListReplayCandidatesParams) ([]ListReplayCandidatesRow, error)

func (*Queries) ListSecrets

func (q *Queries) ListSecrets(ctx context.Context) ([]Secret, error)

func (*Queries) ListSinksManagedBy

func (q *Queries) ListSinksManagedBy(ctx context.Context, managedBy string) ([]Sink, error)

func (*Queries) ListSubscriptions

func (q *Queries) ListSubscriptions(ctx context.Context) ([]Subscription, error)

func (*Queries) ListSubscriptionsBySink

func (q *Queries) ListSubscriptionsBySink(ctx context.Context, sinkID string) ([]Subscription, error)

func (*Queries) ListSubscriptionsManagedBy

func (q *Queries) ListSubscriptionsManagedBy(ctx context.Context, managedBy string) ([]Subscription, error)

func (*Queries) ListTargetDemand

func (q *Queries) ListTargetDemand(ctx context.Context) ([]ListTargetDemandRow, error)

func (*Queries) ListTargetSources

func (q *Queries) ListTargetSources(ctx context.Context) ([]ListTargetSourcesRow, error)

func (*Queries) ListVersions

func (q *Queries) ListVersions(ctx context.Context, targetID string) ([]Version, error)

func (*Queries) ListWatchesByTarget

func (q *Queries) ListWatchesByTarget(ctx context.Context, targetID string) ([]Watch, error)

A check reads its watches FOR SHARE (ADR 0028 §2): a config transaction that updates or deletes one of them waits until the check commits. Config transactions must update a watch before deleting its held versions.

func (*Queries) ListWatchesManagedBy

func (q *Queries) ListWatchesManagedBy(ctx context.Context, managedBy string) ([]Watch, error)

NULLS FIRST: SQLite sorts NULL names first, Postgres last by default.

func (*Queries) MarkBaselineDone

func (q *Queries) MarkBaselineDone(ctx context.Context, id string) (int64, error)

func (*Queries) MaxEventSeq

func (q *Queries) MaxEventSeq(ctx context.Context) (int64, error)

func (*Queries) PruneBatchEnd

func (q *Queries) PruneBatchEnd(ctx context.Context, arg PruneBatchEndParams) ([]int64, error)

There is no index on event.created_at, so this scans by seq from after_seq and stops at batch matches. That is fine for a periodic job, not for a hot path.

func (*Queries) PruneDeliveries

func (q *Queries) PruneDeliveries(ctx context.Context, arg PruneDeliveriesParams) (int64, error)

func (*Queries) PruneEvents

func (q *Queries) PruneEvents(ctx context.Context, arg PruneEventsParams) (int64, error)

func (*Queries) ReleaseHeldDelivery

func (q *Queries) ReleaseHeldDelivery(ctx context.Context, arg ReleaseHeldDeliveryParams) (int64, error)

The held queries only touch a delivery that is still held at now.

func (*Queries) ReleaseLease

func (q *Queries) ReleaseLease(ctx context.Context, arg ReleaseLeaseParams) error

func (*Queries) ReplayDelivery

func (q *Queries) ReplayDelivery(ctx context.Context, arg ReplayDeliveryParams) (int64, error)

func (*Queries) RescheduleHeldDelivery

func (q *Queries) RescheduleHeldDelivery(ctx context.Context, arg RescheduleHeldDeliveryParams) (int64, error)

func (*Queries) ResetWatchBaseline

func (q *Queries) ResetWatchBaseline(ctx context.Context, id string) (int64, error)

func (*Queries) RevokeAPIToken

func (q *Queries) RevokeAPIToken(ctx context.Context, arg RevokeAPITokenParams) (int64, error)

func (*Queries) SetTargetInterval

func (q *Queries) SetTargetInterval(ctx context.Context, arg SetTargetIntervalParams) (int64, error)

func (*Queries) StartDeliveryAttempt

func (q *Queries) StartDeliveryAttempt(ctx context.Context, arg StartDeliveryAttemptParams) (Delivery, error)

Every lease of a delivery counts as an attempt, so an attempt cut short by a crash counts too. Unlike SQLite's, the update repeats the due predicate of ListLeasableDueDeliveries (ADR 0028 §3): writers that take no lease lock (FailPendingDeliveries, FailHeldDelivery, CancelHeldDeliveries) may have changed or deleted the row since it was selected; then no row comes back and the caller skips it. The holder's own new lease does not count.

func (*Queries) SubscriptionGeneration

func (q *Queries) SubscriptionGeneration(ctx context.Context) (int64, error)

func (*Queries) TargetExists

func (q *Queries) TargetExists(ctx context.Context, id string) (bool, error)

func (*Queries) TouchAPIToken

func (q *Queries) TouchAPIToken(ctx context.Context, arg TouchAPITokenParams) error

last_used_at only moves forward; the UPDATE re-reads the newest row version under READ COMMITTED, so concurrent touches never move it back.

func (*Queries) UpdateConsumerFilter

func (q *Queries) UpdateConsumerFilter(ctx context.Context, arg UpdateConsumerFilterParams) (int64, error)

func (*Queries) UpdateSecret

func (q *Queries) UpdateSecret(ctx context.Context, arg UpdateSecretParams) (int64, error)

Fenced by the row's revision (ADR 0024 section 5). Under READ COMMITTED a concurrent update of the row makes Postgres re-check the WHERE on the newest version, so one of two writers at the same revision wins.

func (*Queries) UpdateSink

func (q *Queries) UpdateSink(ctx context.Context, arg UpdateSinkParams) (int64, error)

func (*Queries) UpdateSubscription

func (q *Queries) UpdateSubscription(ctx context.Context, arg UpdateSubscriptionParams) (int64, error)

func (*Queries) UpdateTargetState

func (q *Queries) UpdateTargetState(ctx context.Context, arg UpdateTargetStateParams) (int64, error)

func (*Queries) UpdateTargetStateLeased

func (q *Queries) UpdateTargetStateLeased(ctx context.Context, arg UpdateTargetStateLeasedParams) (int64, error)

The target write of a check, fenced by its lease: it only applies while holder still owns an unexpired lease named lease_name.

func (*Queries) UpdateVersionState

func (q *Queries) UpdateVersionState(ctx context.Context, arg UpdateVersionStateParams) (int64, error)

func (*Queries) UpdateWatchConfig

func (q *Queries) UpdateWatchConfig(ctx context.Context, arg UpdateWatchConfigParams) (int64, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

type Reader

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

Reader reads stored secrets and target sources over connections that are read-only (default_transaction_read_only). It never creates a schema, a table or a migration record, and never runs the migrations, so `angelia config check`, `secrets status` and the start-up checks leave a database as they found it, whatever the DSN. It implements store.SecretReader on the tables that exist: a database Angelia has not reached reads as empty. Close it after use.

func OpenReader

func OpenReader(ctx context.Context, dsn string) (*Reader, error)

OpenReader connects to the database named by dsn (same syntax and parameters as Open) for reading only. It returns ErrNoDatabase when the database does not exist; any other failure is an error that never holds the password.

func (*Reader) Close

func (r *Reader) Close() error

Close closes the connections.

func (*Reader) CountSecretsByKeyID

func (r *Reader) CountSecretsByKeyID(ctx context.Context) (map[string]int64, error)

CountSecretsByKeyID implements store.SecretReader.

func (*Reader) Initialized

func (r *Reader) Initialized(ctx context.Context) (bool, error)

Initialized reports whether Angelia has created its tables here, which is what the instance-side commands need before they open the store.

func (*Reader) ListSecrets

func (r *Reader) ListSecrets(ctx context.Context) ([]store.Secret, error)

ListSecrets implements store.SecretReader.

func (*Reader) SecretByName

func (r *Reader) SecretByName(ctx context.Context, name string) (store.Secret, error)

SecretByName implements store.SecretReader; store.ErrNotFound without the secret table.

func (*Reader) TargetSources

func (r *Reader) TargetSources(ctx context.Context) ([]store.TargetSource, error)

TargetSources lists the sources the stored targets use; none without the target table.

type ReleaseHeldDeliveryParams

type ReleaseHeldDeliveryParams struct {
	Now sql.NullInt64
	ID  string
}

type ReleaseLeaseParams

type ReleaseLeaseParams struct {
	Name   string
	Holder string
}

type ReplayDeliveryParams

type ReplayDeliveryParams struct {
	Now sql.NullInt64
	ID  string
}

type RescheduleHeldDeliveryParams

type RescheduleHeldDeliveryParams struct {
	Until sql.NullInt64
	ID    string
	Now   sql.NullInt64
}

type RevokeAPITokenParams

type RevokeAPITokenParams struct {
	RevokedAt int64
	RevokedBy string
	ID        string
}

type Secret

type Secret struct {
	ID         string
	Name       string
	HostsJson  string
	KeyID      string
	Ciphertext []byte
	Revision   int64
	CreatedAt  int64
	UpdatedAt  int64
}

type SetTargetIntervalParams

type SetTargetIntervalParams struct {
	IntervalMs  sql.NullInt64
	NextCheckAt int64
	ID          string
}

type Sink

type Sink struct {
	ID         string
	Kind       string
	ConfigJson []byte
	Name       sql.NullString
	ManagedBy  string
}

type StartDeliveryAttemptParams

type StartDeliveryAttemptParams struct {
	ID     string
	Now    int64
	Holder string
}

type Store

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

Store is the Postgres engine. It is safe for concurrent use.

Transactions run at READ COMMITTED. Config, API and secret transactions (and the Store methods that write config rows) take the config lock as their first statement; lease transactions take the lease lock as theirs; a check transaction takes the event lock before each event insert, so event.seq is in commit order (ADR 0028 §1-§4).

func Open

func Open(ctx context.Context, dsn string, logger *slog.Logger) (*Store, error)

Open connects to the Postgres database named by dsn (a postgres:// URL or keyword/value pairs; the schema is the first existing one of its search_path) and migrates it to the latest schema version. The pool size is the DSN parameter pool_max_conns, which is removed before the DSN reaches the server (default: max(4, number of CPUs), like pgxpool). Neither the logs nor the errors ever hold the DSN. A nil logger means slog.Default.

func OpenExisting

func OpenExisting(ctx context.Context, dsn string) (*Store, error)

OpenExisting connects to the database named by dsn (same syntax and parameters as Open) for reading and writing, but never creates a schema and never migrates: the store-only opener of `angelia token create --local` (ADR 0030 T7). The caller checks Store.SchemaVersion before it writes. ErrNoDatabase when the database does not exist; any other failure is an error that never holds the password.

func (*Store) APITokenByID

func (s *Store) APITokenByID(ctx context.Context, id string) (store.APIToken, error)

APITokenByID implements store.TokenReader.

func (*Store) AcquireLease

func (s *Store) AcquireLease(ctx context.Context, name, holder string, now, until time.Time) (bool, error)

AcquireLease implements store.Store, under the lease lock.

func (*Store) AddPendingRelease

func (s *Store) AddPendingRelease(ctx context.Context, p store.PendingRelease) error

AddPendingRelease implements store.Tx in its own statement.

func (*Store) AddVersion

func (s *Store) AddVersion(ctx context.Context, v store.Version) (bool, error)

AddVersion implements store.Tx in its own statement.

func (*Store) AppendEvent

func (s *Store) AppendEvent(ctx context.Context, e store.Event, ds []store.Delivery) error

AppendEvent implements store.Tx in its own transaction, under the event lock.

func (*Store) CancelHeldDeliveries

func (s *Store) CancelHeldDeliveries(ctx context.Context, eventID string, now time.Time) (int64, error)

CancelHeldDeliveries implements store.Tx in its own statement.

func (*Store) Close

func (s *Store) Close() error

Close closes the database.

func (*Store) ConsumerByName

func (s *Store) ConsumerByName(ctx context.Context, name string) (store.Consumer, error)

ConsumerByName implements store.APIReader.

func (*Store) CountAPITokens

func (s *Store) CountAPITokens(ctx context.Context) (int64, error)

CountAPITokens implements store.TokenReader.

func (*Store) CountActiveAdminTokens

func (s *Store) CountActiveAdminTokens(ctx context.Context, now time.Time) (int64, error)

CountActiveAdminTokens implements store.TokenReader.

func (*Store) CountDeliveriesByStatus

func (s *Store) CountDeliveriesByStatus(ctx context.Context) (map[string]int64, error)

CountDeliveriesByStatus implements store.Store.

func (*Store) CountDueTargets

func (s *Store) CountDueTargets(ctx context.Context, now time.Time) (int64, error)

CountDueTargets implements store.Store.

func (*Store) CountSecretsByKeyID

func (s *Store) CountSecretsByKeyID(ctx context.Context) (map[string]int64, error)

CountSecretsByKeyID implements store.SecretReader.

func (*Store) CreateAPIToken

func (s *Store) CreateAPIToken(ctx context.Context, t store.APIToken) error

CreateAPIToken implements store.TokenStore.

func (*Store) CreateSink

func (s *Store) CreateSink(ctx context.Context, k store.Sink) error

CreateSink implements store.Store.

func (*Store) CreateSubscription

func (s *Store) CreateSubscription(ctx context.Context, sub store.Subscription) error

CreateSubscription implements store.Store.

func (*Store) CreateTarget

func (s *Store) CreateTarget(ctx context.Context, t store.Target) error

CreateTarget implements store.Store.

func (*Store) CreateWatch

func (s *Store) CreateWatch(ctx context.Context, w store.Watch) error

CreateWatch implements store.Store.

func (*Store) DeleteExpiredTargetLeases

func (s *Store) DeleteExpiredTargetLeases(ctx context.Context, now time.Time) (int64, error)

DeleteExpiredTargetLeases implements store.Store, under the lease lock.

func (*Store) DeletePendingRelease

func (s *Store) DeletePendingRelease(ctx context.Context, watchID, targetID, raw string) error

DeletePendingRelease implements store.Tx in its own statement.

func (*Store) DeletePendingReleasesOfWatch

func (s *Store) DeletePendingReleasesOfWatch(ctx context.Context, watchID string) (int64, error)

DeletePendingReleasesOfWatch implements store.Tx in its own statement.

func (*Store) DeleteSink

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

DeleteSink implements store.Store.

func (*Store) DeleteSubscription

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

DeleteSubscription implements store.Store.

func (*Store) DeleteWatch

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

DeleteWatch implements store.Store.

func (*Store) FinishDelivery

func (s *Store) FinishDelivery(ctx context.Context, f store.DeliveryFinish, holder string) (bool, error)

FinishDelivery implements store.Store, under the lease lock.

func (*Store) GetDelivery

func (s *Store) GetDelivery(ctx context.Context, id string) (store.Delivery, error)

GetDelivery implements store.APIReader.

func (*Store) GetEvent

func (s *Store) GetEvent(ctx context.Context, id string) (store.Event, error)

GetEvent implements store.APIReader.

func (*Store) GetLatestEventBySubject

func (s *Store) GetLatestEventBySubject(ctx context.Context, watchID, subject string, types ...string) (store.Event, error)

GetLatestEventBySubject implements store.Tx outside a transaction.

func (*Store) GetSink

func (s *Store) GetSink(ctx context.Context, id string) (store.Sink, error)

GetSink implements store.APIReader.

func (*Store) GetSubscription

func (s *Store) GetSubscription(ctx context.Context, id string) (store.Subscription, error)

GetSubscription implements store.APIReader.

func (*Store) GetTarget

func (s *Store) GetTarget(ctx context.Context, id string) (store.Target, error)

GetTarget implements store.Store.

func (*Store) GetWatch

func (s *Store) GetWatch(ctx context.Context, id string) (store.Watch, error)

GetWatch implements store.Store.

func (*Store) HasDueDeliveries

func (s *Store) HasDueDeliveries(ctx context.Context, now time.Time) (bool, error)

HasDueDeliveries implements store.Store with a read only.

func (*Store) HasDueTargets

func (s *Store) HasDueTargets(ctx context.Context, now time.Time) (bool, error)

HasDueTargets implements store.Store with a read only.

func (*Store) HasEventsAfter

func (s *Store) HasEventsAfter(ctx context.Context, seq int64) (bool, error)

HasEventsAfter implements store.APIReader.

func (*Store) HighestPrunedSeq

func (s *Store) HighestPrunedSeq(ctx context.Context) (int64, error)

HighestPrunedSeq implements store.Store.

func (*Store) InAPITx

func (s *Store) InAPITx(ctx context.Context, fn func(tx store.APITx) error) error

InAPITx implements store.APIStore, under the config lock.

func (*Store) InConfigTx

func (s *Store) InConfigTx(ctx context.Context, fn func(tx store.ConfigTx) error) error

InConfigTx implements store.Store. The transaction takes the config lock first, so config, API and secret writes serialize as on SQLite (ADR 0028 §2).

func (*Store) InSecretTx

func (s *Store) InSecretTx(ctx context.Context, fn func(tx store.SecretTx) error) error

InSecretTx implements store.SecretStore. The transaction takes the config lock first, so no other config, API or secret write interleaves with a rotation batch (ADR 0028 §2); UpdateSecret keeps its revision fence too.

func (*Store) InTx

func (s *Store) InTx(ctx context.Context, fn func(tx store.Tx) error) error

InTx implements store.Store. A check transaction takes no lock at BEGIN: AppendEvent takes the event lock before each insert.

func (*Store) LeaseDueDeliveries

func (s *Store) LeaseDueDeliveries(ctx context.Context, holder string, now, until time.Time, limit int) ([]store.LeasedDelivery, error)

LeaseDueDeliveries implements store.Store under the lease lock (ADR 0028 §3). Writers that take no lease lock (FailPendingDeliveries, FailHeldDelivery, CancelHeldDeliveries) can change or delete a selected row before it is set in flight: StartDeliveryAttempt re-checks the due predicate, and a row that no longer matches is skipped and its new lease dropped, instead of being revived or failing the batch.

func (*Store) LeaseDueTargets

func (s *Store) LeaseDueTargets(ctx context.Context, holder string, now, until time.Time, limit int) ([]store.Target, error)

LeaseDueTargets implements store.Store. It runs under the lease lock, so lease transactions of every process exclude each other (ADR 0028 §3). Each target is read back after its lease is written: one deleted since the select (DeleteTargetIfUnused takes no lease lock) is skipped and its new lease dropped.

func (*Store) ListAPITokens

func (s *Store) ListAPITokens(ctx context.Context, afterID string, limit int, includeRevoked bool) ([]store.APIToken, error)

ListAPITokens implements store.TokenReader.

func (*Store) ListConsumers

func (s *Store) ListConsumers(ctx context.Context, afterName, afterID string, limit int) ([]store.Consumer, error)

ListConsumers implements store.APIReader.

func (*Store) ListDeliveries

func (s *Store) ListDeliveries(ctx context.Context, eventID string) ([]store.Delivery, error)

ListDeliveries implements store.Store.

func (*Store) ListDeliveryPage

func (s *Store) ListDeliveryPage(ctx context.Context, q store.DeliveryQuery) ([]store.DeliveryRow, error)

ListDeliveryPage implements store.APIReader.

func (*Store) ListEventsAfter

func (s *Store) ListEventsAfter(ctx context.Context, afterSeq int64, limit int) ([]store.Event, error)

ListEventsAfter implements store.Store: one statement, so one snapshot. Event inserts hold the event lock until they commit, so the events it sees above the cursor are a prefix of what will ever commit there (ADR 0028 §1).

func (*Store) ListNamedSinks

func (s *Store) ListNamedSinks(ctx context.Context, afterName, afterID string, limit int) ([]store.Sink, error)

ListNamedSinks implements store.APIReader.

func (*Store) ListNamedSubscriptions

func (s *Store) ListNamedSubscriptions(ctx context.Context, afterName, afterID string, limit int) ([]store.Subscription, error)

ListNamedSubscriptions implements store.APIReader.

func (*Store) ListNamedWatches

func (s *Store) ListNamedWatches(ctx context.Context, afterName, afterID string, limit int) ([]store.Watch, error)

ListNamedWatches implements store.APIReader.

func (*Store) ListPendingReleases

func (s *Store) ListPendingReleases(ctx context.Context, targetID string) ([]store.PendingRelease, error)

ListPendingReleases implements store.Tx outside a transaction.

func (*Store) ListSecrets

func (s *Store) ListSecrets(ctx context.Context) ([]store.Secret, error)

ListSecrets implements store.SecretReader.

func (*Store) ListSubscriptions

func (s *Store) ListSubscriptions(ctx context.Context) ([]store.Subscription, error)

ListSubscriptions implements store.Tx outside a transaction.

func (*Store) ListVersions

func (s *Store) ListVersions(ctx context.Context, targetID string) ([]store.Version, error)

ListVersions implements store.Tx outside a transaction.

func (*Store) ListWatches

func (s *Store) ListWatches(ctx context.Context, targetID string) ([]store.Watch, error)

ListWatches implements store.Tx outside a transaction (its share locks end with the statement).

func (*Store) MarkBaselineDone

func (s *Store) MarkBaselineDone(ctx context.Context, watchID string) error

MarkBaselineDone implements store.Tx in its own statement.

func (*Store) MaxEventSeq

func (s *Store) MaxEventSeq(ctx context.Context) (int64, error)

MaxEventSeq implements store.APIReader.

func (*Store) PruneHistory

func (s *Store) PruneHistory(ctx context.Context, before time.Time, batch int) (store.PruneResult, error)

PruneHistory implements store.Store like the SQLite engine: batches of events in seq order, each one transaction that deletes the terminal deliveries of its events, then the events left without deliveries. It takes no advisory lock; the event_prune_seq trigger updates one row, so two prunes queue on it (ADR 0028 §2).

func (*Store) ReleaseLease

func (s *Store) ReleaseLease(ctx context.Context, name, holder string) error

ReleaseLease implements store.Store, under the lease lock.

func (*Store) RevokeAPIToken

func (s *Store) RevokeAPIToken(ctx context.Context, id string, at time.Time, by string) (bool, error)

RevokeAPIToken implements store.TokenStore.

func (*Store) SchemaVersion

func (s *Store) SchemaVersion(ctx context.Context) (int64, error)

SchemaVersion returns the highest applied migration version of the current schema, 0 when it holds no migration record (Angelia never migrated it).

func (*Store) SecretByName

func (s *Store) SecretByName(ctx context.Context, name string) (store.Secret, error)

SecretByName implements store.SecretReader.

func (*Store) SinkByName

func (s *Store) SinkByName(ctx context.Context, name string) (store.Sink, error)

SinkByName implements store.APIReader.

func (*Store) SubscriptionByName

func (s *Store) SubscriptionByName(ctx context.Context, name string) (store.Subscription, error)

SubscriptionByName implements store.APIReader.

func (*Store) SubscriptionGeneration

func (s *Store) SubscriptionGeneration(ctx context.Context) (int64, error)

SubscriptionGeneration implements store.Tx outside a transaction.

func (*Store) SubscriptionsBySink

func (s *Store) SubscriptionsBySink(ctx context.Context, sinkID string) ([]store.Subscription, error)

SubscriptionsBySink implements store.APIReader.

func (*Store) TargetDemand

func (s *Store) TargetDemand(ctx context.Context) ([]store.TargetDemand, error)

TargetDemand groups the stored targets by source name and check interval, for the per-host request demand estimate of the scheduler (story #220).

func (*Store) TargetSources

func (s *Store) TargetSources(ctx context.Context) ([]store.TargetSource, error)

TargetSources lists the distinct sources the stored targets use, with how many targets each has, for `config check` and the start-up check of the configured source names (story #205). Like the SQLite engine's method of the same name, it is not part of store.Store.

func (*Store) TouchAPITokens

func (s *Store) TouchAPITokens(ctx context.Context, used map[string]time.Time) error

TouchAPITokens implements store.TokenStore: one UPDATE per id, in id order.

func (*Store) UpdateTarget

func (s *Store) UpdateTarget(ctx context.Context, t store.Target) error

UpdateTarget implements store.Tx in its own statement.

func (*Store) UpdateTargetLeased

func (s *Store) UpdateTargetLeased(ctx context.Context, t store.Target, leaseName, holder string, now time.Time) (bool, error)

UpdateTargetLeased implements store.Store, under the lease lock.

func (*Store) UpdateVersion

func (s *Store) UpdateVersion(ctx context.Context, v store.Version) error

UpdateVersion implements store.Tx in its own statement.

func (*Store) WatchByName

func (s *Store) WatchByName(ctx context.Context, name string) (store.Watch, error)

WatchByName implements store.APIReader.

type Subscription

type Subscription struct {
	ID         string
	FilterJson string
	SinkID     string
	Template   string
	Name       sql.NullString
	ManagedBy  string
	PolicyJson string
}

type SubscriptionGeneration

type SubscriptionGeneration struct {
	ID         int64
	Generation int64
}

type Target

type Target struct {
	ID              string
	Kind            string
	CoordinatesJson string
	FetchStateJson  string
	LastCheckedAt   sql.NullInt64
	NextCheckAt     int64
	ErrorCount      int64
	IntervalMs      sql.NullInt64
	SourceKind      sql.NullString
}

type TouchAPITokenParams

type TouchAPITokenParams struct {
	UsedAt int64
	ID     string
}

type UpdateConsumerFilterParams

type UpdateConsumerFilterParams struct {
	FilterJson string
	UpdatedAt  int64
	ID         string
}

type UpdateSecretParams

type UpdateSecretParams struct {
	HostsJson  string
	KeyID      string
	Ciphertext []byte
	UpdatedAt  int64
	ID         string
	Revision   int64
}

type UpdateSinkParams

type UpdateSinkParams struct {
	Kind       string
	ConfigJson []byte
	ID         string
}

type UpdateSubscriptionParams

type UpdateSubscriptionParams struct {
	FilterJson string
	SinkID     string
	Template   string
	PolicyJson string
	ID         string
}

type UpdateTargetStateLeasedParams

type UpdateTargetStateLeasedParams struct {
	FetchStateJson string
	LastCheckedAt  sql.NullInt64
	NextCheckAt    int64
	ErrorCount     int64
	ID             string
	LeaseName      string
	Holder         string
	Now            int64
}

type UpdateTargetStateParams

type UpdateTargetStateParams struct {
	FetchStateJson string
	LastCheckedAt  sql.NullInt64
	NextCheckAt    int64
	ErrorCount     int64
	ID             string
}

type UpdateVersionStateParams

type UpdateVersionStateParams struct {
	Yanked    bool
	RemovedAt sql.NullInt64
	TargetID  string
	Raw       string
}

type UpdateWatchConfigParams

type UpdateWatchConfigParams struct {
	TargetID   string
	PolicyJson string
	LabelsJson string
	IntervalMs sql.NullInt64
	ID         string
}

type Version

type Version struct {
	TargetID    string
	Raw         string
	Normalized  string
	PublishedAt sql.NullInt64
	Prerelease  bool
	Yanked      bool
	FirstSeenAt int64
	RemovedAt   sql.NullInt64
}

type Watch

type Watch struct {
	ID           string
	TargetID     string
	PolicyJson   string
	LabelsJson   string
	BaselineDone bool
	Name         sql.NullString
	ManagedBy    string
	IntervalMs   sql.NullInt64
}

Jump to

Keyboard shortcuts

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