store

package
v0.0.0-...-376b802 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GetJobsQuery

type GetJobsQuery struct {
	Owner     string          `json:"owner"`
	OwnerType types.OwnerType `json:"owner_type"`
}

type OwnerQuery

type OwnerQuery struct {
	Owner     string          `json:"owner"`
	OwnerType types.OwnerType `json:"owner_type"`
}

type PostgresStore

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

func NewPostgresStore

func NewPostgresStore(
	options StoreOptions,
) (*PostgresStore, error)

func (*PostgresStore) CheckAPIKey

func (d *PostgresStore) CheckAPIKey(ctx context.Context, apiKey string) (*types.ApiKey, error)

func (*PostgresStore) CreateAPIKey

func (d *PostgresStore) CreateAPIKey(ctx context.Context, owner OwnerQuery, name string) (string, error)

func (*PostgresStore) CreateBalanceTransfer

func (d *PostgresStore) CreateBalanceTransfer(
	ctx context.Context,
	transfer types.BalanceTransfer,
) error

func (*PostgresStore) CreateJob

func (d *PostgresStore) CreateJob(
	ctx context.Context,
	job types.Job,
) error

func (*PostgresStore) DeleteAPIKey

func (d *PostgresStore) DeleteAPIKey(ctx context.Context, apiKey types.ApiKey) error

func (*PostgresStore) GetAPIKeys

func (d *PostgresStore) GetAPIKeys(ctx context.Context, query OwnerQuery) ([]*types.ApiKey, error)

func (*PostgresStore) GetBalanceTransfers

func (d *PostgresStore) GetBalanceTransfers(
	ctx context.Context,
	query OwnerQuery,
) ([]*types.BalanceTransfer, error)

func (*PostgresStore) GetJob

func (d *PostgresStore) GetJob(
	ctx context.Context,
	queryID string,
) (*types.Job, error)

func (*PostgresStore) GetJobs

func (d *PostgresStore) GetJobs(
	ctx context.Context,
	query GetJobsQuery,
) ([]*types.Job, error)

func (*PostgresStore) GetMigrations

func (d *PostgresStore) GetMigrations() (*migrate.Migrate, error)

func (*PostgresStore) MigrateDown

func (d *PostgresStore) MigrateDown() error

func (*PostgresStore) MigrateUp

func (d *PostgresStore) MigrateUp() error

func (*PostgresStore) UpdateJob

func (d *PostgresStore) UpdateJob(
	ctx context.Context,
	id string,
	state string,
	status string,
	data types.JobData,
) error

type Store

type Store interface {
	GetJob(ctx context.Context, queryID string) (*types.Job, error)
	GetJobs(ctx context.Context, query GetJobsQuery) ([]*types.Job, error)
	CreateJob(ctx context.Context, job types.Job) error
	UpdateJob(ctx context.Context, id string, state string, status string, data types.JobData) error
	GetBalanceTransfers(ctx context.Context, query OwnerQuery) ([]*types.BalanceTransfer, error)
	CreateBalanceTransfer(ctx context.Context, balanceTransfer types.BalanceTransfer) error
	CreateAPIKey(ctx context.Context, owner OwnerQuery, name string) (string, error)
	GetAPIKeys(ctx context.Context, query OwnerQuery) ([]*types.ApiKey, error)
	DeleteAPIKey(ctx context.Context, apiKey types.ApiKey) error
	CheckAPIKey(ctx context.Context, apiKey string) (*types.ApiKey, error)
}

type StoreOptions

type StoreOptions struct {
	Host        string
	Port        int
	Database    string
	Username    string
	Password    string
	AutoMigrate bool
}

Jump to

Keyboard shortcuts

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