Documentation
¶
Index ¶
- type Clause
- func ClauseWithCreatedAt(createdAt int64) Clause
- func ClauseWithCreatedBefore(createdAt int64) Clause
- func ClauseWithID(id uuid.UUID) Clause
- func ClauseWithIsNotified(isNotified bool) Clause
- func ClauseWithJobID(jobID uuid.UUID) Clause
- func ClauseWithReadyToBeSent(val int64) Clause
- func ClauseWithStatus(status string) Clause
- func ClauseWithStatuses(statuses ...string) Clause
- func ClauseWithUpdatedBefore(updatedAt int64) Clause
- type Cursor
- type EntityName
- type Field
- type Operator
- type OrderBy
- type Query
- type RetrievalMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Clause ¶
type Clause struct {
Field Field // The field to filter on.
Operator Operator // The comparison operator.
Value any // The value to compare against.
}
Clause represents a single filtering condition in a query. It specifies the field to filter on, the operator to use, and the value to compare.
func ClauseWithCreatedAt ¶
ClauseWithCreatedAt creates a Clause that filters by the created_at field using the equality operator and the provided timestamp value.
func ClauseWithCreatedBefore ¶
ClauseWithCreatedBefore creates a Clause that filters for entities with a created_at field less than or equal to the provided timestamp.
func ClauseWithID ¶
ClauseWithID creates a Clause that filters by the entity's ID field using the equality operator and the provided UUID value.
func ClauseWithIsNotified ¶
ClauseWithIsNotified creates a Clause that filters results based on the isNotified field. It returns a Clause that matches entities where the isNotified field equals the specified value.
func ClauseWithJobID ¶
ClauseWithJobID creates a Clause that filters by the job ID field using the equality operator and the provided UUID value.
func ClauseWithReadyToBeSent ¶
ClauseWithReadyToBeSent creates a Clause that filters for entities where the sum of reconcile_after_sec and last_reconciled_at is less than or equal to the current time.
func ClauseWithStatus ¶
ClauseWithStatus creates a Clause that filters by the status field using the equality operator and the provided status value.
func ClauseWithStatuses ¶
ClauseWithStatuses creates a Clause that filters by the status field using the in operator and the provided status values.
func ClauseWithUpdatedBefore ¶
ClauseWithUpdatedBefore creates a Clause that filters for entities with a created_at field less than or equal to the provided timestamp.
type Cursor ¶
type Cursor struct {
Timestamp int64 // Timestamp for the cursor position.
ID uuid.UUID // Unique identifier for the cursor position.
}
Cursor represents a pagination cursor for queries. It consists of a timestamp and a unique identifier to support efficient and consistent pagination of results.
type EntityName ¶
type EntityName string
EntityName represents the name of the entity in the query.
const ( EntityNameJobs EntityName = "jobs" EntityNameTasks EntityName = "tasks" EntityNameJobCursor EntityName = "job_cursor" EntityNameJobEvent EntityName = "job_event" )
type OrderBy ¶
type OrderBy struct {
Field Field // The field to order by.
IsAscending bool // If true, orders in ascending order; otherwise, descending.
}
OrderBy represents the ordering of query results.
func OrderByUpdatedAtAscending ¶
func OrderByUpdatedAtAscending() OrderBy
OrderByUpdatedAtAscending creates an OrderBy clause that orders results by the updated_at field in ascending order.
type Query ¶
type Query struct {
EntityName EntityName // Name of the entity being queried.
Clauses []Clause // Filtering clauses for the query.
Cursor Cursor // Cursor for pagination.
Limit int // Maximum number of results to return.
RetrievalMode RetrievalMode
OrderBy []OrderBy // Fields to order the results by.
}
Query represents a database query for a specific entity type. It includes filtering clauses, pagination cursor, result limit, and an option to enable queue-like retrieval mode.
type RetrievalMode ¶ added in v0.2.0
type RetrievalMode int
const ( RetrievalModeDefault RetrievalMode = iota RetrievalModeForUpdate RetrievalModeForUpdateSkipLocked )