repository

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DatabaseAdapter

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

DatabaseAdapter adapts the db.Database to the domain.Database interface

func (*DatabaseAdapter) Begin

func (a *DatabaseAdapter) Begin(ctx context.Context, opts *domain.TxOptions) (domain.Tx, error)

Begin starts a new transaction

func (*DatabaseAdapter) Exec

func (a *DatabaseAdapter) Exec(ctx context.Context, statement string, args ...interface{}) (domain.Result, error)

Exec executes a statement on the database

func (*DatabaseAdapter) Query

func (a *DatabaseAdapter) Query(ctx context.Context, query string, args ...interface{}) (domain.Rows, error)

Query executes a query on the database

type DatabaseRepository

type DatabaseRepository struct{}

DatabaseRepository implements domain.DatabaseRepository

func NewDatabaseRepository

func NewDatabaseRepository() *DatabaseRepository

NewDatabaseRepository creates a new database repository

func (*DatabaseRepository) GetDatabase

func (r *DatabaseRepository) GetDatabase(id string) (domain.Database, error)

GetDatabase retrieves a database by ID

func (*DatabaseRepository) GetDatabaseType added in v1.6.0

func (r *DatabaseRepository) GetDatabaseType(id string) (string, error)

GetDatabaseType returns the type of a database by ID

func (*DatabaseRepository) ListDatabases

func (r *DatabaseRepository) ListDatabases() []string

ListDatabases returns a list of available database IDs

type ResultAdapter

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

ResultAdapter adapts sql.Result to domain.Result

func (*ResultAdapter) LastInsertId

func (a *ResultAdapter) LastInsertId() (int64, error)

LastInsertId returns the last insert ID

func (*ResultAdapter) RowsAffected

func (a *ResultAdapter) RowsAffected() (int64, error)

RowsAffected returns the number of rows affected

type RowsAdapter

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

RowsAdapter adapts sql.Rows to domain.Rows

func (*RowsAdapter) Close

func (a *RowsAdapter) Close() error

Close closes the rows

func (*RowsAdapter) Columns

func (a *RowsAdapter) Columns() ([]string, error)

Columns returns the column names

func (*RowsAdapter) Err

func (a *RowsAdapter) Err() error

Err returns any error that occurred during iteration

func (*RowsAdapter) Next

func (a *RowsAdapter) Next() bool

Next advances to the next row

func (*RowsAdapter) Scan

func (a *RowsAdapter) Scan(dest ...interface{}) error

Scan scans the current row

type TxAdapter

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

TxAdapter adapts sql.Tx to domain.Tx

func (*TxAdapter) Commit

func (a *TxAdapter) Commit() error

Commit commits the transaction

func (*TxAdapter) Exec

func (a *TxAdapter) Exec(ctx context.Context, statement string, args ...interface{}) (domain.Result, error)

Exec executes a statement within the transaction

func (*TxAdapter) Query

func (a *TxAdapter) Query(ctx context.Context, query string, args ...interface{}) (domain.Rows, error)

Query executes a query within the transaction

func (*TxAdapter) Rollback

func (a *TxAdapter) Rollback() error

Rollback rolls back the transaction

Jump to

Keyboard shortcuts

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