scanner

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const TagKey = "db"

TagKey parse struct tag

Variables

View Source
var Debug = false

Debug 模式

Functions

func FormatName

func FormatName(name string) string

FormatName 格式化字段名

func Plugins

func Plugins(dst interface{}, columns []string, targets []interface{}) error

Plugins .. see https://github.com/russross/meddler/blob/038a8ef02b66198d4db78da3e9830fde52a7e072/meddler.go

func ResolveStructValue

func ResolveStructValue(dst interface{}) (map[string]interface{}, error)

ResolveStructValue 解析模型数据到 非零值不解析

func Scan

func Scan(rows *sql.Rows, dst interface{}) error

Scan ..

func ScanAll

func ScanAll(rows *sql.Rows, dst interface{}) error

ScanAll ..

func ScanRow

func ScanRow(rows *sql.Rows, dst interface{}) error

ScanRow ScanRow and Close Rows

func SnakeString

func SnakeString(s string) string

SnakeString 转 snake_string

func Targets

func Targets(dst interface{}, columns []string) ([]interface{}, error)

Targets ..

func UpdateModel

func UpdateModel(dst interface{}, list map[string]interface{}) error

UpdateModel ..

Types

type StructData

type StructData struct {
	Uniques []string
	Indexs  []string
	// contains filtered or unexported fields
}

StructData 模型

func ResolveModelStruct

func ResolveModelStruct(dst interface{}) (*StructData, error)

ResolveModelStruct 解析模型

func (StructData) Columns

func (s StructData) Columns() []string

Columns ..

func (StructData) GetPk

func (s StructData) GetPk() string

GetPk ..

func (StructData) GetStructField

func (s StructData) GetStructField(k string) *StructField

GetStructField ..

func (StructData) TableName

func (s StructData) TableName() string

TableName ..

type StructField

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

StructField 模型字段

Jump to

Keyboard shortcuts

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