Documentation ¶
Index ¶
- Constants
- func CommaPaginator(page int, listRow int, total int) map[string]int
- func PagenationParse(page int, limitRow int) string
- func PagenationStart(page int, limitRow int) int
- func QueryBuild(querySql string, currPage int, listRows int, usePage bool) string
- func QueryTotalBuild(tableName string, otherCondi string, alias string) string
- type XormHelper
- func (xormhelper *XormHelper) ConditionBuild(condi map[string]map[string]interface{}) string
- func (xormhelper *XormHelper) ConditionJoin(join [][]string) string
- func (xormhelper *XormHelper) EditRow(table string, condi string, params map[string]interface{}) int
- func (xormhelper *XormHelper) GetByPo(po interface{}, table string, condi string) interface{}
- func (xormhelper *XormHelper) GetDatasource() *xorm.Engine
- func (xormhelper *XormHelper) GetLists(po interface{}, table string, fields string, pk string, alias string, ...) map[string]interface{}
- func (xormhelper *XormHelper) GetPageLists(po interface{}, table string, fields string, pk string, alias string, ...) map[string]interface{}
- func (xormhelper *XormHelper) InsertRow(table string, params map[string]interface{}) (int, bool)
- func (xormhelper *XormHelper) SetDatasource(datasource *xorm.Engine)
- func (xormhelper *XormHelper) StartTransaction() *xorm.Session
Constants ¶
const ( ListRow = 15 LIST_ROWS = 15 TOTAL_PAGE_FIELD = "total_page" //总页数 PAGE_FIELD = "page" //当前页 ROWS_FIELD = "rows" //每页显示数据 TOTAL_RECORD_FIELD = "total_record" //总数据 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type XormHelper ¶
type XormHelper struct {
Datasource *xorm.Engine
}
*
Struct XormHelper author : Bill
func (*XormHelper) ConditionBuild ¶
func (xormhelper *XormHelper) ConditionBuild(condi map[string]map[string]interface{}) string
* SqlBuildConditon : Test Demo var condi = make(map[string]map[string]interface{}) var inCodi = make(map[string]interface{}) var like = make(map[string]interface{}) var null = make(map[string]interface{}) // null var or = make(map[string]interface{},0)
orCondi["condi"] = fmt.Sprintf("bc.status = %d",0) nullCondi["bc.cv_id"] = nil like["name"] = "Bill" inCodi["type"] = 1 inCodi["title"] = "young" condi["AND"] = inCodi condi["LIKE"] = like condi["OR"] = or condi["NULL"] = null fmt.Print(ConditionBuild(condi)) Condition Builder author : Bill
func (*XormHelper) ConditionJoin ¶
func (xormhelper *XormHelper) ConditionJoin(join [][]string) string
* Test Demo
var data = [][]string{ {"INNER","b b","b.id = a.id"}, {"INNER","c c","c.id = b.id"}, }
var base = &DaoBase{} fmt.Print(base.ConditionJoin(data))
Join Builder author : Bill
func (*XormHelper) EditRow ¶
func (xormhelper *XormHelper) EditRow(table string, condi string, params map[string]interface{}) int
* Editor Rows && Return effect rows
func (*XormHelper) GetByPo ¶
func (xormhelper *XormHelper) GetByPo(po interface{}, table string, condi string) interface{}
* find by po Struct
func (*XormHelper) GetDatasource ¶
func (xormhelper *XormHelper) GetDatasource() *xorm.Engine
* GetDatasource
func (*XormHelper) GetLists ¶
func (xormhelper *XormHelper) GetLists(po interface{}, table string, fields string, pk string, alias string, join string, condition string, order string, group string) map[string]interface{}
* List to po
func (*XormHelper) GetPageLists ¶
func (xormhelper *XormHelper) GetPageLists(po interface{}, table string, fields string, pk string, alias string, join string, condition string, order string, group string, page int, listRow int) map[string]interface{}
* PageList to po
func (*XormHelper) InsertRow ¶
func (xormhelper *XormHelper) InsertRow(table string, params map[string]interface{}) (int, bool)
* Insert row && Return new InsertId
func (*XormHelper) SetDatasource ¶
func (xormhelper *XormHelper) SetDatasource(datasource *xorm.Engine)
* SetDatasource
func (*XormHelper) StartTransaction ¶
func (xormhelper *XormHelper) StartTransaction() *xorm.Session
Get Trans Stat