CoreSQLFrom

package
v5.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FieldsFrom

type FieldsFrom struct {
	System string `db:"system" json:"system" check:"system" empty:"true"`
	ID     int64  `db:"id" json:"id" check:"id" empty:"true"`
	Mark   string `db:"mark" json:"mark" check:"mark" empty:"true"`
	Name   string `db:"name" json:"name" check:"name" empty:"true"`
}

FieldsFrom 来源设计

func (*FieldsFrom) CheckEg

func (t *FieldsFrom) CheckEg(b FieldsFrom) bool

CheckEg 检查两个数据是否相同?

func (*FieldsFrom) GetFromOne

func (t *FieldsFrom) GetFromOne(db *sqlx.DB, tableName string, fields string, fieldName string, data interface{}) (err error)

GetFromOne 直接sql db数据 可用于获取唯一的来源结构体时

func (*FieldsFrom) GetList

func (t *FieldsFrom) GetList(fieldName string, fieldMark string, maps map[string]interface{}) (query string, newMap map[string]interface{}, err error)

GetList 获取列表组合专用 自动判断是否存在参数,如果不存在则反馈原数据,否则写入需要的参数集合

func (*FieldsFrom) GetListAnd

func (t *FieldsFrom) GetListAnd(fieldName string, fieldMark string, query string, maps map[string]interface{}) (newQuery string, newMap map[string]interface{}, err error)

GetListAnd 获取列表,自动束缚为AND连接 该方法主要为节约代码,上述getList获取数据后,还需要做多种判断,本方法将这些判断整合在一起 * 正常语句应该做如下事情,本方法将尽可能完成以下内容,自动完成AND的处理 var newWhere string newWhere, maps, err = CoreSQLFrom.JSONB.GetList("payment_create", "payment_create", args.PaymentCreate, maps)

if err != nil {
	return
} else {
	if newWhere != "" {
		where = where + " AND " + newWhere
	}
}

func (*FieldsFrom) GetMaps

func (t *FieldsFrom) GetMaps(fieldMark string, maps map[string]interface{}) (newMaps map[string]interface{}, err error)

GetMaps 获取maps组合数据包

func (FieldsFrom) GetRaw

func (t FieldsFrom) GetRaw() (data string, err error)

GetRaw 直接获取json处理后的筛选数据

func (FieldsFrom) GetRawNoName

func (t FieldsFrom) GetRawNoName() (data string, err error)

GetRawNoName 获取json不带name的结构 mark=*,将自动忽略该参数

func (*FieldsFrom) GetSQL

func (t *FieldsFrom) GetSQL(fieldName string, fieldMark string, maps map[string]interface{}) (query string, newMaps map[string]interface{}, err error)

GetSQL 获取sql语句带maps数据包

func (FieldsFrom) GetString

func (t FieldsFrom) GetString() string

GetString 直接获取json处理后的筛选数据

func (*FieldsFrom) Scan

func (t *FieldsFrom) Scan(value interface{}) error

func (FieldsFrom) Value

func (t FieldsFrom) Value() (driver.Value, error)

Value sql底层处理器

type FieldsFromOnlyID

type FieldsFromOnlyID struct {
	System string `db:"system" json:"system" check:"system" empty:"true"`
	ID     int64  `db:"id" json:"id" check:"id" empty:"true"`
}

FieldsFromOnlyID 简约设计,方便检索

func (*FieldsFromOnlyID) Scan

func (t *FieldsFromOnlyID) Scan(value interface{}) error

func (FieldsFromOnlyID) Value

func (t FieldsFromOnlyID) Value() (driver.Value, error)

Value sql底层处理器

Jump to

Keyboard shortcuts

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