sql

package
v0.395.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateAsyncCallParams

type CreateAsyncCallParams struct {
	ScheduledAt       time.Time
	Verb              schema.RefKey
	Origin            string
	Request           api.EncryptedAsyncColumn
	RemainingAttempts int32
	Backoff           sqltypes.Duration
	MaxBackoff        sqltypes.Duration
	CatchVerb         optional.Option[schema.RefKey]
	ParentRequestKey  optional.Option[string]
	TraceContext      json.RawMessage
}

type CreateCronJobParams

type CreateCronJobParams struct {
	Key           model.CronJobKey
	DeploymentKey model.DeploymentKey
	ModuleName    string
	Verb          string
	Schedule      string
	StartTime     time.Time
	NextExecution time.Time
}

type CronJob

type CronJob struct {
	ID              int64
	Key             model.CronJobKey
	DeploymentID    int64
	Verb            string
	Schedule        string
	StartTime       time.Time
	NextExecution   time.Time
	ModuleName      string
	LastExecution   sqltypes.OptionalTime
	LastAsyncCallID optional.Option[int64]
}

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 Deployment

type Deployment struct {
	ID              int64
	CreatedAt       time.Time
	ModuleID        int64
	Key             model.DeploymentKey
	Schema          *schema.Module
	Labels          json.RawMessage
	MinReplicas     int32
	LastActivatedAt time.Time
}

type GetCronJobByKeyRow

type GetCronJobByKeyRow struct {
	CronJob    CronJob
	Deployment Deployment
}

type GetUnscheduledCronJobsRow

type GetUnscheduledCronJobsRow struct {
	CronJob    CronJob
	Deployment Deployment
}

type Querier

type Querier interface {
	AsyncCallQueueDepth(ctx context.Context) (int64, error)
	CreateAsyncCall(ctx context.Context, arg CreateAsyncCallParams) (int64, error)
	CreateCronJob(ctx context.Context, arg CreateCronJobParams) error
	DeleteCronAsyncCallsForDeployment(ctx context.Context, deploymentKey model.DeploymentKey) error
	DeleteCronJobsForDeployment(ctx context.Context, deploymentKey model.DeploymentKey) error
	GetCronJobByKey(ctx context.Context, key model.CronJobKey) (GetCronJobByKeyRow, error)
	GetUnscheduledCronJobs(ctx context.Context, startTime time.Time) ([]GetUnscheduledCronJobsRow, error)
	IsCronJobPending(ctx context.Context, key model.CronJobKey, startTime time.Time) (bool, error)
	UpdateCronJobExecution(ctx context.Context, arg UpdateCronJobExecutionParams) error
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) AsyncCallQueueDepth

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

func (*Queries) CreateAsyncCall

func (q *Queries) CreateAsyncCall(ctx context.Context, arg CreateAsyncCallParams) (int64, error)

func (*Queries) CreateCronJob

func (q *Queries) CreateCronJob(ctx context.Context, arg CreateCronJobParams) error

func (*Queries) DeleteCronAsyncCallsForDeployment added in v0.384.0

func (q *Queries) DeleteCronAsyncCallsForDeployment(ctx context.Context, deploymentKey model.DeploymentKey) error

func (*Queries) DeleteCronJobsForDeployment added in v0.383.1

func (q *Queries) DeleteCronJobsForDeployment(ctx context.Context, deploymentKey model.DeploymentKey) error

func (*Queries) GetCronJobByKey

func (q *Queries) GetCronJobByKey(ctx context.Context, key model.CronJobKey) (GetCronJobByKeyRow, error)

func (*Queries) GetUnscheduledCronJobs

func (q *Queries) GetUnscheduledCronJobs(ctx context.Context, startTime time.Time) ([]GetUnscheduledCronJobsRow, error)

func (*Queries) IsCronJobPending

func (q *Queries) IsCronJobPending(ctx context.Context, key model.CronJobKey, startTime time.Time) (bool, error)

func (*Queries) UpdateCronJobExecution

func (q *Queries) UpdateCronJobExecution(ctx context.Context, arg UpdateCronJobExecutionParams) error

func (*Queries) WithTx

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

type Type

type Type = sqltypes.Type

type UpdateCronJobExecutionParams

type UpdateCronJobExecutionParams struct {
	LastAsyncCallID int64
	LastExecution   time.Time
	NextExecution   time.Time
	Key             model.CronJobKey
}

Jump to

Keyboard shortcuts

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