ToolsDBHelper

package
v0.0.0-...-332b391 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2022 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoProcessRow

func DoProcessRow(row *sql.Rows, Afunc func(data map[string]interface{}, Atype []*sql.ColumnType) bool) error

func DoProcessRows

func DoProcessRows(rows *sql.Rows, Afunc func(data map[string]interface{}, Atype []*sql.ColumnType) bool) error

func DoQuery

func DoQuery(rows *sql.Rows) ([]map[string]interface{}, error)

func DoRowToStruct

func DoRowToStruct(rows *sql.Rows, objaddr interface{}) error

func DoRowsToStruct

func DoRowsToStruct(rows *sql.Rows, objaddr interface{}) error

Types

type DbStruct

type DbStruct struct {
}

简单的生成SQL语句

func (*DbStruct) Delete

func (DS *DbStruct) Delete(TblName string, obj interface{}, Key string) string

func (*DbStruct) GenerateArgs

func (DS *DbStruct) GenerateArgs(obj interface{}) string

func (*DbStruct) Insert

func (DS *DbStruct) Insert(TblName string, obj interface{}) string
type Testt struct {
	DbStruct
	Aid int `col:"aid"`
	Abc string `col:"abc"`
	Bcd int `col:"bcd"`
	Cde float64 `col:"cde"`
}

生成插入语句

func (*DbStruct) Update

func (DS *DbStruct) Update(TblName string, obj interface{}, Key string) string

type NullInt

type NullInt struct {
	Int   int
	Valid bool // Valid is true if Int is not NULL
}

func (*NullInt) Scan

func (nt *NullInt) Scan(value interface{}) error

Scan 实现它的赋值方法(注意,这个方属于指针)

func (*NullInt) Value

func (nt *NullInt) Value() (driver.Value, error)

Value 实现它的取值方式

type NullTime

type NullTime struct {
	Time  time.Time
	Valid bool // Valid is true if Time is not NULL
}

func (*NullTime) Scan

func (nt *NullTime) Scan(value interface{}) error

Scan 实现它的赋值方法(注意,这个方属于指针)

func (NullTime) Value

func (nt NullTime) Value() (driver.Value, error)

Value 实现它的取值方式

Jump to

Keyboard shortcuts

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