sqlcgen

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiToken

type ApiToken struct {
	ID          uuid.UUID
	TokenHash   string
	Role        string
	ProjectIds  []uuid.UUID
	Description pgtype.Text
	CreatedAt   pgtype.Timestamptz
	RevokedAt   pgtype.Timestamptz
}

type AuditLog

type AuditLog struct {
	ID         int64
	At         pgtype.Timestamptz
	Actor      string
	Action     string
	ObjectType pgtype.Text
	ObjectID   pgtype.Text
	Details    []byte
}

type CloseProjectRelationParams

type CloseProjectRelationParams struct {
	ID       uuid.UUID
	SourceID uuid.UUID
}

type CompleteSyncRunParams

type CompleteSyncRunParams struct {
	ID     uuid.UUID
	Status string
	Stats  []byte
}

type CountCurrentResourcesGroupedParams

type CountCurrentResourcesGroupedParams struct {
	Deleted       pgtype.Bool
	ScopeClouds   []string
	ScopeProjects []string
	RowCap        int32
}

type CountCurrentResourcesGroupedRow

type CountCurrentResourcesGroupedRow struct {
	Cloud        string
	Platform     string
	ResourceType string
	State        string
	ProjectID    string
	Resources    int64
}

type CountCurrentResourcesRow

type CountCurrentResourcesRow struct {
	Platform     string
	Cloud        string
	ResourceType string
	State        string
	Resources    int64
}

type CountEventBucketsParams

type CountEventBucketsParams struct {
	BucketWidth   string
	FromTs        pgtype.Timestamptz
	ToTs          pgtype.Timestamptz
	ScopeClouds   []string
	ScopeProjects []string
	RowCap        int32
}

type CountEventBucketsRow

type CountEventBucketsRow struct {
	Bucket    pgtype.Timestamptz
	Cloud     string
	EventType string
	Source    string
	Events    int64
}

type CountEventsForResourceParams

type CountEventsForResourceParams struct {
	Cloud         string
	ResourceType  string
	ResourceID    string
	ScopeClouds   []string
	ScopeProjects []string
	ProbeLimit    int32
}

type CountProjectFoldEventsParams

type CountProjectFoldEventsParams struct {
	Cloud      string
	ProjectID  string
	ToTs       pgtype.Timestamptz
	ProbeLimit int32
}

type CountProjectResourcesByTypeParams

type CountProjectResourcesByTypeParams struct {
	Cloud     string
	ProjectID string
}

type CountProjectResourcesByTypeRow

type CountProjectResourcesByTypeRow struct {
	ResourceType string
	Resources    int64
}

type CreateAPITokenParams

type CreateAPITokenParams struct {
	TokenHash   string
	Role        string
	ProjectIds  []uuid.UUID
	Description pgtype.Text
}

type CreateIngestCredentialParams

type CreateIngestCredentialParams struct {
	Platform    string
	Cloud       string
	TokenHash   string
	Description pgtype.Text
}

type CurrentResource

type CurrentResource struct {
	Cloud         string
	Platform      string
	ResourceType  string
	ResourceID    string
	ProjectID     string
	State         string
	Size          []byte
	CreatedAt     pgtype.Timestamptz
	DeletedAt     pgtype.Timestamptz
	LastEventType string
	LastEventAt   pgtype.Timestamptz
	LastPayload   []byte
	FirstEventAt  pgtype.Timestamptz
}

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
}

type Event

type Event struct {
	EventID      string
	Timestamp    pgtype.Timestamptz
	ReceivedAt   pgtype.Timestamptz
	EventType    string
	Platform     string
	Cloud        string
	ResourceType string
	ResourceID   string
	ProjectID    string
	Source       string
	Payload      []byte
}

type GetCurrentResourceForUpdateParams

type GetCurrentResourceForUpdateParams struct {
	Cloud        string
	ResourceType string
	ResourceID   string
}

type GetCurrentResourceParams

