Documentation ¶
Index ¶
- func FromCtx(ctx context.Context) string
- func NewCtx(ctx context.Context, owner string) context.Context
- func NewScopedPgx(ctx context.Context, dsn string) (*pgxpool.Pool, error)
- type BatchUpdateFailedJobsBatchResults
- type BatchUpdateFailedJobsParams
- type BatchUpdateJobsBatchResults
- type BatchUpdateJobsParams
- type CountJobsInStatusParams
- type CreateJobParams
- type CronNextRunParams
- type DBTX
- type DeleteJobByIDParams
- type DeleteJobByNameParams
- type FetchDueJobsParams
- type GetJobByIDParams
- type GetJobByNameParams
- type NextParams
- type NullTinyStatus
- type Querier
- type Queries
- func (q *Queries) BatchUpdateFailedJobs(ctx context.Context, arg []BatchUpdateFailedJobsParams) *BatchUpdateFailedJobsBatchResults
- func (q *Queries) BatchUpdateJobs(ctx context.Context, arg []BatchUpdateJobsParams) *BatchUpdateJobsBatchResults
- func (q *Queries) CountJobsInStatus(ctx context.Context, arg CountJobsInStatusParams) (int64, error)
- func (q *Queries) CreateJob(ctx context.Context, arg CreateJobParams) (TinyJob, error)
- func (q *Queries) CronNextRun(ctx context.Context, arg CronNextRunParams) (pgtype.Timestamptz, error)
- func (q *Queries) DeleteJobByID(ctx context.Context, arg DeleteJobByIDParams) (TinyJob, error)
- func (q *Queries) DeleteJobByName(ctx context.Context, arg DeleteJobByNameParams) (TinyJob, error)
- func (q *Queries) FetchDueJobs(ctx context.Context, arg FetchDueJobsParams) ([]TinyJob, error)
- func (q *Queries) GetJobByID(ctx context.Context, arg GetJobByIDParams) (TinyJob, error)
- func (q *Queries) GetJobByName(ctx context.Context, arg GetJobByNameParams) (TinyJob, error)
- func (q *Queries) Next(ctx context.Context, arg NextParams) (pgtype.Timestamptz, error)
- func (q *Queries) ResetTimeoutJobs(ctx context.Context, executor string) ([]int64, error)
- func (q *Queries) RestartJob(ctx context.Context, arg RestartJobParams) (TinyJob, error)
- func (q *Queries) SearchJobs(ctx context.Context, arg SearchJobsParams) ([]TinyJob, error)
- func (q *Queries) SearchJobsByMeta(ctx context.Context, arg SearchJobsByMetaParams) ([]SearchJobsByMetaRow, error)
- func (q *Queries) StopJob(ctx context.Context, arg StopJobParams) (TinyJob, error)
- func (q *Queries) UpdateExprByID(ctx context.Context, arg UpdateExprByIDParams) (TinyJob, error)
- func (q *Queries) UpdateJobByID(ctx context.Context, arg UpdateJobByIDParams) (TinyJob, error)
- func (q *Queries) UpdateJobByName(ctx context.Context, arg UpdateJobByNameParams) (TinyJob, error)
- func (q *Queries) UpdateStateByID(ctx context.Context, arg UpdateStateByIDParams) (TinyJob, error)
- func (q *Queries) ValidateExprFormat(ctx context.Context, dollar_1 string) (bool, error)
- func (q *Queries) WithTx(tx pgx.Tx) *Queries
- type RestartJobParams
- type ScopedPgx
- type SearchJobsByMetaParams
- type SearchJobsByMetaRow
- type SearchJobsParams
- type StopJobParams
- type TinyJob
- type TinyStatus
- type UpdateExprByIDParams
- type UpdateJobByIDParams
- type UpdateJobByNameParams
- type UpdateStateByIDParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BatchUpdateFailedJobsBatchResults ¶
type BatchUpdateFailedJobsBatchResults struct {
// contains filtered or unexported fields
}
func (*BatchUpdateFailedJobsBatchResults) Close ¶
func (b *BatchUpdateFailedJobsBatchResults) Close() error
func (*BatchUpdateFailedJobsBatchResults) Exec ¶
func (b *BatchUpdateFailedJobsBatchResults) Exec(f func(int, error))
type BatchUpdateJobsBatchResults ¶
type BatchUpdateJobsBatchResults struct {
// contains filtered or unexported fields
}
func (*BatchUpdateJobsBatchResults) Close ¶
func (b *BatchUpdateJobsBatchResults) Close() error
func (*BatchUpdateJobsBatchResults) Exec ¶
func (b *BatchUpdateJobsBatchResults) Exec(f func(int, error))
type BatchUpdateJobsParams ¶
type CountJobsInStatusParams ¶
type CountJobsInStatusParams struct { Executor string `json:"executor"` Status TinyStatus `json:"status"` }
type CreateJobParams ¶
type CreateJobParams struct { Expr string `json:"expr"` State string `json:"state"` Executor string `json:"executor"` StartAt pgtype.Timestamptz `json:"start_at"` Meta []byte `json:"meta"` Name interface{} `json:"name"` Timeout interface{} `json:"timeout"` Owner interface{} `json:"owner"` Retries interface{} `json:"retries"` }
type CronNextRunParams ¶
type CronNextRunParams struct { From pgtype.Timestamptz `json:"from"` Expr string `json:"expr"` }
type DeleteJobByIDParams ¶
type DeleteJobByNameParams ¶
type FetchDueJobsParams ¶
type GetJobByIDParams ¶
type GetJobByNameParams ¶
type NextParams ¶
type NextParams struct { From pgtype.Timestamptz `json:"from"` Expr string `json:"expr"` }
type NullTinyStatus ¶
type NullTinyStatus struct { TinyStatus TinyStatus Valid bool // Valid is true if TinyStatus is not NULL }
func (*NullTinyStatus) Scan ¶
func (ns *NullTinyStatus) Scan(value interface{}) error
Scan implements the Scanner interface.
type Querier ¶
type Querier interface { Begin(ctx context.Context) (pgx.Tx, error) BeginTx(ctx context.Context, opts pgx.TxOptions) (pgx.Tx, error) Exec(ctx context.Context, sql string, arguments ...any) (pgconn.CommandTag, error) Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error) QueryRow(ctx context.Context, sql string, args ...any) pgx.Row SendBatch(ctx context.Context, batch *pgx.Batch) pgx.BatchResults Close() }
Querier provides abstraction for passing both pgxpool.Conn, pgx.Conn and pgx.Tx as possible datasources
type Queries ¶
type Queries struct {
// contains filtered or unexported fields
}
func (*Queries) BatchUpdateFailedJobs ¶
func (q *Queries) BatchUpdateFailedJobs(ctx context.Context, arg []BatchUpdateFailedJobsParams) *BatchUpdateFailedJobsBatchResults
func (*Queries) BatchUpdateJobs ¶
func (q *Queries) BatchUpdateJobs(ctx context.Context, arg []BatchUpdateJobsParams) *BatchUpdateJobsBatchResults
func (*Queries) CountJobsInStatus ¶
func (*Queries) CronNextRun ¶
func (q *Queries) CronNextRun(ctx context.Context, arg CronNextRunParams) (pgtype.Timestamptz, error)
func (*Queries) DeleteJobByID ¶
func (*Queries) DeleteJobByName ¶
func (*Queries) FetchDueJobs ¶
func (*Queries) GetJobByID ¶
func (*Queries) GetJobByName ¶
func (*Queries) Next ¶
func (q *Queries) Next(ctx context.Context, arg NextParams) (pgtype.Timestamptz, error)
func (*Queries) ResetTimeoutJobs ¶
func (*Queries) RestartJob ¶
func (*Queries) SearchJobs ¶
TODO: This query is not working with dynamic params 🤔
func (*Queries) SearchJobsByMeta ¶
func (q *Queries) SearchJobsByMeta(ctx context.Context, arg SearchJobsByMetaParams) ([]SearchJobsByMetaRow, error)
func (*Queries) StopJob ¶
Cannot stop a currently running task as it is outside of control for now Possible to add a notification system to listen on those kind of events
func (*Queries) UpdateExprByID ¶
func (*Queries) UpdateJobByID ¶
func (*Queries) UpdateJobByName ¶
TODO: Implement search
func (*Queries) UpdateStateByID ¶
func (*Queries) ValidateExprFormat ¶
type RestartJobParams ¶
type ScopedPgx ¶
ScopedPgx is a scoped connection pool that only leverages a lower privileges postgres role that is subject to RLS
type SearchJobsByMetaParams ¶
type SearchJobsByMetaParams struct { Offset int32 `json:"offset"` Limit int32 `json:"limit"` Query string `json:"query"` Statuses string `json:"statuses"` From pgtype.Timestamptz `json:"from"` To pgtype.Timestamptz `json:"to"` Name string `json:"name"` IsOneShot bool `json:"is_one_shot"` Executor string `json:"executor"` }
type SearchJobsByMetaRow ¶
type SearchJobsByMetaRow struct { ID int64 `json:"id"` Expr string `json:"expr"` RunAt pgtype.Timestamptz `json:"run_at"` LastRunAt pgtype.Timestamptz `json:"last_run_at"` CreatedAt pgtype.Timestamptz `json:"created_at"` StartAt pgtype.Timestamptz `json:"start_at"` ExecutionAmount int32 `json:"execution_amount"` Retries int32 `json:"retries"` Name string `json:"name"` Meta []byte `json:"meta"` Timeout int32 `json:"timeout"` Status TinyStatus `json:"status"` State string `json:"state"` Executor string `json:"executor"` Owner string `json:"owner"` TotalCount int64 `json:"total_count"` }
type SearchJobsParams ¶
type StopJobParams ¶
type TinyJob ¶
type TinyJob struct { ID int64 `json:"id"` Expr string `json:"expr"` RunAt pgtype.Timestamptz `json:"run_at"` LastRunAt pgtype.Timestamptz `json:"last_run_at"` CreatedAt pgtype.Timestamptz `json:"created_at"` StartAt pgtype.Timestamptz `json:"start_at"` ExecutionAmount int32 `json:"execution_amount"` Retries int32 `json:"retries"` Name string `json:"name"` Meta []byte `json:"meta"` Timeout int32 `json:"timeout"` Status TinyStatus `json:"status"` State string `json:"state"` Executor string `json:"executor"` Owner string `json:"owner"` }
type TinyStatus ¶
type TinyStatus string
const ( TinyStatusREADY TinyStatus = "READY" TinyStatusPENDING TinyStatus = "PENDING" TinyStatusFAILURE TinyStatus = "FAILURE" TinyStatusSUCCESS TinyStatus = "SUCCESS" TinyStatusPAUSED TinyStatus = "PAUSED" )
func (*TinyStatus) Scan ¶
func (e *TinyStatus) Scan(src interface{}) error
type UpdateExprByIDParams ¶
type UpdateJobByIDParams ¶
type UpdateJobByNameParams ¶
type UpdateStateByIDParams ¶
Click to show internal directories.
Click to hide internal directories.