datastore

package
v0.2.33 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MigrationFS embed.FS

MigrationFS is an embedded filesystem containing all SQL migrations necessary for provisioning the database.

Migration filenames must be in the format <version>_<name>.sql, where version is a 4 digit number. The first version is 0001, the second 0002, and so on. The leading 0s are stripped from the version during migration, so exist only to support numerical ordering when listing files.

Functions

This section is empty.

Types

type Datastore added in v0.0.14

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

Datastore provides various operations for manipulating a database.

func NewDatastore added in v0.0.14

func NewDatastore(db qrm.DB) *Datastore

NewDatastore creates a new Datastore.

func (*Datastore) CreateAuditEvent added in v0.0.14

func (d *Datastore) CreateAuditEvent(ctx context.Context, event *entities.AuditEvent) error

...

func (*Datastore) CreateResource added in v0.0.14

func (d *Datastore) CreateResource(ctx context.Context, resource *entities.Resource) error

...

func (*Datastore) DeleteResource added in v0.0.14

func (d *Datastore) DeleteResource(ctx context.Context, id uuid.UUID) error

...

func (*Datastore) GetResource added in v0.0.14

func (d *Datastore) GetResource(ctx context.Context, id uuid.UUID) (*entities.Resource, error)

...

func (*Datastore) ListAuditEvents added in v0.0.14

func (d *Datastore) ListAuditEvents(ctx context.Context) ([]*entities.AuditEvent, error)

...

func (*Datastore) ListResources added in v0.0.14

func (d *Datastore) ListResources(ctx context.Context) ([]*entities.Resource, error)

...

func (*Datastore) UpdateResource added in v0.0.14

func (d *Datastore) UpdateResource(
	ctx context.Context,
	resource *entities.Resource,
) (*entities.Resource, error)

...

func (*Datastore) WatchAuditEvents added in v0.0.14

func (d *Datastore) WatchAuditEvents(ctx context.Context, ch chan<- *entities.AuditEvent) error

...

TODO: decide how to implement this, use poller or notify?

type Provider added in v0.0.14

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

Provider is used to create a Datastore with an optional transaction.

When using transactions, it is recommended to use TxFunc, TxValue or TxValues in the common adapter. This reduces boilerplate by abstracting away the commit and rollback of the transaction.

func NewProvider added in v0.0.14

func NewProvider(db *sql.DB) *Provider

NewProvider creates a new Provider.

func (*Provider) BeginTx added in v0.0.14

func (p *Provider) BeginTx(
	ctx context.Context,
) (txn.Datastore, txn.CommitFn, txn.RollbackFn, error)

BeginTx creates a Datastore within a transaction.

func (*Provider) Datastore added in v0.0.14

func (p *Provider) Datastore() txn.Datastore

Datastore creates a Datastore without a transaction.

Directories

Path Synopsis
schema

Jump to

Keyboard shortcuts

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