structs

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Debug bool

Functions

func ByteArrayScan

func ByteArrayScan(src interface{}) (interface{}, error)

func CamelToSnakeString

func CamelToSnakeString(s string) string

func Float32Scan

func Float32Scan(src interface{}) (interface{}, error)

func GetGoid

func GetGoid() int64

func IntScan

func IntScan(src interface{}) (interface{}, error)

func MapToCondition

func MapToCondition(maps map[string]interface{}) cnds.Condition

func ScannerResultToStruct

func ScannerResultToStruct(t reflect.Type, scanners []interface{}, columnNames []string, columnIdxMap map[string]int) reflect.Value

func SliceToGroupSlice

func SliceToGroupSlice(vs interface{}) map[string][]interface{}

func StructToCondition

func StructToCondition(vs interface{}, columns ...string) cnds.Condition

func StructToMap

func StructToMap(vs interface{}, columns ...string) (map[string]interface{}, []string, error)

func UnZipSlice

func UnZipSlice(vs interface{}) []interface{}

Types

type Column

type Column struct {
	Data        interface{}
	ColumnName  string
	FieldName   string
	Primary     bool
	PrimaryAuto bool //If Primary Key Auto Generate Or2 Not
}

type CountResult

type CountResult struct {
	Count int64
	Error error
}

type DefaultStruct

type DefaultStruct struct {
}

type DefaultTableModel

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

func (DefaultTableModel) Clone

func (d DefaultTableModel) Clone() TableModel

func (DefaultTableModel) ColumnDataMap

func (d DefaultTableModel) ColumnDataMap() map[string]interface{}

func (DefaultTableModel) Columns

func (d DefaultTableModel) Columns() []string

func (DefaultTableModel) Condition

func (d DefaultTableModel) Condition() cnds.Condition

func (DefaultTableModel) GetScanners

func (d DefaultTableModel) GetScanners(columns []string) ([]interface{}, int, error)

func (DefaultTableModel) OrderBys

func (d DefaultTableModel) OrderBys() []OrderBy

func (DefaultTableModel) Page

func (d DefaultTableModel) Page() Page

func (DefaultTableModel) PrimaryAuto

func (d DefaultTableModel) PrimaryAuto() bool

func (DefaultTableModel) Scan

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

func (*DefaultTableModel) SetColumns

func (d *DefaultTableModel) SetColumns(columns []string) error

func (*DefaultTableModel) SetCondition

func (d *DefaultTableModel) SetCondition(c cnds.Condition) error

func (*DefaultTableModel) SetData

func (d *DefaultTableModel) SetData(_ interface{}, valueOfData reflect.Value, isStruct bool, isPtr bool, isSlice bool)

func (*DefaultTableModel) SetOrderBys

func (d *DefaultTableModel) SetOrderBys(orders []OrderBy) error

func (*DefaultTableModel) SetPage

func (d *DefaultTableModel) SetPage(p Page) error

func (*DefaultTableModel) SetTable

func (d *DefaultTableModel) SetTable(tableName string)

func (DefaultTableModel) Table

func (d DefaultTableModel) Table() string

type EmptyScanner

type EmptyScanner struct {
	ColName string
}
var EMPTY_SCANNER *EmptyScanner = &EmptyScanner{}

func (EmptyScanner) Scan

func (e EmptyScanner) Scan(_ interface{}) error

func (EmptyScanner) Value

func (e EmptyScanner) Value() (driver.Value, error)

type GenerateSQLFunc

type GenerateSQLFunc func(model ...TableModel) []SqlProto

type IScanner

type IScanner interface {
	Value() (driver.Value, error)
	Scan(src interface{}) error
}

func GetIScannerOfColumn

func GetIScannerOfColumn(col interface{}) IScanner

type OrderBy

type OrderBy interface {
	Name() string
	Type() OrderType
}

func MakeOrderBy

func MakeOrderBy(name string, orderType OrderType) OrderBy

type OrderByImpl

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

func (OrderByImpl) Name

func (o OrderByImpl) Name() string

func (OrderByImpl) Type

func (o OrderByImpl) Type() OrderType

type OrderType

type OrderType int
const (
	Asc OrderType
	Desc
)

type Page

type Page interface {
	Page() (int, int)
}

func MakePage

func MakePage(index int, size int) Page

type PageImpl

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

func (PageImpl) Page

func (p PageImpl) Page() (int, int)

type RawTableInfo

type RawTableInfo struct {
	reflect.Type
	RawTableName string
	IsSlice      bool
	IsPtr        bool
	IsStruct     bool
}

func GetRawTableInfo

func GetRawTableInfo(v interface{}) RawTableInfo

type ScanFunc

type ScanFunc func(src interface{}) (interface{}, error)

type ScannerGenerateFunc

type ScannerGenerateFunc func(colName string, col interface{}) IScanner

type ScannerImpl

type ScannerImpl struct {
	Object driver.Value
	ScanFunc
}

func (*ScannerImpl) Scan

func (scanner *ScannerImpl) Scan(src interface{}) error

func (ScannerImpl) Value

func (scanner ScannerImpl) Value() (driver.Value, error)

type SqlFactory

type SqlFactory interface {
	GetSqlFunc(sqlType SqlType) GenerateSQLFunc
	ConditionToSql(condition cnds.Condition) (string, []interface{})
}

type SqlProto

type SqlProto struct {
	PreparedSql string
	Data        []interface{}
}

type SqlType

type SqlType int
const (
	Query SqlType
	Insert
	Update
	Delete
)

type TableModel

type TableModel interface {
	Table() string
	SetTable(tableName string)
	Columns() []string
	SetColumns([]string) error
	SetData(data interface{}, valueOfData reflect.Value, isStruct bool, isPtr bool, isSlice bool)
	GetScanners(columns []string) ([]interface{}, int, error)
	PrimaryAuto() bool
	ColumnDataMap() map[string]interface{}
	Condition() cnds.Condition
	SetCondition(c cnds.Condition) error
	OrderBys() []OrderBy
	SetOrderBys(orders []OrderBy) error
	Page() Page
	SetPage(p Page) error
	Scan(rows *sql.Rows) (interface{}, error)
	Clone() TableModel
}

func GetTableModel

func GetTableModel(v interface{}, choosedColumns ...string) (TableModel, error)

Jump to

Keyboard shortcuts

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