From 51af81d925ee048706375c5c41712098ac4cbef4 Mon Sep 17 00:00:00 2001 From: lj-wsdj <1134294381@qq.com> Date: Sat, 10 Aug 2024 11:39:59 +0800 Subject: [PATCH] fix --- db/add_sql.go | 8 ++++---- db/db.go | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/db/add_sql.go b/db/add_sql.go index 6f3218b..8ec659b 100644 --- a/db/add_sql.go +++ b/db/add_sql.go @@ -24,8 +24,8 @@ func (s *SqlBuilder[T]) Conditions(cond string, args ...interface{}) { } else { cond, args = dealInCondition(cond, args) } - s.Opts.conditions = append(s.Opts.conditions, cond) - s.Opts.args = append(s.Opts.args, args...) + s.Opts.Conditions = append(s.Opts.Conditions, cond) + s.Opts.Args = append(s.Opts.Args, args...) s.buildCondition(util.ConditionPlaceholder, cond) } @@ -38,8 +38,8 @@ func (s *SqlBuilder[T]) InsertConditions(symbol string, cond string, args ...int } else { cond, args = dealInCondition(cond, args) } - s.Opts.conditions = append(s.Opts.conditions, cond) - s.Opts.args = append(s.Opts.args, args...) + s.Opts.Conditions = append(s.Opts.Conditions, cond) + s.Opts.Args = append(s.Opts.Args, args...) s.buildCondition(symbol, cond) } diff --git a/db/db.go b/db/db.go index 983dce5..3d6d1cb 100644 --- a/db/db.go +++ b/db/db.go @@ -25,8 +25,8 @@ type SqlBuilder[T tydb.QOneRowRst | tytaos.QOneRowRst | tyoracle.QOneRowRst | in type Options struct { util.Page selects []string - conditions []string - args []interface{} // condition的参数 + Conditions []string + Args []interface{} // condition的参数 groups []string orders []string partitions []string // tdengine专用 @@ -55,12 +55,12 @@ func (s *SqlBuilder[T]) SetDriver(driver string) { func (s *SqlBuilder[T]) FindBySql(data interface{}) error { sqls := s.buildSql() - return s.Connector.QueryEx(sqls, data, s.Opts.args...) + return s.Connector.QueryEx(sqls, data, s.Opts.Args...) } func (s *SqlBuilder[T]) FindOneBySql(data interface{}) error { sqls := s.buildSql() - err, _ := s.Connector.QueryRow(sqls, data, s.Opts.args...) + err, _ := s.Connector.QueryRow(sqls, data, s.Opts.Args...) return err } @@ -71,11 +71,11 @@ func (s *SqlBuilder[T]) PaginateBySql(data interface{}, page util.Page) error { sqls := s.buildSql() count_sql := s.buildCountSql(sqls) paginage_sql := s.buildPaginateSql(sqls) - err, _ = s.Connector.QueryRow(count_sql, &total, s.Opts.args...) + err, _ = s.Connector.QueryRow(count_sql, &total, s.Opts.Args...) if err != nil { return err } s.Opts.Page.SetTotal(total) - err = s.Connector.QueryEx(paginage_sql, data, s.Opts.args...) + err = s.Connector.QueryEx(paginage_sql, data, s.Opts.Args...) return err }