gdbc

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConnectionDoesNotExist = errors.New("this connection has been closed")
)

Functions

This section is empty.

Types

type Connection

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

func NewConnection

func NewConnection(db *sql.DB) *Connection

func (*Connection) BeginTransaction

func (c *Connection) BeginTransaction(ctx context.Context) (sql.TransactionStatus, error)

func (*Connection) Close

func (c *Connection) Close() error

func (*Connection) Driver

func (c *Connection) Driver() driver.Driver

func (*Connection) ExecContext

func (c *Connection) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)

func (*Connection) IsClosed

func (c *Connection) IsClosed() bool

func (*Connection) PingContext

func (c *Connection) PingContext(ctx context.Context) error

func (*Connection) PrepareContext

func (c *Connection) PrepareContext(ctx context.Context, query string, args ...any) (sql.Statement, error)

func (*Connection) QueryContext

func (c *Connection) QueryContext(ctx context.Context, query string, args ...any) (sql.RowSet, error)

func (*Connection) QueryRowContext

func (c *Connection) QueryRowContext(ctx context.Context, query string, args ...any) (sql.Row, error)

func (*Connection) SetConnMaxIdleTime

func (c *Connection) SetConnMaxIdleTime(d time.Duration) error

func (*Connection) SetConnMaxLifetime

func (c *Connection) SetConnMaxLifetime(d time.Duration) error

func (*Connection) SetMaxIdleConns

func (c *Connection) SetMaxIdleConns(n int) error

func (*Connection) SetMaxOpenConns

func (c *Connection) SetMaxOpenConns(n int) error

type DataSource

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

func NewDataSource

func NewDataSource(props DataSourceProperties) *DataSource

func (*DataSource) GetConnection

func (ds *DataSource) GetConnection() (sql.Connection, error)

type DataSourceProperties

type DataSourceProperties struct {
	Url      string
	Username string
	Password string
}

type Operations

type Operations interface {
	Exec(ctx context.Context, query string, args ...any) (sql.Result, error)
	Prepare(ctx context.Context, query string) (sql.Statement, error)
	Query(ctx context.Context, query string, args ...any) (sql.RowSet, error)
	QueryRow(ctx context.Context, query string, args ...any) sql.Row
}

type Template

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

func NewTemplate

func NewTemplate(dataSource sql.DataSource) *Template

func (*Template) Exec

func (t *Template) Exec(ctx context.Context, query string, args ...any) (sql.Result, error)

func (*Template) Prepare

func (t *Template) Prepare(ctx context.Context, query string) (sql.Statement, error)

func (*Template) Query

func (t *Template) Query(ctx context.Context, query string, args ...any) (sql.RowSet, error)

func (*Template) QueryRow

func (t *Template) QueryRow(ctx context.Context, query string, args ...any) sql.Row

Jump to

Keyboard shortcuts

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