db

package
v0.3.28 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const CustomDriverName = "sqlite3_extended"

CustomDriverName is the name of the custom SQLite driver.

Variables

This section is empty.

Functions

func NewReadTx added in v0.3.2

func NewReadTx() dbx.ReadTxFactory[ports.ReadTx]

NewReadTx is a factory function that returns a new readTxImpl.

func NewWriteTx added in v0.3.2

NewReadWriteTx is a factory function that returns a new writeTxImpl.

func RunMigrations

func RunMigrations(db *gorm.DB) error

RunMigrations is a helper function to run the migrations for the database.

Types

type Database

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

Database is a struct that represents the database adapter.

func New

func New(gorm *gorm.DB) *Database

New creates a new instance of the Database adapter.

func NewDB added in v0.3.28

func NewDB(opts ...Opt) (*Database, error)

NewDB creates a new instance of the Database adapter.

func (*Database) Close added in v0.3.28

func (d *Database) Close() error

Close is a method that closes the database connection.

func (*Database) Conn added in v0.3.28

func (d *Database) Conn() *gorm.DB

Conn returns the underlying GORM DB connection.

func (*Database) Create

func (d *Database) Create(ctx context.Context, account *models.Account) error

Create is a method that creates a new account.

func (*Database) Delete

func (d *Database) Delete(ctx context.Context, account *models.Account) error

Delete is a method that deletes an account.

func (*Database) Get

func (d *Database) Get(ctx context.Context, account *models.Account) error

Get is a method that returns an account by ID.

func (*Database) GetCurrent

func (d *Database) GetCurrent(ctx context.Context, account *models.Account) error

GetCurrent is a method that returns the current account.

func (*Database) List

func (d *Database) List(ctx context.Context, accounts *[]models.Account) error

List is a method that returns a list of all accounts.

func (*Database) Migrate added in v0.3.28

func (d *Database) Migrate(ctx context.Context, _ ...any) error

Migrate is a method that runs the migrations for the database.

func (*Database) Update

func (d *Database) Update(ctx context.Context, account *models.Account) error

Update is a method that updates an account.

type Opt added in v0.3.28

type Opt func(*Database) error

Opt is an function that returns the options for the database.

func WithSqlite3 added in v0.3.28

func WithSqlite3(path string) Opt

WithSqlite3 returns an option that sets the database to use SQLite3.

Jump to

Keyboard shortcuts

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