middleware

package
v0.2.32 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2021 License: Apache-2.0 Imports: 2 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EmptyMapResult added in v0.2.23

type EmptyMapResult struct {
	MiddlewareType string
}

func NewEmptyMapResult added in v0.2.23

func NewEmptyMapResult(middlewareType string) *EmptyMapResult

NewEmptyMapResult returns *EmptyMapResult with given middleware type

func (*EmptyMapResult) GetMap added in v0.2.23

func (emr *EmptyMapResult) GetMap(row, column int) (map[string]interface{}, error)

GetMap always returns error, because middleware does not support map data type, this function is only for implementing the middleware.Result interface

func (*EmptyMapResult) GetMapByName added in v0.2.23

func (emr *EmptyMapResult) GetMapByName(row int, name string) (map[string]interface{}, error)

GetMapByName always returns error, because middleware does not support map data type, this function is only for implementing the middleware.Result interface

func (*EmptyMapResult) GetMapFloat added in v0.2.23

func (emr *EmptyMapResult) GetMapFloat(row, column int) (map[string]float64, error)

GetMapFloat always returns error, because middleware does not support map data type, this function is only for implementing the middleware.Result interface

func (*EmptyMapResult) GetMapFloatByName added in v0.2.23

func (emr *EmptyMapResult) GetMapFloatByName(row int, name string) (map[string]float64, error)

GetMapFloatByName always returns error, because middleware does not support map data type, this function is only for implementing the middleware.Result interface

func (*EmptyMapResult) GetMapInt added in v0.2.23

func (emr *EmptyMapResult) GetMapInt(row, column int) (map[string]int64, error)

GetMapInt always returns error, because middleware does not support map data type, this function is only for implementing the middleware.Result interface

func (*EmptyMapResult) GetMapIntByName added in v0.2.23

func (emr *EmptyMapResult) GetMapIntByName(row int, name string) (map[string]int64, error)

GetMapIntByName always returns error, because middleware does not support map data type, this function is only for implementing the middleware.Result interface

func (*EmptyMapResult) GetMapString added in v0.2.23

func (emr *EmptyMapResult) GetMapString(row, column int) (map[string]string, error)

GetMapString always returns error, because middleware does not support map data type, this function is only for implementing the middleware.Result interface

func (*EmptyMapResult) GetMapStringByName added in v0.2.23

func (emr *EmptyMapResult) GetMapStringByName(row int, name string) (map[string]string, error)

GetMapStringByName always returns error, because middleware does not support map data type, this function is only for implementing the middleware.Result interface

func (*EmptyMapResult) GetMapUint added in v0.2.23

func (emr *EmptyMapResult) GetMapUint(row, column int) (map[string]uint64, error)

GetMapUint always returns error, because middleware does not support map data type, this function is only for implementing the middleware.Result interface

func (*EmptyMapResult) GetMapUintByName added in v0.2.23

func (emr *EmptyMapResult) GetMapUintByName(row int, name string) (map[string]uint64, error)

GetMapUintByName always returns error, because middleware does not support map data type, this function is only for implementing the middleware.Result interface

type EmptySliceResult added in v0.2.23

type EmptySliceResult struct {
	MiddlewareType string
}

func NewEmptySliceResult added in v0.2.23

func NewEmptySliceResult(middlewareType string) *EmptySliceResult

NewEmptySliceResult returns *EmptySliceResult with given middleware type

func (*EmptySliceResult) GetFloatSlice added in v0.2.23

func (esr *EmptySliceResult) GetFloatSlice(row, column int) ([]float64, error)

GetFloatSlice always returns error, because middleware does not support slice type this function is only for implementing the middleware.Result interface

func (*EmptySliceResult) GetFloatSliceByName added in v0.2.23

func (esr *EmptySliceResult) GetFloatSliceByName(row int, name string) ([]float64, error)

GetFloatSliceByName always returns error, because middleware does not support slice type this function is only for implementing the middleware.Result interface

func (*EmptySliceResult) GetIntSlice added in v0.2.23

func (esr *EmptySliceResult) GetIntSlice(row, column int) ([]int64, error)

GetIntSlice always returns error, because middleware does not support slice type this function is only for implementing the middleware.Result interface

func (*EmptySliceResult) GetIntSliceByName added in v0.2.23

func (esr *EmptySliceResult) GetIntSliceByName(row int, name string) ([]int64, error)

GetIntSliceByName always returns error, because middleware does not support slice type this function is only for implementing the middleware.Result interface

func (*EmptySliceResult) GetSlice added in v0.2.23

func (esr *EmptySliceResult) GetSlice(row, column int) ([]interface{}, error)

GetSlice always returns error, because middleware does not support slice type this function is only for implementing the middleware.Result interface

func (*EmptySliceResult) GetSliceByName added in v0.2.23

func (esr *EmptySliceResult) GetSliceByName(row int, name string) ([]interface{}, error)

GetSliceByName always returns error, because middleware does not support slice type this function is only for implementing the middleware.Result interface

func (*EmptySliceResult) GetStringSlice added in v0.2.23

func (esr *EmptySliceResult) GetStringSlice(row, column int) ([]string, error)

GetStringSlice always returns error, because middleware does not support slice type this function is only for implementing the middleware.Result interface

func (*EmptySliceResult) GetStringSliceByName added in v0.2.23

func (esr *EmptySliceResult) GetStringSliceByName(row int, name string) ([]string, error)

GetStringSliceByName always returns error, because middleware does not support slice type this function is only for implementing the middleware.Result interface

func (*EmptySliceResult) GetUintSlice added in v0.2.23

