result

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: May 26, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EmptyMap

type EmptyMap struct {
	MiddlewareType string
}

func NewEmptyMap

func NewEmptyMap(middlewareType string) *EmptyMap

NewEmptyMap returns *EmptyMap with given middleware type

func (*EmptyMap) GetMap

func (emr *EmptyMap) 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 (*EmptyMap) GetMapByName

func (emr *EmptyMap) 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 (*EmptyMap) GetMapFloat

func (emr *EmptyMap) 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 (*EmptyMap) GetMapFloatByName

func (emr *EmptyMap) 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 (*EmptyMap) GetMapInt

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

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

func (*EmptyMap) GetMapIntByName

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

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

func (*EmptyMap) GetMapString

func (emr *EmptyMap) 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 (*EmptyMap) GetMapStringByName

func (emr *EmptyMap) 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 (*EmptyMap) GetMapUint

func (emr *EmptyMap) GetMapUint(row, column int) (map[string]uint, error)

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

func (*EmptyMap) GetMapUintByName

func (emr *EmptyMap) GetMapUintByName(row int, name string) (map[string]uint, error)

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

type EmptyMetadata

type EmptyMetadata struct {
	MiddlewareType string
}

func NewEmptyMetadata

func NewEmptyMetadata(middlewareType string) *EmptyMetadata

NewEmptyMetadata returns *EmptyMetadata with given middleware type

func (*EmptyMetadata) LastInsertID

func (em *EmptyMetadata) LastInsertID() (int, error)

LastInsertID always returns error, because middleware does not support Metadata, this function is only for implementing the middleware.Result interface

func (*EmptyMetadata) RowsAffected

func (em *EmptyMetadata) RowsAffected() (int, error)

RowsAffected always returns error, because middleware does not support Metadata, this function is only for implementing the middleware.Result interface

type EmptySlice

type EmptySlice struct {
	MiddlewareType string
}

func NewEmptySlice

func NewEmptySlice(middlewareType string) *EmptySlice

NewEmptySlice returns *EmptySlice with given middleware type

func (*EmptySlice) GetFloatSlice

func (esr *EmptySlice) 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 (*EmptySlice) GetFloatSliceByName

func (esr *EmptySlice) 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 (*EmptySlice) GetIntSlice

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

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

func (*EmptySlice) GetIntSliceByName

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

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

func (*EmptySlice) GetSlice

func (esr *EmptySlice) 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 (*EmptySlice) GetSliceByName

func (esr *EmptySlice) 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 (*EmptySlice) GetStringSlice

func (esr *EmptySlice) 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 (*EmptySlice) GetStringSliceByName

func (esr *EmptySlice) 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 (*EmptySlice) GetUintSlice

func (esr *EmptySlice) GetUintSlice(row, column int) ([]uint, error)

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

func (*EmptySlice) GetUintSliceByName

func (esr *EmptySlice) GetUintSliceByName(row int, name string) ([]uint, error)

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

type Map