type GetCurrentResourceParams struct {
	Cloud        string
	ResourceType string
	ResourceID   string
}

type GetProjectRefsByIDsRow

type GetProjectRefsByIDsRow struct {
	ID         uuid.UUID
	Cloud      string
	ExternalID string
}

type GetProjectRelationParams

type GetProjectRelationParams struct {
	ID       uuid.UUID
	SourceID uuid.UUID
}

type GetResourceTypeParams

type GetResourceTypeParams struct {
	Platform     string
	ResourceType string
}

type IngestCredential

type IngestCredential struct {
	ID          uuid.UUID
	Platform    string
	Cloud       string
	TokenHash   string
	Description pgtype.Text
	CreatedAt   pgtype.Timestamptz
	RevokedAt   pgtype.Timestamptz
}

type InsertAuditLogParams

type InsertAuditLogParams struct {
	Actor      string
	Action     string
	ObjectType pgtype.Text
	ObjectID   pgtype.Text
	Details    []byte
}

type InsertEventParams

type InsertEventParams struct {
	EventID      string
	Timestamp    pgtype.Timestamptz
	EventType    string
	Platform     string
	Cloud        string
	ResourceType string
	ResourceID   string
	ProjectID    string
	Source       string
	Payload      []byte
}

type InsertProjectParams

type InsertProjectParams struct {
	Platform   string
	Cloud      string
	ExternalID string
	Name       pgtype.Text
	Metadata   []byte
}

type InsertProjectRelationParams

type InsertProjectRelationParams struct {
	SourceID     uuid.UUID
	TargetID     uuid.UUID
	RelationType string
	Metadata     []byte
	ValidFrom    pgtype.Timestamptz
}

type InsertRejectedEventParams

type InsertRejectedEventParams struct {
	Reason string
	Raw    []byte
}

type InsertSizeNameParams added in v0.5.0

type InsertSizeNameParams struct {
	Cloud        string
	ResourceType string
	Member       string
	Value        string
	Name         string
}

type InsertSyncRunParams

type InsertSyncRunParams struct {
	Cloud     string
	StartedAt pgtype.Timestamptz
}

type ListActiveAttributingRelationsParams

type ListActiveAttributingRelationsParams struct {
	SourceIds     []uuid.UUID
	RelationTypes []string
}

type ListCurrentResourcesByCloudRow

type ListCurrentResourcesByCloudRow struct {
	ResourceType string
	ResourceID   string
	ProjectID    string
	State        string
	Size         []byte
	LastEventAt  pgtype.Timestamptz
}

type ListCurrentResourcesParams

type ListCurrentResourcesParams struct {
	Cloud              pgtype.Text
	Platform           pgtype.Text
	ProjectID          pgtype.Text
	ResourceType       pgtype.Text
	State              pgtype.Text
	Deleted            pgtype.Bool
	ScopeClouds        []string
	ScopeProjects      []string
	CursorCloud        pgtype.Text
	CursorResourceType pgtype.Text
	CursorResourceID   pgtype.Text
	PageSize           int32
}

type ListEventsForResourceParams

type ListEventsForResourceParams struct {
	Cloud         string
	ResourceType  string
	ResourceID    string
	ScopeClouds   []string
	ScopeProjects []string
	PageSize      pgtype.Int4
}

type ListEventsParams

type ListEventsParams struct {
	Cloud         pgtype.Text
	Platform      pgtype.Text
	ProjectID     pgtype.Text
	ResourceType  pgtype.Text
	EventType     pgtype.Text
	Source        pgtype.Text
	FromTs        pgtype.Timestamptz
	ToTs          pgtype.Timestamptz
	ScopeClouds   []string
	ScopeProjects []string
	CursorTs      pgtype.Timestamptz
	CursorEventID pgtype.Text
	PageSize      int32
}

type ListProjectFoldEventsParams

type ListProjectFoldEventsParams struct {
	Cloud     string
	ProjectID string
	ToTs      pgtype.Timestamptz
	PageSize  int32
}

