From cd044493c756145123ea49564f54284587d49d0e Mon Sep 17 00:00:00 2001 From: qqxhb <1252905006@qq.com> Date: Wed, 15 Jan 2025 21:52:28 +0800 Subject: [PATCH] feat: test --- tests/.expect/dal_3/query/banks.gen.go | 2 +- tests/.expect/dal_7/query/gen.go | 22 ++++++++++----------- tests/.expect/dal_7/query/users.gen.go | 11 +++-------- tests/.expect/dal_7/query/users.gen_test.go | 2 +- 4 files changed, 16 insertions(+), 21 deletions(-) diff --git a/tests/.expect/dal_3/query/banks.gen.go b/tests/.expect/dal_3/query/banks.gen.go index 1265fefb..c644b19a 100644 --- a/tests/.expect/dal_3/query/banks.gen.go +++ b/tests/.expect/dal_3/query/banks.gen.go @@ -400,4 +400,4 @@ func (b bankDo) Delete(models ...*model.Bank) (result gen.ResultInfo, err error) func (b *bankDo) withDO(do gen.Dao) *bankDo { b.DO = *do.(*gen.DO) return b -} \ No newline at end of file +} diff --git a/tests/.expect/dal_7/query/gen.go b/tests/.expect/dal_7/query/gen.go index a28c0343..a19d931b 100644 --- a/tests/.expect/dal_7/query/gen.go +++ b/tests/.expect/dal_7/query/gen.go @@ -16,8 +16,8 @@ import ( ) var ( - Q = new(Query) - User *user + Q = new(Query) + User *user ) func SetDefault(db *gorm.DB, opts ...gen.DOOption) { @@ -27,23 +27,23 @@ func SetDefault(db *gorm.DB, opts ...gen.DOOption) { func Use(db *gorm.DB, opts ...gen.DOOption) *Query { return &Query{ - db: db, - User: newUser(db, opts...), + db: db, + User: newUser(db, opts...), } } type Query struct { db *gorm.DB - User user + User user } func (q *Query) Available() bool { return q.db != nil } func (q *Query) clone(db *gorm.DB) *Query { return &Query{ - db: db, - User: q.User.clone(db), + db: db, + User: q.User.clone(db), } } @@ -57,18 +57,18 @@ func (q *Query) WriteDB() *Query { func (q *Query) ReplaceDB(db *gorm.DB) *Query { return &Query{ - db: db, - User: q.User.replaceDB(db), + db: db, + User: q.User.replaceDB(db), } } type queryCtx struct { - User IUserDo + User IUserDo } func (q *Query) WithContext(ctx context.Context) *queryCtx { return &queryCtx{ - User: q.User.WithContext(ctx), + User: q.User.WithContext(ctx), } } diff --git a/tests/.expect/dal_7/query/users.gen.go b/tests/.expect/dal_7/query/users.gen.go index d5b44843..46f8c75a 100644 --- a/tests/.expect/dal_7/query/users.gen.go +++ b/tests/.expect/dal_7/query/users.gen.go @@ -9,17 +9,12 @@ import ( "database/sql" "strings" - "gorm.io/gorm" - "gorm.io/gorm/clause" - "gorm.io/gorm/schema" - "gorm.io/gen" "gorm.io/gen/field" "gorm.io/gen/helper" + "gorm.io/gorm" - "gorm.io/plugin/dbresolver" - - "gorm.io/gen/tests/.gen/dal_4/model" + "gorm.io/gen/tests/.gen/dal_7/model" "time" ) @@ -909,4 +904,4 @@ func (u userDo) ColumnSearch(name string, names []string) (result []*model.User) _ = executeSQL return -} \ No newline at end of file +} diff --git a/tests/.expect/dal_7/query/users.gen_test.go b/tests/.expect/dal_7/query/users.gen_test.go index 2c9a7c44..cfe8b158 100644 --- a/tests/.expect/dal_7/query/users.gen_test.go +++ b/tests/.expect/dal_7/query/users.gen_test.go @@ -13,7 +13,7 @@ import ( "gorm.io/gen" "gorm.io/gen/field" - "gorm.io/gen/tests/.gen/dal_4/model" + "gorm.io/gen/tests/.gen/dal_7/model" "gorm.io/gorm/clause" )