From 8a4277f0ebd010ee07186d5f1b4f7131bac5a575 Mon Sep 17 00:00:00 2001 From: zhenghaorong Date: Sat, 20 Aug 2022 14:50:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=86=E7=BB=84=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chain.go | 16 ++++++++-------- db.go | 12 ++++++------ transaction_chain.go | 12 ++++++------ 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/chain.go b/chain.go index 6b216ce..4b1de90 100644 --- a/chain.go +++ b/chain.go @@ -24,7 +24,7 @@ type Query struct { data []string value []interface{} orderby string - gruopby string + groupby string page int page_size int stmt *sql.Stmt @@ -93,8 +93,8 @@ func (this *Query) Orderby(orderby string) *Query { this.orderby = orderby return this } -func (this *Query) Gruopby(gruopby string) *Query { - this.gruopby = gruopby +func (this *Query) Groupby(groupby string) *Query { + this.groupby = groupby return this } func (this *Query) Where(where string) *Query { @@ -148,7 +148,7 @@ func (this *Query) Clean() *Query { this.data = this.data[0:0] this.value = this.value[0:0] this.orderby = "" - this.gruopby = "" + this.groupby = "" this.page = 0 this.page_size = 0 return this @@ -205,8 +205,8 @@ func (this *Query) QueryStmt() error { sql = helper.StringJoin(sql, strings.Join(this.where_or, " or ")) } } - if this.gruopby != "" { - sql = helper.StringJoin(sql, " gruop by ", this.gruopby) + if this.groupby != "" { + sql = helper.StringJoin(sql, " group by ", this.groupby) } if this.orderby != "" { @@ -400,7 +400,7 @@ 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.gruopby, this.page, this.page_size, this.debug) + this.where, this.where_or, this.value, this.orderby, this.groupby, this.page, this.page_size, this.debug) return rows, err } @@ -431,7 +431,7 @@ func (this *Query) List() ([]map[string]string, error) { func (this *Query) Find() (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.gruopby, this.debug) + this.where, this.where_or, this.value, this.orderby, this.groupby, this.debug) return row, err } diff --git a/db.go b/db.go index af39478..2daa252 100644 --- a/db.go +++ b/db.go @@ -284,7 +284,7 @@ func GetData(dbName, table string, title string, where map[string]string, limit * @param dbName 数据表名 * @param title 查询字段名 */ -func GetRow(dbName, table_name, alias string, titles string, join [][]string, where, where_or []string, valueList []interface{}, orderby, gruopby string, debug bool) (int, map[string]string, error) { +func GetRow(dbName, table_name, alias string, titles string, join [][]string, where, where_or []string, valueList []interface{}, orderby, groupby string, debug bool) (int, map[string]string, error) { var count int = 0 info := make(map[string]string) @@ -334,8 +334,8 @@ func GetRow(dbName, table_name, alias string, titles string, join [][]string, wh sql_str = helper.StringJoin(sql_str, strings.Join(where_or, " or ")) } } - if gruopby != "" { - sql_str = helper.StringJoin(sql_str, " gruop by ", gruopby) + if groupby != "" { + sql_str = helper.StringJoin(sql_str, " group by ", groupby) } if orderby != "" { sql_str = helper.StringJoin(sql_str, " order by ", orderby) @@ -424,7 +424,7 @@ func GetRow(dbName, table_name, alias string, titles string, join [][]string, wh * @param dbName 数据表名 * @param title 查询字段名 */ -func FetchRows(dbName, table_name, alias string, titles string, join [][]string, where, where_or []string, valueList []interface{}, orderby, gruopby string, page int, page_size int, debug bool) (int, []map[string]string, error) { +func FetchRows(dbName, table_name, alias string, titles string, join [][]string, where, where_or []string, valueList []interface{}, orderby, groupby string, page int, page_size int, debug bool) (int, []map[string]string, error) { var count int = 0 list := make([]map[string]string, 0) @@ -475,8 +475,8 @@ func FetchRows(dbName, table_name, alias string, titles string, join [][]string, sql_str = helper.StringJoin(sql_str, strings.Join(where_or, " or ")) } } - if gruopby != "" { - sql_str = helper.StringJoin(sql_str, " gruop by ", gruopby) + if groupby != "" { + sql_str = helper.StringJoin(sql_str, " group by ", groupby) } if orderby != "" { sql_str = helper.StringJoin(sql_str, " order by ", orderby) diff --git a/transaction_chain.go b/transaction_chain.go index 97f01a0..7c6689d 100644 --- a/transaction_chain.go +++ b/transaction_chain.go @@ -24,7 +24,7 @@ type TxQuery struct { data []string value []interface{} orderby string - gruopby string + groupby string page int page_size int stmt *sql.Stmt @@ -94,8 +94,8 @@ func (this *TxQuery) Orderby(orderby string) *TxQuery { this.orderby = orderby return this } -func (this *TxQuery) Gruopby(gruopby string) *TxQuery { - this.gruopby = gruopby +func (this *TxQuery) Groupby(groupby string) *TxQuery { + this.groupby = groupby return this } @@ -149,7 +149,7 @@ func (this *TxQuery) Clean() *TxQuery { this.data = this.data[0:0] this.value = this.value[0:0] this.orderby = "" - this.gruopby = "" + this.groupby = "" this.page = 0 this.page_size = 0 return this @@ -204,8 +204,8 @@ func (this *TxQuery) QueryStmt() error { sql = helper.StringJoin(sql, strings.Join(this.where_or, " or ")) } } - if this.gruopby != "" { - sql = helper.StringJoin(sql, " gruop by ", this.gruopby) + if this.groupby != "" { + sql = helper.StringJoin(sql, " group by ", this.groupby) } if this.orderby != "" {