type ListProjectFoldEventsRow

type ListProjectFoldEventsRow struct {
	EventID      string
	Timestamp    pgtype.Timestamptz
	ReceivedAt   pgtype.Timestamptz
	EventType    string
	Platform     string
	Cloud        string
	ResourceType string
	ResourceID   string
	ProjectID    string
	Source       string
}

type ListProjectRelationsParams

type ListProjectRelationsParams struct {
	Outgoing     bool
	ProjectID    uuid.UUID
	Incoming     bool
	At           pgtype.Timestamptz
	RelationType pgtype.Text
}

type ListProjectsParams

type ListProjectsParams struct {
	Platform         pgtype.Text
	Cloud            pgtype.Text
	ExternalID       pgtype.Text
	CursorCloud      pgtype.Text
	CursorExternalID pgtype.Text
	PageSize         int32
}

type ListRejectedEventsParams

type ListRejectedEventsParams struct {
	FromTs   pgtype.Timestamptz
	ToTs     pgtype.Timestamptz
	CursorTs pgtype.Timestamptz
	CursorID pgtype.UUID
	PageSize int32
}

type ListRelationsValidAtParams

type ListRelationsValidAtParams struct {
	SourceIds    []uuid.UUID
	At           pgtype.Timestamptz
	RelationType pgtype.Text
}

type ListResourceKeysParams

type ListResourceKeysParams struct {
	Cloud        pgtype.Text
	ResourceType pgtype.Text
}

type ListResourceKeysRow

type ListResourceKeysRow struct {
	Cloud        string
	ResourceType string
	ResourceID   string
}

type ListSizeNamesParams added in v0.5.0

type ListSizeNamesParams struct {
	Cloud        string
	ResourceType string
}

type ListSizeNamesRow added in v0.5.0

type ListSizeNamesRow struct {
	Member string
	Value  string
	Name   string
}

type LockResourceParams

type LockResourceParams struct {
	Column1 string
	Column2 string
	Column3 string
}

type Project

type Project struct {
	ID         uuid.UUID
	Platform   string
	Cloud      string
	ExternalID string
	Name       pgtype.Text
	Metadata   []byte
	CreatedAt  pgtype.Timestamptz
}

type ProjectRelation