func (esr *EmptySliceResult) GetUintSlice(row, column int) ([]uint64, error)

GetUintSlice always returns error, because middleware does not support slice type this function is only for implementing the middleware.Result interface

func (*EmptySliceResult) GetUintSliceByName added in v0.2.23

func (esr *EmptySliceResult) GetUintSliceByName(row int, name string) ([]uint64, error)

GetUintSliceByName always returns error, because middleware does not support slice type this function is only for implementing the middleware.Result interface

type MapResult added in v0.2.23

type MapResult interface {
	GetMap(row, column int) (map[string]interface{}, error)
	GetMapByName(row int, name string) (map[string]interface{}, error)
	GetMapUint(row, column int) (map[string]uint64, error)
	GetMapUintByName(row int, name string) (map[string]uint64, error)
	GetMapInt(row, column int) (map[string]int64, error)
	GetMapIntByName(row int, name string) (map[string]int64, error)
	GetMapFloat(row, column int) (map[string]float64, error)
	GetMapFloatByName(row int, name string) (map[string]float64, error)
	GetMapString(row, column int) (map[string]string, error)
	GetMapStringByName(row int, name string) (map[string]string, error)
}

type Pool

type Pool interface {
	// Close releases each connection in the pool
	Close() error
	// IsClosed returns if pool had been closed
	IsClosed() bool
	// Get gets a connection from the pool
	Get() (PoolConn, error)
	// Transaction returns a connection that could run multiple statements in the same transaction
	Transaction() (Transaction, error)
	// Supply creates given number of connections and add them to the pool
	Supply(num int) error
	// Release releases given number of connections, each connection will disconnect with the middleware
	Release(num int) error
}

type PoolConn

type PoolConn interface {
	// Close returns connection back to the pool
	Close() error
	// Disconnect disconnects from the middleware, normally when using connection pool
	Disconnect() error
	// IsValid validates if connection is valid
	IsValid() bool
	// Execute executes given command and placeholders on the middleware
	Execute(command string, args ...interface{}) (Result, error)
}

type Result added in v0.2.7

type Result interface {
	// LastInsertID returns the database's auto-generated ID
	// after, for example, an INSERT into a table with primary key.
	LastInsertID() (uint64, error)
	// RowsAffected returns the number of rows affected by the query.
	RowsAffected() (uint64, error)
	// RowNumber returns how many rows in the result
	RowNumber() int
	// ColumnNumber return how many columns in the result
	ColumnNumber() int
	// GetValue returns interface{} type value of given row and column number
	GetValue(row, column int) (interface{}, error)
	// ColumnExists check if column exists in the result
	ColumnExists(name string) bool
	// NameIndex returns number of given column
	NameIndex(name string) (int, error)
	// GetValueByName returns interface{} type value of given row number and column name
	GetValueByName(row int, name string) (interface{}, error)
	// IsNull checks if value of given row and column number is nil
	IsNull(row, column int) (bool, error)
	// IsNullByName checks if value of given row number and column name is nil
	IsNullByName(row int, name string) (bool, error)
	// GetUint returns uint64 type value of given row and column number
	GetUint(row, column int) (uint, error)
	// GetUintByName returns uint64 type value of given row number and column name
	GetUintByName(row int, name string) (uint, error)
	// GetInt returns int64 type value of given row and column number
	GetInt(row, column int) (int, error)
	// GetIntByName returns int64 type value of given row number and column name
	GetIntByName(row int, name string) (int, error)
	// GetFloat returns float64 type value of given row and column number
	GetFloat(row, column int) (float64, error)
	// GetFloatByName returns float64 type value of given row number and column name
	GetFloatByName(row int, name string) (float64, error)
	// GetString returns string type value of given row and column number
	GetString(row, column int) (string, error)
	// GetStringByName returns string type value of given row number and column name
	GetStringByName(row int, name string) (string, error)
	// MapToStructSlice maps each row to a struct of the first argument,
	// first argument must be a slice of pointers to structs,
	// each row in the result maps to a struct in the slice,
	// each column in the row maps to a field of the struct,
	// tag argument is the tag of the field, it represents the column name,
	// if there is no such tag in the field, this field will be ignored,
	// so set tag to each field that need to be mapped,
	// using "middleware" as the tag is recommended.
	MapToStructSlice(in interface{}, tag string) error
	// MapToStructByRowIndex maps row of given index result to the struct
	// first argument must be a pointer to struct,
	// each column in the row maps to a field of the struct,
	// tag argument is the tag of the field, it represents the column name,
	// if there is no such tag in the field, this field will be ignored,
	// so set tag to each field that need to be mapped,
	// using "middleware" as the tag is recommended.
	MapToStructByRowIndex(in interface{}, row int, tag string) error
	SliceResult
	MapResult
}

type SliceResult added in v0.2.23

type SliceResult interface {
	GetSlice(row, column int) ([]interface{}, error)
	GetSliceByName(row int, name string) ([]interface{}, error)
	GetUintSlice(row, column int) ([]uint64, error)
	GetUintSliceByName(row int, name string) ([]uint64, error)
	GetIntSlice(row, column int) ([]int64, error)
	GetIntSliceByName(row int, name string) ([]int64, error)
	GetFloatSlice(row, column int) ([]float64, error)
	GetFloatSliceByName(row int, name string) ([]float64, error)
	GetStringSlice(row, column int) ([]string, error)
	GetStringSliceByName(row int, name string) ([]string, error)
}

type Transaction added in v0.2.22

type Transaction interface {
	PoolConn
	// Begin begins a transaction
	Begin() error
	// Commit commits current transaction
	Commit() error
	// Rollback rollbacks current transaction
	Rollback() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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