dbal

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: BSD-3-Clause Imports: 2 Imported by: 0

README

Obelus.one DBAL Library

Disclaimer

It is not a production-ready solution. It is a part of the Obelus.one/NEUdp projects that are under development. We believe it will grow in future, but be aware this may contain bugs and vulnerabilities as well as it will be changed.

Installation

go get gitlab.com/obelus-one/go/dbal

Documentation

Index

Constants

This section is empty.

Variables

Functions

func Session

func Session(ctx ExecutionContext, do func(conn Connection) error) error

func Transaction

func Transaction(ctx ExecutionContext, do func(tx Tx) error, opts *TxOptions) error

Types

type AccessMode

type AccessMode int
const (
	ReadOnly AccessMode = iota
	ReadWrite
)

type Connection

type Connection interface {
	ExecuteCommand
	ExecuteQuery
	BeginTx(ctx context.Context, opts *TxOptions) (Tx, error)
	Close() error
}

type ExecuteCommand

type ExecuteCommand interface {
	ExecuteCommand(ctx context.Context, query string, args ...any) error
}

type ExecuteQuery

type ExecuteQuery interface {
	ExecuteQuery(ctx context.Context, query string, args ...any) (Rows, error)
}

type ExecutionContext

type ExecutionContext interface {
	RuntimeContext() context.Context
	Connection(ctx context.Context) (Connection, error)
}

type IsolationLevel

type IsolationLevel int
const (
	Serializable IsolationLevel = iota
	RepeatableRead
	ReadCommitted
	ReadUncommitted
)

type Rows

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

type Tx

type Tx interface {
	ExecuteCommand
	ExecuteQuery
	Commit(ctx context.Context) error
	Rollback(ctx context.Context) error
}

type TxOptions

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

func NewTransactionOptions

func NewTransactionOptions(isolationLevel IsolationLevel, accessMode AccessMode) *TxOptions

func (*TxOptions) AccessMode

func (opts *TxOptions) AccessMode() AccessMode

func (*TxOptions) IsolationLevel

func (opts *TxOptions) IsolationLevel() IsolationLevel

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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