driver

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NamedValueToParams

func NamedValueToParams(args []driver.NamedValue) []environment.Param

Types

type Conn

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

Conn represents a connection to the Chai database. It implements the database/sql/driver.Conn interface.

func (*Conn) Begin

func (c *Conn) Begin() (driver.Tx, error)

Begin starts and returns a new transaction.

func (*Conn) BeginTx

func (c *Conn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error)

BeginTx starts and returns a new transaction. It uses the ReadOnly option to determine whether to start a read-only or read/write transaction. If the Isolation option is non zero, an error is returned.

func (*Conn) Close

func (c *Conn) Close() error

Close closes any ongoing transaction.

func (*Conn) Conn

func (c *Conn) Conn() *database.Connection

func (*Conn) DB

func (c *Conn) DB() *database.Database

func (*Conn) ExecContext added in v0.18.0

func (c *Conn) ExecContext(ctx context.Context, q string, args []driver.NamedValue) (driver.Result, error)

func (*Conn) Prepare

func (c *Conn) Prepare(q string) (driver.Stmt, error)

Prepare returns a prepared statement, bound to this connection.

func (*Conn) PrepareContext

func (c *Conn) PrepareContext(ctx context.Context, q string) (driver.Stmt, error)

PrepareContext returns a prepared statement, bound to this connection.

func (*Conn) QueryContext added in v0.18.0

func (c *Conn) QueryContext(ctx context.Context, q string, args []driver.NamedValue) (driver.Rows, error)

func (*Conn) ResetSession

func (c *Conn) ResetSession(ctx context.Context) error

type Connector

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

func (*Connector) Close

func (c *Connector) Close() error

func (*Connector) Connect

func (c *Connector) Connect(ctx context.Context) (driver.Conn, error)

func (*Connector) Driver

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

type Driver

type Driver struct{}

Driver is a driver.Driver that can open a new connection to a Chai database. It is the driver used to register Chai against the database/sql package.

func (Driver) Open

func (d Driver) Open(name string) (driver.Conn, error)

func (Driver) OpenConnector

func (d Driver) OpenConnector(name string) (driver.Connector, error)

type ExecResult

type ExecResult struct{}

func (ExecResult) LastInsertId

func (r ExecResult) LastInsertId() (int64, error)

LastInsertId is not supported and returns an error.

func (ExecResult) RowsAffected

func (r ExecResult) RowsAffected() (int64, error)

RowsAffected is not supported and returns an error.

type Rows

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

func NewRows

func NewRows(res *statement.Result) (*Rows, error)

func (*Rows) Close

func (rs *Rows) Close() error

Close closes the rows iterator.

func (*Rows) Columns

func (rs *Rows) Columns() []string

Columns returns the fields selected by the SELECT statement.

func (*Rows) Next

func (rs *Rows) Next(dest []driver.Value) error

type Stmt

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

Stmt is a prepared statement. It is bound to a Conn and not used by multiple goroutines concurrently.

func (Stmt) Close

func (s Stmt) Close() error

Close does nothing.

func (*Stmt) Exec

func (s *Stmt) Exec(args []driver.Value) (driver.Result, error)

Exec executes a query that doesn't return rows, such as an INSERT or UPDATE.

func (*Stmt) ExecContext

func (s *Stmt) ExecContext(ctx context.Context, args []driver.NamedValue) (driver.Result, error)

ExecContext executes a query that doesn't return rows, such as an INSERT or UPDATE.

func (*Stmt) NumInput

func (s *Stmt) NumInput() int

NumInput returns the number of placeholder parameters.

func (Stmt) Query

func (s Stmt) Query(args []driver.Value) (driver.Rows, error)

func (*Stmt) QueryContext

func (s *Stmt) QueryContext(ctx context.Context, args []driver.NamedValue) (driver.Rows, error)

QueryContext executes a query that may return rows, such as a SELECT.

Jump to

Keyboard shortcuts

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