mockdriver

package module
v0.0.0-...-b51443a Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2022 License: BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotImplement = errors.New("not implement")

Functions

This section is empty.

Types

type CURDMode

type CURDMode string

CURDMode curd mode

const (
	CURDUnkown CURDMode = "CURD_UNKOWN"
	CURDInsert CURDMode = "INSERT"
	CURDSelect CURDMode = "SELECT"
	CURDUpdate CURDMode = "UPDATE"
	CURDDelete CURDMode = "DELETE"
)

func (CURDMode) String

func (c CURDMode) String() string

String to string

type Conn

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

------------------------------------------------------------- Conn is a connection to a database

func (*Conn) Begin

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

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) Prepare

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

type DB

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

------------------------------------------------------------------- DB mock

func GetDB

func GetDB(name string) *DB

GetDB find db

func NewDB

func NewDB(name string) *DB

NewDB mock

func (*DB) GetTable

func (db *DB) GetTable(name string) *Table

GetTable mock

type Driver

type Driver struct{}

Driver mock dirver

func (*Driver) Open

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

Open mock

type Record

type Record []driver.Value

------------------------------------------------------------------ Record mock

type Result

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

Result is the result of a query execution.

func (*Result) LastInsertId

func (r *Result) LastInsertId() (int64, error)

LastInsertId mock

func (*Result) RowsAffected

func (r *Result) RowsAffected() (int64, error)

RowsAffected mock

type Rows

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

Rows is an iterator over an executed query's results.

func (*Rows) Close

func (r *Rows) Close() error

Close mock

func (*Rows) Columns

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

Columns mock

func (*Rows) Next

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

Next mock

type Stmt

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

---------------------------------------------------------------- Stmt is a prepared statement

func NewStmt

func NewStmt(dbName, query string) (*Stmt, error)

NewStmt new stmt

func (*Stmt) Close

func (s *Stmt) Close() error

func (*Stmt) Exec

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

handle insert, update, and delete

func (*Stmt) NumInput

func (s *Stmt) NumInput() int

func (*Stmt) Query

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

type Table

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

Table mock

func NewTable

func NewTable(name string) *Table

NewTable new table

func (*Table) Exec

func (t *Table) Exec(mode CURDMode, fields []string, args []driver.Value) (driver.Result, error)

Exec mock

type Tx

type Tx struct{}

---------------------------------------------------------------------------- Tx is a transaction.

func (*Tx) Commit

func (t *Tx) Commit() error

Commit mock

func (*Tx) Rollback

func (t *Tx) Rollback() error

Rollback mock

Jump to

Keyboard shortcuts

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