Files
aorm/executor/model.go
2022-12-21 21:47:01 +08:00

53 lines
1.1 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package executor
import "database/sql"
// LinkCommon database/sql提供的库连接与事务二者有很多方法是一致的为了通用抽象为该interface
type LinkCommon interface {
Exec(query string, args ...interface{}) (sql.Result, error)
Prepare(query string) (*sql.Stmt, error)
Query(query string, args ...interface{}) (*sql.Rows, error)
QueryRow(query string, args ...interface{}) *sql.Row
}
// ExpItem 将某子语句重命名为某字段
type ExpItem struct {
Executor **Executor
FieldName string
}
// Executor 查询记录所需要的条件
type Executor struct {
//数据库操作连接
LinkCommon LinkCommon
//查询参数
tableName string
selectList []string
selectExpList []*ExpItem
groupList []string
whereList []WhereItem
joinList []string
havingList []WhereItem
orderList []string
offset int
pageSize int
isDebug bool
isLockForUpdate bool
//sql与参数
sql string
paramList []interface{}
//表属性
opinionList []OpinionItem
//驱动名字
driverName string
}
type OpinionItem struct {
Key string
Val string
}