diff --git a/chain.go b/chain.go index ce9bf02..3a7531b 100644 --- a/chain.go +++ b/chain.go @@ -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