postgres

package
v0.1.149 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultLogsRetentionDuration = time.Hour * 24 * 7   // 1 week
	DefaultJobsRetentionDuration = time.Hour * 24 * 365 // 1 year
)

Functions

This section is empty.

Types

type Option

type Option = func(ds *PostgresDatastore)

func WithDisableCleanup

func WithDisableCleanup(val bool) Option

func WithEncryptionKey added in v0.1.142

func WithEncryptionKey(val string) Option

func WithJobsRetentionDuration added in v0.1.112

func WithJobsRetentionDuration(dur time.Duration) Option

func WithLogsRetentionDuration added in v0.1.112

func WithLogsRetentionDuration(dur time.Duration) Option

type PostgresDatastore

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

func NewPostgresDataStore

func NewPostgresDataStore(dsn string, opts ...Option) (*PostgresDatastore, error)

func NewTestDatastore added in v0.1.119

func NewTestDatastore() (*PostgresDatastore, error)

func (*PostgresDatastore) AssignRole added in v0.1.80

func (ds *PostgresDatastore) AssignRole(ctx context.Context, userID, roleID string) error

func (*PostgresDatastore) Close added in v0.1.118

func (ds *PostgresDatastore) Close() error

func (*PostgresDatastore) CreateJob

func (ds *PostgresDatastore) CreateJob(ctx context.Context, j *tork.Job) error

func (*PostgresDatastore) CreateNode

func (ds *PostgresDatastore) CreateNode(ctx context.Context, n *tork.Node) error

func (*PostgresDatastore) CreateRole added in v0.1.80

func (ds *PostgresDatastore) CreateRole(ctx context.Context, r *tork.Role) error

func (*PostgresDatastore) CreateScheduledJob added in v0.1.109

func (ds *PostgresDatastore) CreateScheduledJob(ctx context.Context, sj *tork.ScheduledJob) error

func (*PostgresDatastore) CreateTask

func (ds *PostgresDatastore) CreateTask(ctx context.Context, t *tork.Task) error

func (*PostgresDatastore) CreateTaskLogPart

func (ds *PostgresDatastore) CreateTaskLogPart(ctx context.Context, p *tork.TaskLogPart) error

func (*PostgresDatastore) CreateUser added in v0.1.75

func (ds *PostgresDatastore) CreateUser(ctx context.Context, u *tork.User) error

func (*PostgresDatastore) DeleteScheduledJob added in v0.1.119

func (ds *PostgresDatastore) DeleteScheduledJob(ctx context.Context, id string) error

func (*PostgresDatastore) ExecScript

func (ds *PostgresDatastore) ExecScript(script string) error

func (*PostgresDatastore) GetActiveNodes

func (ds *PostgresDatastore) GetActiveNodes(ctx context.Context) ([]*tork.Node, error)

func (*PostgresDatastore) GetActiveScheduledJobs added in v0.1.109

func (ds *PostgresDatastore) GetActiveScheduledJobs(ctx context.Context) ([]*tork.ScheduledJob, error)

func (*PostgresDatastore) GetActiveTasks

func (ds *PostgresDatastore) GetActiveTasks(ctx context.Context, jobID string) ([]*tork.Task, error)

func (*PostgresDatastore) GetJobByID

func (ds *PostgresDatastore) GetJobByID(ctx context.Context, id string) (*tork.Job, error)

func (*PostgresDatastore) GetJobLogParts added in v0.1.70

func (ds *PostgresDatastore) GetJobLogParts(ctx context.Context, jobID, q string, page, size int) (*datastore.Page[*tork.TaskLogPart], error)

func (*PostgresDatastore) GetJobs

func (ds *PostgresDatastore) GetJobs(ctx context.Context, currentUser, q string, page, size int) (*datastore.Page[*tork.JobSummary], error)

func (*PostgresDatastore) GetMetrics

func (ds *PostgresDatastore) GetMetrics(ctx context.Context) (*tork.Metrics, error)

func (*PostgresDatastore) GetNextTask added in v0.1.98

func (ds *PostgresDatastore) GetNextTask(ctx context.Context, parentTaskID string) (*tork.Task, error)

func (*PostgresDatastore) GetNodeByID

func (ds *PostgresDatastore) GetNodeByID(ctx context.Context, id string) (*tork.Node, error)

func (*PostgresDatastore) GetRole added in v0.1.80

func (ds *PostgresDatastore) GetRole(ctx context.Context, id string) (*tork.Role, error)

func (*PostgresDatastore) GetRoles added in v0.1.80

func (ds *PostgresDatastore) GetRoles(ctx context.Context) ([]*tork.Role, error)

func (*PostgresDatastore) GetScheduledJobByID added in v0.1.109

func (ds *PostgresDatastore) GetScheduledJobByID(ctx context.Context, id string) (*tork.ScheduledJob, error)

func (*PostgresDatastore) GetScheduledJobs added in v0.1.109

func (ds *PostgresDatastore) GetScheduledJobs(ctx context.Context, currentUser string, page, size int) (*datastore.Page[*tork.ScheduledJobSummary], error)

func (*PostgresDatastore) GetTaskByID

func (ds *PostgresDatastore) GetTaskByID(ctx context.Context, id string) (*tork.Task, error)

func (*PostgresDatastore) GetTaskLogParts

func (ds *PostgresDatastore) GetTaskLogParts(ctx context.Context, taskID, q string, page, size int) (*datastore.Page[*tork.TaskLogPart], error)

func (*PostgresDatastore) GetUser added in v0.1.75

func (ds *PostgresDatastore) GetUser(ctx context.Context, uid string) (*tork.User, error)

func (*PostgresDatastore) GetUserRoles added in v0.1.80

func (ds *PostgresDatastore) GetUserRoles(ctx context.Context, userID string) ([]*tork.Role, error)

func (*PostgresDatastore) HealthCheck

func (ds *PostgresDatastore) HealthCheck(ctx context.Context) error

func (*PostgresDatastore) UnassignRole added in v0.1.80

func (ds *PostgresDatastore) UnassignRole(ctx context.Context, userID, roleID string) error

func (*PostgresDatastore) UpdateJob

func (ds *PostgresDatastore) UpdateJob(ctx context.Context, id string, modify func(u *tork.Job) error) error

func (*PostgresDatastore) UpdateNode

func (ds *PostgresDatastore) UpdateNode(ctx context.Context, id string, modify func(u *tork.Node) error) error

func (*PostgresDatastore) UpdateScheduledJob added in v0.1.109

func (ds *PostgresDatastore) UpdateScheduledJob(ctx context.Context, id string, modify func(u *tork.ScheduledJob) error) error

func (*PostgresDatastore) UpdateTask

func (ds *PostgresDatastore) UpdateTask(ctx context.Context, id string, modify func(t *tork.Task) error) error

func (*PostgresDatastore) WithTx

func (ds *PostgresDatastore) WithTx(ctx context.Context, f func(tx datastore.Datastore) error) error

Jump to

Keyboard shortcuts

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