type Map interface {
	GetMap(row, column int) (map[string]interface{}, error)
	GetMapByName(row int, name string) (map[string]interface{}, error)
	GetMapUint(row, column int) (map[string]uint, error)
	GetMapUintByName(row int, name string) (map[string]uint, error)
	GetMapInt(row, column int) (map[string]int, error)
	GetMapIntByName(row int, name string) (map[string]int, 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 Metadata

type Metadata interface {
	// LastInsertID returns the database's auto-generated ID
	// after, for example, an INSERT into a table with primary key.
	LastInsertID() (int, error)
	// RowsAffected returns the number of rows affected by the query.
	RowsAffected() (int, error)
}

type Number

type Number interface {
	// GetUint returns uint type value of given row and column number
	GetUint(row, column int) (uint, error)
	// GetUintByName returns uint type value of given row number and column name
	GetUintByName(row int, name string) (uint, error)
	// GetInt returns int type value of given row and column number
	GetInt(row, column int) (int, error)
	// GetIntByName returns int 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)
}

type Raw added in v0.3.3

type Raw interface {
	// GetRaw returns the raw data of the result
	GetRaw() interface{}
}

type Rows

type Rows struct {
	FieldSlice []string
	FieldMap   map[string]int
	Values     [][]driver.Value
}

func NewEmptyRows added in v0.3.3

func NewEmptyRows() *Rows

NewEmptyRows returns an empty *Rows

func NewRows

func NewRows(fieldSlice []string, fieldMap map[string]int, values [][]driver.Value) *Rows

NewRows returns *Rows

func NewRowsWithRows

func NewRowsWithRows(rows driver.Rows) *Rows

NewRowsWithRows returns *Rows, it builds from given rows

func (*Rows) ColumnExists

func (r *Rows) ColumnExists(name string) bool

ColumnExists check if column exists in the result

func (*Rows) ColumnNumber

func (r *Rows) ColumnNumber() int

ColumnNumber returns how many columns in the result

func (*Rows) GetFloat

func (r *Rows) GetFloat(row, column int) (float64, error)

GetFloat returns float64 type value of given row and column number

func (*Rows) GetFloatByName

func (r *Rows) GetFloatByName(row int, name string) (float64, error)

GetFloatByName returns float64 type value of given row number and column name

func (*Rows) GetFloatSlice

func (r *Rows) GetFloatSlice(row, column int) ([]float64, error)

GetFloatSlice returns []float64 type value of given row and column number

func (*Rows) GetFloatSliceByName

func (r *Rows) GetFloatSliceByName(row int, name string) ([]float64, error)

GetFloatSliceByName returns []float64 type value of given row number and column name

func (*Rows) GetInt

func (r *Rows) GetInt(row, column int) (int, error)

GetInt returns int type value of given row and column number

func (*Rows) GetIntByName

func (r *Rows) GetIntByName(row int, name string) (int, error)

GetIntByName returns int type value of given row number and column name

func (*Rows) GetIntSlice

func (r *Rows) GetIntSlice(row, column int) ([]int, error)

GetIntSlice returns []uint64 type value of given row and column number

func (*Rows) GetIntSliceByName

func (r *Rows) GetIntSliceByName(row int, name string) ([]int, error)

GetIntSliceByName returns []int64 type value of given row number and column name

func (*Rows) GetSlice

func (r *Rows) GetSlice(row, column int) ([]interface{}, error)

GetSlice returns []interface type value of given row and column number

func (*Rows) GetSliceByName

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

GetSliceByName returns []interface type value of given row number and column name

func (*Rows) GetString

func (r *Rows) GetString(row, column int) (string, error)

GetString returns string type value of given row and column number

func (*Rows) GetStringByName

func (r *Rows) GetStringByName(row int, name string) (string, error)

GetStringByName returns string type value of given row number and column name

func (*Rows) GetStringSlice

func (r *Rows) GetStringSlice(row, column int) ([]string, error)

GetStringSlice returns []string type value of given row and column number

func (*Rows) GetStringSliceByName

func (r *Rows) GetStringSliceByName(row int, name string) ([]string, error)

GetStringSliceByName returns []string type value of given row number and column name

func (*Rows) GetUint

func (r *Rows) GetUint(row, column int) (uint, error)

GetUint returns uint type value of given row and column number

func (*Rows) GetUintByName

func (r *Rows) GetUintByName(row int, name string) (uint, error)

GetUintByName returns uint type value of given row number and column name

func (*Rows) GetUintSlice

func (r *Rows) GetUintSlice(row, column int) ([]uint, error)

GetUintSlice returns []uint type value of given row and column number

func (*Rows) GetUintSliceByName

func (r *Rows) GetUintSliceByName(row int, name string) ([]uint, error)

GetUintSliceByName returns []uint64 type value of given row number and column name

func (*Rows) GetValue

func (r *Rows) GetValue(row, column int) (interface{}, error)

GetValue returns interface{} type value of given row and column number

func (*Rows) GetValueByName

func (r *Rows) GetValueByName(row int, name string) (interface{}, error)

GetValueByName returns interface{} type value of given row number and column name

func (*Rows) IsNull

func (r *Rows) IsNull(row, column int) (bool, error)

IsNull checks if value of given row and column index is nil

func (*Rows) IsNullByName

func (r *Rows) IsNullByName(row int, name string) (bool, error)

IsNullByName checks if value of given row number and column name is nil

func (*Rows) MapToStructByRowIndex

func (r *Rows) MapToStructByRowIndex(in interface{}, row int, 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.

func (*Rows) MapToStructSlice

func (r *Rows) MapToStructSlice(in interface{}, tag 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.

func (*Rows) NameIndex

func (r *Rows) NameIndex(name string) (int, error)

NameIndex returns index of given column

func (*Rows) RowNumber

func (r *Rows) RowNumber() int

RowNumber returns how many rows in the result

type Slice

type Slice interface {
	GetSlice(row, column int) ([]interface{}, error)
	GetSliceByName(row int, name string) ([]interface{}, error)
	GetUintSlice(row, column int) ([]uint, error)
	GetUintSliceByName(row int, name string) ([]uint, error)
	GetIntSlice(row, column int) ([]int, error)
	GetIntSliceByName(row int, name string) ([]int, 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 String

type String interface {
	// 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)
}

type Unmarshaler

type Unmarshaler interface {
	// 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
}

type Value

type Value interface {
	// 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)
}

Jump to

Keyboard shortcuts

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