adapters

package
v1.1.1-beta Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2025 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBAdapter

type DBAdapter interface {
	Query(ctx context.Context, query string) (DBRows, error)
	Exec(ctx context.Context, query string) (DBResult, error)
}

DBAdapter defines the interface for database operations needed by the event store

type DBResult

type DBResult interface {
	RowsAffected() (int64, error)
}

DBResult defines the interface for execution results

type DBRows

type DBRows interface {
	Next() bool
	Scan(dest ...interface{}) error
	Close() error
}

DBRows defines the interface for query result rows

type PGXAdapter

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

PGXAdapter implements DBAdapter for pgxpool.Pool

func NewPGXAdapter

func NewPGXAdapter(pool *pgxpool.Pool) *PGXAdapter

NewPGXAdapter creates a new PGX adapter

func (*PGXAdapter) Exec

func (p *PGXAdapter) Exec(ctx context.Context, query string) (DBResult, error)

func (*PGXAdapter) Query

func (p *PGXAdapter) Query(ctx context.Context, query string) (DBRows, error)

type SQLAdapter

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

SQLAdapter implements DBAdapter for sql.DB

func NewSQLAdapter

func NewSQLAdapter(db *sql.DB) *SQLAdapter

NewSQLAdapter creates a new SQL adapter

func (*SQLAdapter) Exec

func (s *SQLAdapter) Exec(ctx context.Context, query string) (DBResult, error)

func (*SQLAdapter) Query

func (s *SQLAdapter) Query(ctx context.Context, query string) (DBRows, error)

type SQLXAdapter

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

SQLXAdapter implements DBAdapter for sqlx.DB

func NewSQLXAdapter

func NewSQLXAdapter(db *sqlx.DB) *SQLXAdapter

NewSQLXAdapter creates a new SQLX adapter

func (*SQLXAdapter) Exec

func (s *SQLXAdapter) Exec(ctx context.Context, query string) (DBResult, error)

func (*SQLXAdapter) Query

func (s *SQLXAdapter) Query(ctx context.Context, query string) (DBRows, error)

Jump to

Keyboard shortcuts

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