type ProjectRelation struct {
	ID           uuid.UUID
	SourceID     uuid.UUID
	TargetID     uuid.UUID
	RelationType string
	Metadata     []byte
	ValidFrom    pgtype.Timestamptz
	ValidTo      pgtype.Timestamptz
	CreatedAt    pgtype.Timestamptz
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CloseProjectRelation

func (q *Queries) CloseProjectRelation(ctx context.Context, arg CloseProjectRelationParams) (int64, error)

A relation is closed rather than deleted, so that a read at an earlier instant still finds it. The row count tells the close apart from the relation that was closed already, which no longer matches.

func (*Queries) CompleteSyncRun

func (q *Queries) CompleteSyncRun(ctx context.Context, arg CompleteSyncRunParams) error

func (*Queries) CountCurrentResources

func (q *Queries) CountCurrentResources(ctx context.Context) ([]CountCurrentResourcesRow, error)

The fleet the projection holds, grouped the way tally_current_resources is labeled. The gauge is derived from this count rather than from the events as they are folded, so it cannot drift from the rows the API serves. Deleted resources keep their row and are counted under state 'deleted'.

func (*Queries) CountCurrentResourcesGrouped

func (q *Queries) CountCurrentResourcesGrouped(ctx context.Context, arg CountCurrentResourcesGroupedParams) ([]CountCurrentResourcesGroupedRow, error)

The projection counted along all five dimensions the resource statistics can group by. The route takes any non-empty combination of them, which is thirty-one groupings and would be thirty-one static queries. A coarser grouping is the sum of these rows over the dimensions it drops, so this one query answers every combination and the handler adds the rows up in Go.

The status filter and the scope pair are the ones ListCurrentResources runs, so the counts cover the rows the list serves and nothing else.

row_cap bounds what one request materializes. Four of the five dimensions are low-cardinality, but project_id is one value per tenant, so the row set grows with the fleet's tenants rather than with the shapes it shows, and the answer is not paginated.

func (*Queries) CountEventBuckets

func (q *Queries) CountEventBuckets(ctx context.Context, arg CountEventBucketsParams) ([]CountEventBucketsRow, error)

The event statistics route, as one row per bucket and group. The window is required and half-open, which is what keeps the read on the time dimension the hypertable is chunked by: a query without both bounds has every chunk there is to walk.

Both casts are there for sqlc rather than for Postgres. time_bucket is not in its catalog, so without ::timestamptz the bucket column comes out as an interface{} in the generated row; and the width reaches interval through text because a placeholder cast straight to interval generates a pgtype.Interval, where the width the route carries is a string.

row_cap bounds what one request materializes: the number of buckets grows with the window divided by the width, and each bucket carries a row per cloud, event type and source seen in it.

func (*Queries) CountEventsForResource

func (q *Queries) CountEventsForResource(ctx context.Context, arg CountEventsForResourceParams) (int64, error)

How long the history above is under the same scope, counted no further than probe_limit. The unpaginated per-resource routes ask this before they read anything, because the bound they enforce is a memory bound and the read above materializes every row it returns before the caller sees the first one: deciding the refusal off the rows themselves would cost exactly the payloads the refusal exists to avoid.

The answer saturates at probe_limit, and a caller reads it as "at least this many" rather than as the length of the history. A plain count(*) cannot stop early: it would answer the bounded question of whether the history is too long by walking every event the resource has, on exactly the request the bound exists to keep cheap, and this table has no ceiling on how many that is. The inner LIMIT is what stops the walk at the only rows the decision needs.

func (*Queries) CountProjectFoldEvents

func (q *Queries) CountProjectFoldEvents(ctx context.Context, arg CountProjectFoldEventsParams) (int64, error)

How many events one project summary folds, counted no further than probe_limit. The summary asks this before it runs the read below, and it counts that read's own row set rather than a narrower one: a project's own events say nothing about how long the histories they pull in are, because a resource it holds a single event of carries the events of every project it was transferred between. Counting the project's events alone would therefore bound nothing about the read, which materializes and sorts the joined set whole before the caller sees the first row. The inner LIMIT is what stops the walk at the rows the decision needs, and the answer saturates there rather than reporting how long the set is.

func (*Queries) CountProjectResourcesByType

func (q *Queries) CountProjectResourcesByType(ctx context.Context, arg CountProjectResourcesByTypeParams) ([]CountProjectResourcesByTypeRow, error)

What the project summary calls active now: per resource type, the resources the projection holds for the project as it stands. It counts the present rather than the window, so a resource that was transferred away counts for its new owner and never here, whatever the window saw it do under this project. A deleted resource keeps its projection row, so it is excluded by its state rather than by its absence.

func (*Queries) CreateAPIToken

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

func (*Queries) CreateIngestCredential

func (q *Queries) CreateIngestCredential(ctx context.Context, arg CreateIngestCredentialParams) (uuid.UUID, error)

func (*Queries) DeleteSizeNames added in v0.5.0

func (q *Queries) DeleteSizeNames(ctx context.Context, cloud string) error

The size names of one cloud. A sync replaces them whole, the delete and the inserts in one transaction, so the ingest pipeline reads either the list of the last run or the one before it and never a mix of the two.

func (*Queries) GetAPITokenByTokenHash

func (q *Queries) GetAPITokenByTokenHash(ctx context.Context, tokenHash string) (ApiToken, error)

func (*Queries) GetAPITokenForUpdate

func (q *Queries) GetAPITokenForUpdate(ctx context.Context, id uuid.UUID) (ApiToken, error)

func (*Queries) GetCurrentResource

func (q *Queries) GetCurrentResource(ctx context.Context, arg GetCurrentResourceParams) (CurrentResource, error)

The read path of one projection row. It is GetCurrentResourceForUpdate without the row lock: a read must not make a writer wait on it.

func (*Queries) GetCurrentResourceForUpdate

func (q *Queries) GetCurrentResourceForUpdate(ctx context.Context, arg GetCurrentResourceForUpdateParams) (CurrentResource, error)

func (*Queries) GetIngestCredentialByTokenHash

func (q *Queries) GetIngestCredentialByTokenHash(ctx context.Context, tokenHash string) (IngestCredential, error)

func (*Queries) GetIngestCredentialForUpdate

func (q *Queries) GetIngestCredentialForUpdate(ctx context.Context, id uuid.UUID) (IngestCredential, error)

func (*Queries) GetLastCompletedSyncStartedAt

func (q *Queries) GetLastCompletedSyncStartedAt(ctx context.Context, cloud string) (pgtype.Timestamptz, error)

Where an incremental sync starts. The bound is the previous run's started_at rather than its completed_at, so that the window overlaps that run and a change made while it was working cannot fall between the two.

func (*Queries) GetProject

func (q *Queries) GetProject(ctx context.Context, id uuid.UUID) (Project, error)

func (*Queries) GetProjectRefsByIDs

func (q *Queries) GetProjectRefsByIDs(ctx context.Context, dollar_1 []uuid.UUID) ([]GetProjectRefsByIDsRow, error)

func (*Queries) GetProjectRelation

func (q *Queries) GetProjectRelation(ctx context.Context, arg GetProjectRelationParams) (ProjectRelation, error)

The source project is part of every single-relation key: a relation is addressed under the project it leaves, and an id that belongs to another project reads as absent rather than as someone else's row.

func (*Queries) GetProjectsByIDs

func (q *Queries) GetProjectsByIDs(ctx context.Context, dollar_1 []uuid.UUID) ([]Project, error)

The batch form of the read above, for the callers that resolve a whole set of ids at once. GetProjectRefsByIDs is the same read narrowed to the two columns an event needs.

func (*Queries) GetResourceType

func (q *Queries) GetResourceType(ctx context.Context, arg GetResourceTypeParams) (ResourceType, error)

func (*Queries) GetSyncRun

func (q *Queries) GetSyncRun(ctx context.Context, id uuid.UUID) (SyncRun, error)

Reads a finished run back, for the tests that compare the stored row against the response the sync returned.

func (*Queries) InsertAuditLog

func (q *Queries) InsertAuditLog(ctx context.Context, arg InsertAuditLogParams) error

func (*Queries) InsertEvent

func (q *Queries) InsertEvent(ctx context.Context, arg InsertEventParams) (pgtype.Timestamptz, error)

func (*Queries) InsertProject

func (q *Queries) InsertProject(ctx context.Context, arg InsertProjectParams) (Project, error)

func (*Queries) InsertProjectRelation

func (q *Queries) InsertProjectRelation(ctx context.Context, arg InsertProjectRelationParams) (ProjectRelation, error)

A NULL valid_from means the relation starts when it is written, which is what a request that names no start asks for.

func (*Queries) InsertRejectedEvent

func (q *Queries) InsertRejectedEvent(ctx context.Context, arg InsertRejectedEventParams) error

func (*Queries) InsertSizeName added in v0.5.0

func (q *Queries) InsertSizeName(ctx context.Context, arg InsertSizeNameParams) error

func (*Queries) InsertSyncRun

func (q *Queries) InsertSyncRun(ctx context.Context, arg InsertSyncRunParams) (uuid.UUID, error)

The run row is written before the adapter is called, so that a run in flight can be seen while it works: status defaults to 'running' in the schema, and the row is left at that value until the run finishes.

started_at is stated by a run that was told which instant it is at, and left to now() otherwise. The told instant has to reach the column because it is the bound the next run of this cloud starts from: a told run whose row said now() would open the next window at the wall clock instead of at the instant the run reconciled.

func (*Queries) ListActiveAttributingRelations

func (q *Queries) ListActiveAttributingRelations(ctx context.Context, arg ListActiveAttributingRelationsParams) ([]ProjectRelation, error)

The walk the cycle check runs, which asks about the graph as it is rather than as it stood at some instant: only the open relations of the attributing types can carry cost, so only they can close a cycle that matters.

func (*Queries) ListCurrentResources

func (q *Queries) ListCurrentResources(ctx context.Context, arg ListCurrentResourcesParams) ([]CurrentResource, error)

func (*Queries) ListCurrentResourcesByCloud

func (q *Queries) ListCurrentResourcesByCloud(ctx context.Context, cloud string) ([]ListCurrentResourcesByCloudRow, error)

The stored side of the reconciliation diff, in the six columns the diff reads. Deleted resources are part of the answer: one the adapter reports again has come back, and telling that apart from a first sighting needs the row. last_event_at is what a correction has to be dated past to reach the row at all: one the fold orders before it replays the history instead.

func (*Queries) ListEvents

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

func (*Queries) ListEventsForResource

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

The history of one resource. Two callers read it: the projection replay, which folds every event there is under no scope and no bound, and the two per-resource routes of the API, which pass both. A NULL page size is every row, which is what the replay folds.

func (*Queries) ListProjectFoldEvents

func (q *Queries) ListProjectFoldEvents(ctx context.Context, arg ListProjectFoldEventsParams) ([]ListProjectFoldEventsRow, error)

The events one project summary folds: for every resource the project holds an event of, that resource's whole history up to an instant, ordered the way the per-resource history read orders.

The set is taken per resource rather than per event because a project's own events do not say when a resource left it. An ownership transfer writes the new project onto the event that moves the resource, so a slice narrowed to project_id ends at the last event before the transfer and folds into an interval that never closes, which the summary would then accrue up to the instant of the request while the new owner accrues the same resource from the transfer on. Reading each resource whole puts the transfer inside the fold, where the project every interval carries is what says whose it is. The read narrows on (cloud, resource_type, resource_id), which is what idx_events_resource leads with and whose first two columns are what the hypertable segments its compressed chunks by.

No payload is read. The fold takes state and size out of it only to split a run of intervals where the billable configuration changed, and the pieces of a split run add up to the run itself, so no number this summary reports depends on them. They are what this read would cost: the column is JSONB the schema puts no bound on, and every row of it would be unmarshalled into a map.

Only the upper bound of the window filters the read. The events before it are what says which resources the project was already running when the window opened, and the fold clips its intervals to the window itself. An event at or after the bound cannot change anything inside [from, to), so that is the one end the read can drop.

func (*Queries) ListProjectRelations

func (q *Queries) ListProjectRelations(ctx context.Context, arg ListProjectRelationsParams) ([]ProjectRelation, error)

The relations of one project as they stood at one instant. The two direction flags are what the direction filter of the API comes down to: a relation counts when it leaves the project and outgoing is set, or reaches it and incoming is.

func (*Queries) ListProjects

func (q *Queries) ListProjects(ctx context.Context, arg ListProjectsParams) ([]Project, error)

func (*Queries) ListRejectedEvents

func (q *Queries) ListRejectedEvents(ctx context.Context, arg ListRejectedEventsParams) ([]RejectedEvent, error)

func (*Queries) ListRelationsValidAt

func (q *Queries) ListRelationsValidAt(ctx context.Context, arg ListRelationsValidAtParams) ([]ProjectRelation, error)

The relations of a whole set of projects at one instant, for the callers that walk the graph rather than serve one project's list.

func (*Queries) ListResourceKeys

func (q *Queries) ListResourceKeys(ctx context.Context, arg ListResourceKeysParams) ([]ListResourceKeysRow, error)

func (*Queries) ListResourceTypes

func (q *Queries) ListResourceTypes(ctx context.Context) ([]ResourceType, error)

func (*Queries) ListSizeNames added in v0.5.0

func (q *Queries) ListSizeNames(ctx context.Context, arg ListSizeNamesParams) ([]ListSizeNamesRow, error)

What the ingest pipeline resolves an event's size against: every name stored for its cloud and resource type.

func (*Queries) LockAttributingRelations

func (q *Queries) LockAttributingRelations(ctx context.Context) error

Serializes the creation of attributing relations, so that two racing inserts cannot each pass the cycle walk and leave a cycle behind.

func (*Queries) LockResource

func (q *Queries) LockResource(ctx context.Context, arg LockResourceParams) error

func (*Queries) RevokeAPIToken

func (q *Queries) RevokeAPIToken(ctx context.Context, id uuid.UUID) error

func (*Queries) RevokeIngestCredential

func (q *Queries) RevokeIngestCredential(ctx context.Context, id uuid.UUID) error

func (*Queries) TrySyncLock

func (q *Queries) TrySyncLock(ctx context.Context, dollar_1 string) (bool, error)

Keeps two syncs of one cloud from running at once. The lock is held for the session rather than for the transaction, as LockResource is, because a run spans several transactions.

func (*Queries) UnlockSync

func (q *Queries) UnlockSync(ctx context.Context, dollar_1 string) error

func (*Queries) UpdateProject

func (q *Queries) UpdateProject(ctx context.Context, arg UpdateProjectParams) (Project, error)

A NULL parameter leaves the column as it stands, so a request that carries one field updates that field alone.

func (*Queries) UpdateProjectRelation

func (q *Queries) UpdateProjectRelation(ctx context.Context, arg UpdateProjectRelationParams) (ProjectRelation, error)

func (*Queries) UpsertCurrentResource

func (q *Queries) UpsertCurrentResource(ctx context.Context, arg UpsertCurrentResourceParams) error

func (*Queries) UpsertResourceType

func (q *Queries) UpsertResourceType(ctx context.Context, arg UpsertResourceTypeParams) (ResourceType, error)

func (*Queries) WithTx

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

type RejectedEvent

type RejectedEvent struct {
	ID         uuid.UUID
	ReceivedAt pgtype.Timestamptz
	Reason     string
	Raw        []byte
}

type ResourceType

type ResourceType struct {
	Platform     string
	ResourceType string
	SizeSchema   []byte
	UpdatedAt    pgtype.Timestamptz
}

type SizeName added in v0.5.0

type SizeName struct {
	Cloud        string
	ResourceType string
	Member       string
	Value        string
	Name         string
}

type SyncRun

type SyncRun struct {
	ID          uuid.UUID
	Cloud       string
	StartedAt   pgtype.Timestamptz
	CompletedAt pgtype.Timestamptz
	Status      string
	Stats       []byte
}

type UpdateProjectParams

type UpdateProjectParams struct {
	ID       uuid.UUID
	Name     pgtype.Text
	Metadata []byte
}

type UpdateProjectRelationParams

type UpdateProjectRelationParams struct {
	ID       uuid.UUID
	SourceID uuid.UUID
	Metadata []byte
	ValidTo  pgtype.Timestamptz
}

type UpsertCurrentResourceParams

type UpsertCurrentResourceParams struct {
	Cloud         string
	Platform      string
	ResourceType  string
	ResourceID    string
	ProjectID     string
	State         string
	Size          []byte
	CreatedAt     pgtype.Timestamptz
	DeletedAt     pgtype.Timestamptz
	LastEventType string
	LastEventAt   pgtype.Timestamptz
	LastPayload   []byte
	FirstEventAt  pgtype.Timestamptz
}

type UpsertResourceTypeParams

type UpsertResourceTypeParams struct {
	Platform     string
	ResourceType string
	SizeSchema   []byte
}

Jump to

Keyboard shortcuts

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