Browse Source

交换Find、Get方法,交换Select、List方法

master v0.7.0
guzeng 2 years ago
parent
commit
c565655527
1 changed files with 20 additions and 20 deletions
  1. +20
    -20
      chain.go

+ 20
- 20
chain.go View File

@ -390,6 +390,19 @@ func (this *Query) DeleteStmt() error {
*/
func (this *Query) Select() ([]map[string]string, error) {
_, rows, err := FetchRows(this.dbname, this.table, this.alias, this.title, this.join,
this.where, this.where_or, this.value, this.orderby, this.page, this.page_size, this.debug)
return rows, err
}
/**
* 执行查询多条数据
* return row error
* 2022/01/05
*/
func (this *Query) List() ([]map[string]string, error) {
err := this.QueryStmt()
if err != nil {
return []map[string]string{}, err
@ -403,23 +416,23 @@ func (this *Query) Select() ([]map[string]string, error) {
}
/**
* 执行查询条数据
* 执行查询条数据
* return row error
* 2022/01/05
*/
func (this *Query) List() ([]map[string]string, error) {
func (this *Query) Find() (map[string]string, error) {
_, rows, err := FetchRows(this.dbname, this.table, this.alias, this.title, this.join,
this.where, this.where_or, this.value, this.orderby, this.page, this.page_size, this.debug)
_, row, err := GetRow(this.dbname, this.table, this.alias, this.title, this.join,
this.where, this.where_or, this.value, this.orderby, this.debug)
return rows, err
return row, err
}
/**
* 执行查询一条数据
* return row error
* 2022/01/05
*/
func (this *Query) Find() (map[string]string, error) {
func (this *Query) Get() (map[string]string, error) {
this.page = 1
this.page_size = 1
err := this.QueryStmt()
@ -433,19 +446,6 @@ func (this *Query) Find() (map[string]string, error) {
return StmtForQueryRow(this.stmt, this.value)
}
/**
* 执行查询一条数据
* return row error
* 2022/01/05
*/
func (this *Query) Get() (map[string]string, error) {
_, row, err := GetRow(this.dbname, this.table, this.alias, this.title, this.join,
this.where, this.where_or, this.value, this.orderby, this.debug)
return row, err
}
/**
* 执行更新
* return is_updated error


Loading…
Cancel
Save