driver

package
v6.7.2 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2022 License: AGPL-3.0, Apache-2.0 Imports: 3 Imported by: 1

Documentation

Overview

package driver implements a DB driver that can be used by plugins to make SQL queries using RPC. This helps to avoid opening new connections for every plugin, and lets everyone use the central connection pool in the server. The tests for this package are at app/plugin_api_tests/test_db_driver/main.go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

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

Conn is a DB driver conn implementation which executes queries using the Plugin DB API.

func (*Conn) Begin

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

func (*Conn) BeginTx

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

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) ExecContext

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

func (*Conn) Ping

func (c *Conn) Ping(_ context.Context) error

func (*Conn) Prepare

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

func (*Conn) PrepareContext

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

func (*Conn) QueryContext

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

type Connector

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

Connector is the DB connector which is used to communicate with the DB API.

func NewConnector

func NewConnector(api plugin.Driver, isMaster bool) *Connector

NewConnector returns a DB connector that can be used to return a sql.DB object. It takes a plugin.Driver implementation and a boolean flag to indicate whether to connect to a master or replica DB instance.

func (*Connector) Connect

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

func (*Connector) Driver

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

type Driver

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

Driver is a DB driver implementation.

func (Driver) Open

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

Jump to

Keyboard shortcuts

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