From 7d6112539294c6fb0e6699c6bf25af596588f173 Mon Sep 17 00:00:00 2001 From: houseme Date: Thu, 5 Dec 2024 11:41:43 +0800 Subject: [PATCH 1/7] improve dao `group` comment --- cmd/gf/internal/consts/consts_gen_dao_template_dao.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/gf/internal/consts/consts_gen_dao_template_dao.go b/cmd/gf/internal/consts/consts_gen_dao_template_dao.go index 5af47e4931f..654f6e2a151 100644 --- a/cmd/gf/internal/consts/consts_gen_dao_template_dao.go +++ b/cmd/gf/internal/consts/consts_gen_dao_template_dao.go @@ -92,7 +92,7 @@ func (dao *{TplTableNameCamelCase}Dao) Columns() {TplTableNameCamelCase}Columns return dao.columns } -// Group returns the configuration group name of database of current dao. +// Group returns the database configuration group name of the current dao. func (dao *{TplTableNameCamelCase}Dao) Group() string { return dao.group } From 4cbc818feb4ac0404e1b82f68fa8011f16cfa362 Mon Sep 17 00:00:00 2001 From: houseme Date: Thu, 5 Dec 2024 12:16:57 +0800 Subject: [PATCH 2/7] improve comment --- .../consts/consts_gen_dao_template_dao.go | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/cmd/gf/internal/consts/consts_gen_dao_template_dao.go b/cmd/gf/internal/consts/consts_gen_dao_template_dao.go index 654f6e2a151..f4d11db33a3 100644 --- a/cmd/gf/internal/consts/consts_gen_dao_template_dao.go +++ b/cmd/gf/internal/consts/consts_gen_dao_template_dao.go @@ -17,23 +17,23 @@ import ( "{TplImportPrefix}/internal" ) -// internal{TplTableNameCamelCase}Dao is internal type for wrapping internal DAO implements. +// internal{TplTableNameCamelCase}Dao is an internal type for wrapping the internal DAO implementation. type internal{TplTableNameCamelCase}Dao = *internal.{TplTableNameCamelCase}Dao -// {TplTableNameCamelLowerCase}Dao is the data access object for table {TplTableName}. -// You can define custom methods on it to extend its functionality as you wish. +// {TplTableNameCamelLowerCase}Dao is the data access object for the table {TplTableName}. +// You can define custom methods on it to extend its functionality as needed. type {TplTableNameCamelLowerCase}Dao struct { internal{TplTableNameCamelCase}Dao } var ( - // {TplTableNameCamelCase} is globally public accessible object for table {TplTableName} operations. + // {TplTableNameCamelCase} is a globally accessible object for table {TplTableName} operations. {TplTableNameCamelCase} = {TplTableNameCamelLowerCase}Dao{ internal.New{TplTableNameCamelCase}Dao(), } ) -// Fill with you ideas below. +// Add your custom methods and functionality below. ` @@ -51,19 +51,19 @@ import ( "github.com/gogf/gf/v2/frame/g" ) -// {TplTableNameCamelCase}Dao is the data access object for table {TplTableName}. +// {TplTableNameCamelCase}Dao is the data access object for the table {TplTableName}. type {TplTableNameCamelCase}Dao struct { table string // table is the underlying table name of the DAO. - group string // group is the database configuration group name of current DAO. + group string // group is the database configuration group name of the current DAO. columns {TplTableNameCamelCase}Columns // columns contains all the column names of Table for convenient usage. } -// {TplTableNameCamelCase}Columns defines and stores column names for table {TplTableName}. +// {TplTableNameCamelCase}Columns defines and stores column names for the table {TplTableName}. type {TplTableNameCamelCase}Columns struct { {TplColumnDefine} } -// {TplTableNameCamelLowerCase}Columns holds the columns for table {TplTableName}. +// {TplTableNameCamelLowerCase}Columns holds the columns for the table {TplTableName}. var {TplTableNameCamelLowerCase}Columns = {TplTableNameCamelCase}Columns{ {TplColumnNames} } @@ -77,36 +77,36 @@ func New{TplTableNameCamelCase}Dao() *{TplTableNameCamelCase}Dao { } } -// DB retrieves and returns the underlying raw database management object of current DAO. +// DB retrieves and returns the underlying raw database management object of the current DAO. func (dao *{TplTableNameCamelCase}Dao) DB() gdb.DB { return g.DB(dao.group) } -// Table returns the table name of current dao. +// Table returns the table name of the current DAO. func (dao *{TplTableNameCamelCase}Dao) Table() string { return dao.table } -// Columns returns all column names of current dao. +// Columns returns all column names of the current DAO. func (dao *{TplTableNameCamelCase}Dao) Columns() {TplTableNameCamelCase}Columns { return dao.columns } -// Group returns the database configuration group name of the current dao. +// Group returns the database configuration group name of the current DAO. func (dao *{TplTableNameCamelCase}Dao) Group() string { return dao.group } -// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation. +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *{TplTableNameCamelCase}Dao) Ctx(ctx context.Context) *gdb.Model { return dao.DB().Model(dao.table).Safe().Ctx(ctx) } // Transaction wraps the transaction logic using function f. -// It rollbacks the transaction and returns the error from function f if it returns non-nil error. +// It rolls back the transaction and returns the error if function f returns a non-nil error. // It commits the transaction and returns nil if function f returns nil. // -// Note that, you should not Commit or Rollback the transaction in function f +// Note: Do not commit or roll back the transaction in function f, // as it is automatically handled by this function. func (dao *{TplTableNameCamelCase}Dao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { return dao.Ctx(ctx).Transaction(ctx, f) From bc65d0ff659e49fab01a5e646bddba98eb133adc Mon Sep 17 00:00:00 2001 From: houseme Date: Thu, 5 Dec 2024 12:48:49 +0800 Subject: [PATCH 3/7] improve for ci --- .github/workflows/ci-main.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-main.sh b/.github/workflows/ci-main.sh index 85078dc885e..39d094c9d8e 100644 --- a/.github/workflows/ci-main.sh +++ b/.github/workflows/ci-main.sh @@ -49,7 +49,7 @@ for file in `find . -name go.mod`; do # package example needs golang >= v1.20 if [ "example" = $(basename $dirpath) ]; then - if ! go version|grep -qE "go1.[2-9][0-9]"; then + if ! go version|grep -qE "go1.[2-9][1-9]"; then echo "ignore example as go version: $(go version)" continue 1 fi From 9075c970b464929dc74520a3dafaa2d3719c3ffb Mon Sep 17 00:00:00 2001 From: houseme Date: Thu, 5 Dec 2024 13:29:57 +0800 Subject: [PATCH 4/7] upgrade protocol version 29.x --- .github/workflows/ci-main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-main.yml b/.github/workflows/ci-main.yml index 8daf6bf2ea0..c5c73440092 100644 --- a/.github/workflows/ci-main.yml +++ b/.github/workflows/ci-main.yml @@ -225,7 +225,7 @@ jobs: - name: Install Protoc uses: arduino/setup-protoc@v2 with: - version: "23.x" + version: "29.x" repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Install the protocol compiler plugins for Go From 68daef66f6e2def151ecd4b7f3d1c90cedcb214b Mon Sep 17 00:00:00 2001 From: houseme Date: Thu, 5 Dec 2024 16:19:57 +0800 Subject: [PATCH 5/7] improve code --- .../generated_user/dao/internal/table_user.go | 22 +++++++++---------- .../gendao/generated_user/dao/table_user.go | 12 +++++----- .../dao/internal/table_user.go | 22 +++++++++---------- .../dao/table_user.go | 12 +++++----- .../dao/internal/table_user.go | 22 +++++++++---------- .../generated_user_sqlite3/dao/table_user.go | 12 +++++----- .../dao/internal/table_user.go | 22 +++++++++---------- .../dao/table_user.go | 12 +++++----- .../internal/cmd/testdata/gendao/go.mod.txt | 10 ++++----- .../consts/consts_gen_dao_template_dao.go | 2 +- 10 files changed, 74 insertions(+), 74 deletions(-) diff --git a/cmd/gf/internal/cmd/testdata/gendao/generated_user/dao/internal/table_user.go b/cmd/gf/internal/cmd/testdata/gendao/generated_user/dao/internal/table_user.go index f883408e46e..68d96fb0619 100644 --- a/cmd/gf/internal/cmd/testdata/gendao/generated_user/dao/internal/table_user.go +++ b/cmd/gf/internal/cmd/testdata/gendao/generated_user/dao/internal/table_user.go @@ -11,14 +11,14 @@ import ( "github.com/gogf/gf/v2/frame/g" ) -// TableUserDao is the data access object for table table_user. +// TableUserDao is the data access object for the table table_user. type TableUserDao struct { table string // table is the underlying table name of the DAO. - group string // group is the database configuration group name of current DAO. + group string // group is the database configuration group name of the current DAO. columns TableUserColumns // columns contains all the column names of Table for convenient usage. } -// TableUserColumns defines and stores column names for table table_user. +// TableUserColumns defines and stores column names for the table table_user. type TableUserColumns struct { Id string // User ID Passport string // User Passport @@ -29,7 +29,7 @@ type TableUserColumns struct { UpdateAt string // Updated Time } -// tableUserColumns holds the columns for table table_user. +// tableUserColumns holds the columns for the table table_user. var tableUserColumns = TableUserColumns{ Id: "id", Passport: "passport", @@ -49,36 +49,36 @@ func NewTableUserDao() *TableUserDao { } } -// DB retrieves and returns the underlying raw database management object of current DAO. +// DB retrieves and returns the underlying raw database management object of the current DAO. func (dao *TableUserDao) DB() gdb.DB { return g.DB(dao.group) } -// Table returns the table name of current dao. +// Table returns the table name of the current DAO. func (dao *TableUserDao) Table() string { return dao.table } -// Columns returns all column names of current dao. +// Columns returns all column names of the current DAO. func (dao *TableUserDao) Columns() TableUserColumns { return dao.columns } -// Group returns the configuration group name of database of current dao. +// Group returns the database configuration group name of the current DAO. func (dao *TableUserDao) Group() string { return dao.group } -// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation. +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *TableUserDao) Ctx(ctx context.Context) *gdb.Model { return dao.DB().Model(dao.table).Safe().Ctx(ctx) } // Transaction wraps the transaction logic using function f. -// It rollbacks the transaction and returns the error from function f if it returns non-nil error. +// It rolls back the transaction and returns the error if function f returns a non-nil error. // It commits the transaction and returns nil if function f returns nil. // -// Note that, you should not Commit or Rollback the transaction in function f +// Note: Do not commit or roll back the transaction in function f, // as it is automatically handled by this function. func (dao *TableUserDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { return dao.Ctx(ctx).Transaction(ctx, f) diff --git a/cmd/gf/internal/cmd/testdata/gendao/generated_user/dao/table_user.go b/cmd/gf/internal/cmd/testdata/gendao/generated_user/dao/table_user.go index 9bc9cff6f7d..28d2d47973d 100644 --- a/cmd/gf/internal/cmd/testdata/gendao/generated_user/dao/table_user.go +++ b/cmd/gf/internal/cmd/testdata/gendao/generated_user/dao/table_user.go @@ -1,5 +1,5 @@ // ================================================================================= -// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. // ================================================================================= package dao @@ -8,20 +8,20 @@ import ( "for-gendao-test/pkg/dao/internal" ) -// internalTableUserDao is internal type for wrapping internal DAO implements. +// internalTableUserDao is an internal type for wrapping the internal DAO implementation. type internalTableUserDao = *internal.TableUserDao -// tableUserDao is the data access object for table table_user. -// You can define custom methods on it to extend its functionality as you wish. +// tableUserDao is the data access object for the table table_user. +// You can define custom methods on it to extend its functionality as needed. type tableUserDao struct { internalTableUserDao } var ( - // TableUser is globally public accessible object for table table_user operations. + // TableUser is a globally accessible object for table table_user operations. TableUser = tableUserDao{ internal.NewTableUserDao(), } ) -// Fill with you ideas below. +// Add your custom methods and functionality below. diff --git a/cmd/gf/internal/cmd/testdata/gendao/generated_user_field_mapping/dao/internal/table_user.go b/cmd/gf/internal/cmd/testdata/gendao/generated_user_field_mapping/dao/internal/table_user.go index f883408e46e..68d96fb0619 100644 --- a/cmd/gf/internal/cmd/testdata/gendao/generated_user_field_mapping/dao/internal/table_user.go +++ b/cmd/gf/internal/cmd/testdata/gendao/generated_user_field_mapping/dao/internal/table_user.go @@ -11,14 +11,14 @@ import ( "github.com/gogf/gf/v2/frame/g" ) -// TableUserDao is the data access object for table table_user. +// TableUserDao is the data access object for the table table_user. type TableUserDao struct { table string // table is the underlying table name of the DAO. - group string // group is the database configuration group name of current DAO. + group string // group is the database configuration group name of the current DAO. columns TableUserColumns // columns contains all the column names of Table for convenient usage. } -// TableUserColumns defines and stores column names for table table_user. +// TableUserColumns defines and stores column names for the table table_user. type TableUserColumns struct { Id string // User ID Passport string // User Passport @@ -29,7 +29,7 @@ type TableUserColumns struct { UpdateAt string // Updated Time } -// tableUserColumns holds the columns for table table_user. +// tableUserColumns holds the columns for the table table_user. var tableUserColumns = TableUserColumns{ Id: "id", Passport: "passport", @@ -49,36 +49,36 @@ func NewTableUserDao() *TableUserDao { } } -// DB retrieves and returns the underlying raw database management object of current DAO. +// DB retrieves and returns the underlying raw database management object of the current DAO. func (dao *TableUserDao) DB() gdb.DB { return g.DB(dao.group) } -// Table returns the table name of current dao. +// Table returns the table name of the current DAO. func (dao *TableUserDao) Table() string { return dao.table } -// Columns returns all column names of current dao. +// Columns returns all column names of the current DAO. func (dao *TableUserDao) Columns() TableUserColumns { return dao.columns } -// Group returns the configuration group name of database of current dao. +// Group returns the database configuration group name of the current DAO. func (dao *TableUserDao) Group() string { return dao.group } -// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation. +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *TableUserDao) Ctx(ctx context.Context) *gdb.Model { return dao.DB().Model(dao.table).Safe().Ctx(ctx) } // Transaction wraps the transaction logic using function f. -// It rollbacks the transaction and returns the error from function f if it returns non-nil error. +// It rolls back the transaction and returns the error if function f returns a non-nil error. // It commits the transaction and returns nil if function f returns nil. // -// Note that, you should not Commit or Rollback the transaction in function f +// Note: Do not commit or roll back the transaction in function f, // as it is automatically handled by this function. func (dao *TableUserDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { return dao.Ctx(ctx).Transaction(ctx, f) diff --git a/cmd/gf/internal/cmd/testdata/gendao/generated_user_field_mapping/dao/table_user.go b/cmd/gf/internal/cmd/testdata/gendao/generated_user_field_mapping/dao/table_user.go index 9bc9cff6f7d..28d2d47973d 100644 --- a/cmd/gf/internal/cmd/testdata/gendao/generated_user_field_mapping/dao/table_user.go +++ b/cmd/gf/internal/cmd/testdata/gendao/generated_user_field_mapping/dao/table_user.go @@ -1,5 +1,5 @@ // ================================================================================= -// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. // ================================================================================= package dao @@ -8,20 +8,20 @@ import ( "for-gendao-test/pkg/dao/internal" ) -// internalTableUserDao is internal type for wrapping internal DAO implements. +// internalTableUserDao is an internal type for wrapping the internal DAO implementation. type internalTableUserDao = *internal.TableUserDao -// tableUserDao is the data access object for table table_user. -// You can define custom methods on it to extend its functionality as you wish. +// tableUserDao is the data access object for the table table_user. +// You can define custom methods on it to extend its functionality as needed. type tableUserDao struct { internalTableUserDao } var ( - // TableUser is globally public accessible object for table table_user operations. + // TableUser is a globally accessible object for table table_user operations. TableUser = tableUserDao{ internal.NewTableUserDao(), } ) -// Fill with you ideas below. +// Add your custom methods and functionality below. diff --git a/cmd/gf/internal/cmd/testdata/gendao/generated_user_sqlite3/dao/internal/table_user.go b/cmd/gf/internal/cmd/testdata/gendao/generated_user_sqlite3/dao/internal/table_user.go index 3c84716f2d6..8484c101957 100644 --- a/cmd/gf/internal/cmd/testdata/gendao/generated_user_sqlite3/dao/internal/table_user.go +++ b/cmd/gf/internal/cmd/testdata/gendao/generated_user_sqlite3/dao/internal/table_user.go @@ -11,14 +11,14 @@ import ( "github.com/gogf/gf/v2/frame/g" ) -// TableUserDao is the data access object for table table_user. +// TableUserDao is the data access object for the table table_user. type TableUserDao struct { table string // table is the underlying table name of the DAO. - group string // group is the database configuration group name of current DAO. + group string // group is the database configuration group name of the current DAO. columns TableUserColumns // columns contains all the column names of Table for convenient usage. } -// TableUserColumns defines and stores column names for table table_user. +// TableUserColumns defines and stores column names for the table table_user. type TableUserColumns struct { Id string // Passport string // @@ -28,7 +28,7 @@ type TableUserColumns struct { UpdatedAt string // } -// tableUserColumns holds the columns for table table_user. +// tableUserColumns holds the columns for the table table_user. var tableUserColumns = TableUserColumns{ Id: "id", Passport: "passport", @@ -47,36 +47,36 @@ func NewTableUserDao() *TableUserDao { } } -// DB retrieves and returns the underlying raw database management object of current DAO. +// DB retrieves and returns the underlying raw database management object of the current DAO. func (dao *TableUserDao) DB() gdb.DB { return g.DB(dao.group) } -// Table returns the table name of current dao. +// Table returns the table name of the current DAO. func (dao *TableUserDao) Table() string { return dao.table } -// Columns returns all column names of current dao. +// Columns returns all column names of the current DAO. func (dao *TableUserDao) Columns() TableUserColumns { return dao.columns } -// Group returns the configuration group name of database of current dao. +// Group returns the database configuration group name of the current DAO. func (dao *TableUserDao) Group() string { return dao.group } -// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation. +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *TableUserDao) Ctx(ctx context.Context) *gdb.Model { return dao.DB().Model(dao.table).Safe().Ctx(ctx) } // Transaction wraps the transaction logic using function f. -// It rollbacks the transaction and returns the error from function f if it returns non-nil error. +// It rolls back the transaction and returns the error if function f returns a non-nil error. // It commits the transaction and returns nil if function f returns nil. // -// Note that, you should not Commit or Rollback the transaction in function f +// Note: Do not commit or roll back the transaction in function f, // as it is automatically handled by this function. func (dao *TableUserDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { return dao.Ctx(ctx).Transaction(ctx, f) diff --git a/cmd/gf/internal/cmd/testdata/gendao/generated_user_sqlite3/dao/table_user.go b/cmd/gf/internal/cmd/testdata/gendao/generated_user_sqlite3/dao/table_user.go index 9bc9cff6f7d..28d2d47973d 100644 --- a/cmd/gf/internal/cmd/testdata/gendao/generated_user_sqlite3/dao/table_user.go +++ b/cmd/gf/internal/cmd/testdata/gendao/generated_user_sqlite3/dao/table_user.go @@ -1,5 +1,5 @@ // ================================================================================= -// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. // ================================================================================= package dao @@ -8,20 +8,20 @@ import ( "for-gendao-test/pkg/dao/internal" ) -// internalTableUserDao is internal type for wrapping internal DAO implements. +// internalTableUserDao is an internal type for wrapping the internal DAO implementation. type internalTableUserDao = *internal.TableUserDao -// tableUserDao is the data access object for table table_user. -// You can define custom methods on it to extend its functionality as you wish. +// tableUserDao is the data access object for the table table_user. +// You can define custom methods on it to extend its functionality as needed. type tableUserDao struct { internalTableUserDao } var ( - // TableUser is globally public accessible object for table table_user operations. + // TableUser is a globally accessible object for table table_user operations. TableUser = tableUserDao{ internal.NewTableUserDao(), } ) -// Fill with you ideas below. +// Add your custom methods and functionality below. diff --git a/cmd/gf/internal/cmd/testdata/gendao/generated_user_type_mapping/dao/internal/table_user.go b/cmd/gf/internal/cmd/testdata/gendao/generated_user_type_mapping/dao/internal/table_user.go index f883408e46e..68d96fb0619 100644 --- a/cmd/gf/internal/cmd/testdata/gendao/generated_user_type_mapping/dao/internal/table_user.go +++ b/cmd/gf/internal/cmd/testdata/gendao/generated_user_type_mapping/dao/internal/table_user.go @@ -11,14 +11,14 @@ import ( "github.com/gogf/gf/v2/frame/g" ) -// TableUserDao is the data access object for table table_user. +// TableUserDao is the data access object for the table table_user. type TableUserDao struct { table string // table is the underlying table name of the DAO. - group string // group is the database configuration group name of current DAO. + group string // group is the database configuration group name of the current DAO. columns TableUserColumns // columns contains all the column names of Table for convenient usage. } -// TableUserColumns defines and stores column names for table table_user. +// TableUserColumns defines and stores column names for the table table_user. type TableUserColumns struct { Id string // User ID Passport string // User Passport @@ -29,7 +29,7 @@ type TableUserColumns struct { UpdateAt string // Updated Time } -// tableUserColumns holds the columns for table table_user. +// tableUserColumns holds the columns for the table table_user. var tableUserColumns = TableUserColumns{ Id: "id", Passport: "passport", @@ -49,36 +49,36 @@ func NewTableUserDao() *TableUserDao { } } -// DB retrieves and returns the underlying raw database management object of current DAO. +// DB retrieves and returns the underlying raw database management object of the current DAO. func (dao *TableUserDao) DB() gdb.DB { return g.DB(dao.group) } -// Table returns the table name of current dao. +// Table returns the table name of the current DAO. func (dao *TableUserDao) Table() string { return dao.table } -// Columns returns all column names of current dao. +// Columns returns all column names of the current DAO. func (dao *TableUserDao) Columns() TableUserColumns { return dao.columns } -// Group returns the configuration group name of database of current dao. +// Group returns the database configuration group name of the current DAO. func (dao *TableUserDao) Group() string { return dao.group } -// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation. +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *TableUserDao) Ctx(ctx context.Context) *gdb.Model { return dao.DB().Model(dao.table).Safe().Ctx(ctx) } // Transaction wraps the transaction logic using function f. -// It rollbacks the transaction and returns the error from function f if it returns non-nil error. +// It rolls back the transaction and returns the error if function f returns a non-nil error. // It commits the transaction and returns nil if function f returns nil. // -// Note that, you should not Commit or Rollback the transaction in function f +// Note: Do not commit or roll back the transaction in function f, // as it is automatically handled by this function. func (dao *TableUserDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { return dao.Ctx(ctx).Transaction(ctx, f) diff --git a/cmd/gf/internal/cmd/testdata/gendao/generated_user_type_mapping/dao/table_user.go b/cmd/gf/internal/cmd/testdata/gendao/generated_user_type_mapping/dao/table_user.go index 9bc9cff6f7d..28d2d47973d 100644 --- a/cmd/gf/internal/cmd/testdata/gendao/generated_user_type_mapping/dao/table_user.go +++ b/cmd/gf/internal/cmd/testdata/gendao/generated_user_type_mapping/dao/table_user.go @@ -1,5 +1,5 @@ // ================================================================================= -// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. // ================================================================================= package dao @@ -8,20 +8,20 @@ import ( "for-gendao-test/pkg/dao/internal" ) -// internalTableUserDao is internal type for wrapping internal DAO implements. +// internalTableUserDao is an internal type for wrapping the internal DAO implementation. type internalTableUserDao = *internal.TableUserDao -// tableUserDao is the data access object for table table_user. -// You can define custom methods on it to extend its functionality as you wish. +// tableUserDao is the data access object for the table table_user. +// You can define custom methods on it to extend its functionality as needed. type tableUserDao struct { internalTableUserDao } var ( - // TableUser is globally public accessible object for table table_user operations. + // TableUser is a globally accessible object for table table_user operations. TableUser = tableUserDao{ internal.NewTableUserDao(), } ) -// Fill with you ideas below. +// Add your custom methods and functionality below. diff --git a/cmd/gf/internal/cmd/testdata/gendao/go.mod.txt b/cmd/gf/internal/cmd/testdata/gendao/go.mod.txt index c1213050b56..ca87c963168 100644 --- a/cmd/gf/internal/cmd/testdata/gendao/go.mod.txt +++ b/cmd/gf/internal/cmd/testdata/gendao/go.mod.txt @@ -1,9 +1,9 @@ module for-gendao-test/pkg -go 1.18 +go 1.20 require ( - github.com/gogf/gf/v2 v2.5.3 + github.com/gogf/gf/v2 v2.8.1 github.com/shopspring/decimal v1.3.1 ) @@ -22,9 +22,9 @@ require ( github.com/mattn/go-runewidth v0.0.15 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/rivo/uniseg v0.4.4 // indirect - go.opentelemetry.io/otel v1.14.0 // indirect - go.opentelemetry.io/otel/sdk v1.14.0 // indirect - go.opentelemetry.io/otel/trace v1.14.0 // indirect + go.opentelemetry.io/otel v1.24.0 // indirect + go.opentelemetry.io/otel/sdk v1.24.0 // indirect + go.opentelemetry.io/otel/trace v1.24.0 // indirect golang.org/x/net v0.17.0 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect diff --git a/cmd/gf/internal/consts/consts_gen_dao_template_dao.go b/cmd/gf/internal/consts/consts_gen_dao_template_dao.go index f4d11db33a3..c1e20fbe770 100644 --- a/cmd/gf/internal/consts/consts_gen_dao_template_dao.go +++ b/cmd/gf/internal/consts/consts_gen_dao_template_dao.go @@ -8,7 +8,7 @@ package consts const TemplateGenDaoIndexContent = ` // ================================================================================= -// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. // ================================================================================= package {TplPackageName} From 9286191cbe58509b1a1fe031fcf856aa3dc39402 Mon Sep 17 00:00:00 2001 From: houseme Date: Thu, 5 Dec 2024 18:44:46 +0800 Subject: [PATCH 6/7] improve code comment --- .../issue/2572/dao/internal/user_3.go | 22 +++++++++---------- .../issue/2572/dao/internal/user_4.go | 22 +++++++++---------- .../cmd/testdata/issue/2572/dao/user_3.go | 12 +++++----- .../cmd/testdata/issue/2572/dao/user_4.go | 12 +++++----- .../issue/2616/dao/internal/user_1.go | 22 +++++++++---------- .../issue/2616/dao/internal/user_2.go | 22 +++++++++---------- .../issue/2616/dao/internal/user_3.go | 22 +++++++++---------- .../issue/2616/dao/internal/user_4.go | 22 +++++++++---------- .../cmd/testdata/issue/2616/dao/user_1.go | 12 +++++----- .../cmd/testdata/issue/2616/dao/user_2.go | 12 +++++----- .../cmd/testdata/issue/2616/dao/user_3.go | 12 +++++----- .../cmd/testdata/issue/2616/dao/user_4.go | 12 +++++----- .../issue/3460/controller/hello/hello.go | 2 +- .../issue/3460/controller/hello/hello_new.go | 2 +- .../issue/3749/dao/internal/table_user.go | 22 +++++++++---------- .../cmd/testdata/issue/3749/dao/table_user.go | 12 +++++----- 16 files changed, 121 insertions(+), 121 deletions(-) diff --git a/cmd/gf/internal/cmd/testdata/issue/2572/dao/internal/user_3.go b/cmd/gf/internal/cmd/testdata/issue/2572/dao/internal/user_3.go index db59440164d..58c955a88c6 100644 --- a/cmd/gf/internal/cmd/testdata/issue/2572/dao/internal/user_3.go +++ b/cmd/gf/internal/cmd/testdata/issue/2572/dao/internal/user_3.go @@ -11,14 +11,14 @@ import ( "github.com/gogf/gf/v2/frame/g" ) -// User3Dao is the data access object for table user3. +// User3Dao is the data access object for the table user3. type User3Dao struct { table string // table is the underlying table name of the DAO. - group string // group is the database configuration group name of current DAO. + group string // group is the database configuration group name of the current DAO. columns User3Columns // columns contains all the column names of Table for convenient usage. } -// User3Columns defines and stores column names for table user3. +// User3Columns defines and stores column names for the table user3. type User3Columns struct { Id string // User ID Passport string // User Passport @@ -29,7 +29,7 @@ type User3Columns struct { UpdateAt string // Updated Time } -// user3Columns holds the columns for table user3. +// user3Columns holds the columns for the table user3. var user3Columns = User3Columns{ Id: "id", Passport: "passport", @@ -49,36 +49,36 @@ func NewUser3Dao() *User3Dao { } } -// DB retrieves and returns the underlying raw database management object of current DAO. +// DB retrieves and returns the underlying raw database management object of the current DAO. func (dao *User3Dao) DB() gdb.DB { return g.DB(dao.group) } -// Table returns the table name of current dao. +// Table returns the table name of the current DAO. func (dao *User3Dao) Table() string { return dao.table } -// Columns returns all column names of current dao. +// Columns returns all column names of the current DAO. func (dao *User3Dao) Columns() User3Columns { return dao.columns } -// Group returns the configuration group name of database of current dao. +// Group returns the database configuration group name of the current DAO. func (dao *User3Dao) Group() string { return dao.group } -// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation. +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *User3Dao) Ctx(ctx context.Context) *gdb.Model { return dao.DB().Model(dao.table).Safe().Ctx(ctx) } // Transaction wraps the transaction logic using function f. -// It rollbacks the transaction and returns the error from function f if it returns non-nil error. +// It rolls back the transaction and returns the error if function f returns a non-nil error. // It commits the transaction and returns nil if function f returns nil. // -// Note that, you should not Commit or Rollback the transaction in function f +// Note: Do not commit or roll back the transaction in function f, // as it is automatically handled by this function. func (dao *User3Dao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { return dao.Ctx(ctx).Transaction(ctx, f) diff --git a/cmd/gf/internal/cmd/testdata/issue/2572/dao/internal/user_4.go b/cmd/gf/internal/cmd/testdata/issue/2572/dao/internal/user_4.go index 0488034d842..6cff3565047 100644 --- a/cmd/gf/internal/cmd/testdata/issue/2572/dao/internal/user_4.go +++ b/cmd/gf/internal/cmd/testdata/issue/2572/dao/internal/user_4.go @@ -11,14 +11,14 @@ import ( "github.com/gogf/gf/v2/frame/g" ) -// User4Dao is the data access object for table user4. +// User4Dao is the data access object for the table user4. type User4Dao struct { table string // table is the underlying table name of the DAO. - group string // group is the database configuration group name of current DAO. + group string // group is the database configuration group name of the current DAO. columns User4Columns // columns contains all the column names of Table for convenient usage. } -// User4Columns defines and stores column names for table user4. +// User4Columns defines and stores column names for the table user4. type User4Columns struct { Id string // User ID Passport string // User Passport @@ -29,7 +29,7 @@ type User4Columns struct { UpdateAt string // Updated Time } -// user4Columns holds the columns for table user4. +// user4Columns holds the columns for the table user4. var user4Columns = User4Columns{ Id: "id", Passport: "passport", @@ -49,36 +49,36 @@ func NewUser4Dao() *User4Dao { } } -// DB retrieves and returns the underlying raw database management object of current DAO. +// DB retrieves and returns the underlying raw database management object of the current DAO. func (dao *User4Dao) DB() gdb.DB { return g.DB(dao.group) } -// Table returns the table name of current dao. +// Table returns the table name of the current DAO. func (dao *User4Dao) Table() string { return dao.table } -// Columns returns all column names of current dao. +// Columns returns all column names of the current DAO. func (dao *User4Dao) Columns() User4Columns { return dao.columns } -// Group returns the configuration group name of database of current dao. +// Group returns the database configuration group name of the current DAO. func (dao *User4Dao) Group() string { return dao.group } -// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation. +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *User4Dao) Ctx(ctx context.Context) *gdb.Model { return dao.DB().Model(dao.table).Safe().Ctx(ctx) } // Transaction wraps the transaction logic using function f. -// It rollbacks the transaction and returns the error from function f if it returns non-nil error. +// It rolls back the transaction and returns the error if function f returns a non-nil error. // It commits the transaction and returns nil if function f returns nil. // -// Note that, you should not Commit or Rollback the transaction in function f +// Note: Do not commit or roll back the transaction in function f, // as it is automatically handled by this function. func (dao *User4Dao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { return dao.Ctx(ctx).Transaction(ctx, f) diff --git a/cmd/gf/internal/cmd/testdata/issue/2572/dao/user_3.go b/cmd/gf/internal/cmd/testdata/issue/2572/dao/user_3.go index 375276e4823..41b681d9f36 100644 --- a/cmd/gf/internal/cmd/testdata/issue/2572/dao/user_3.go +++ b/cmd/gf/internal/cmd/testdata/issue/2572/dao/user_3.go @@ -1,5 +1,5 @@ // ================================================================================= -// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. // ================================================================================= package dao @@ -8,20 +8,20 @@ import ( "/internal" ) -// internalUser3Dao is internal type for wrapping internal DAO implements. +// internalUser3Dao is an internal type for wrapping the internal DAO implementation. type internalUser3Dao = *internal.User3Dao -// user3Dao is the data access object for table user3. -// You can define custom methods on it to extend its functionality as you wish. +// user3Dao is the data access object for the table user3. +// You can define custom methods on it to extend its functionality as needed. type user3Dao struct { internalUser3Dao } var ( - // User3 is globally public accessible object for table user3 operations. + // User3 is a globally accessible object for table user3 operations. User3 = user3Dao{ internal.NewUser3Dao(), } ) -// Fill with you ideas below. +// Add your custom methods and functionality below. diff --git a/cmd/gf/internal/cmd/testdata/issue/2572/dao/user_4.go b/cmd/gf/internal/cmd/testdata/issue/2572/dao/user_4.go index 7d023591979..29b6947907e 100644 --- a/cmd/gf/internal/cmd/testdata/issue/2572/dao/user_4.go +++ b/cmd/gf/internal/cmd/testdata/issue/2572/dao/user_4.go @@ -1,5 +1,5 @@ // ================================================================================= -// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. // ================================================================================= package dao @@ -8,20 +8,20 @@ import ( "/internal" ) -// internalUser4Dao is internal type for wrapping internal DAO implements. +// internalUser4Dao is an internal type for wrapping the internal DAO implementation. type internalUser4Dao = *internal.User4Dao -// user4Dao is the data access object for table user4. -// You can define custom methods on it to extend its functionality as you wish. +// user4Dao is the data access object for the table user4. +// You can define custom methods on it to extend its functionality as needed. type user4Dao struct { internalUser4Dao } var ( - // User4 is globally public accessible object for table user4 operations. + // User4 is a globally accessible object for table user4 operations. User4 = user4Dao{ internal.NewUser4Dao(), } ) -// Fill with you ideas below. +// Add your custom methods and functionality below. diff --git a/cmd/gf/internal/cmd/testdata/issue/2616/dao/internal/user_1.go b/cmd/gf/internal/cmd/testdata/issue/2616/dao/internal/user_1.go index 9988251832e..4951b4fda5b 100644 --- a/cmd/gf/internal/cmd/testdata/issue/2616/dao/internal/user_1.go +++ b/cmd/gf/internal/cmd/testdata/issue/2616/dao/internal/user_1.go @@ -11,14 +11,14 @@ import ( "github.com/gogf/gf/v2/frame/g" ) -// User1Dao is the data access object for table user1. +// User1Dao is the data access object for the table user1. type User1Dao struct { table string // table is the underlying table name of the DAO. - group string // group is the database configuration group name of current DAO. + group string // group is the database configuration group name of the current DAO. columns User1Columns // columns contains all the column names of Table for convenient usage. } -// User1Columns defines and stores column names for table user1. +// User1Columns defines and stores column names for the table user1. type User1Columns struct { Id string // User ID Passport string // User Passport @@ -29,7 +29,7 @@ type User1Columns struct { UpdateAt string // Updated Time } -// user1Columns holds the columns for table user1. +// user1Columns holds the columns for the table user1. var user1Columns = User1Columns{ Id: "id", Passport: "passport", @@ -49,36 +49,36 @@ func NewUser1Dao() *User1Dao { } } -// DB retrieves and returns the underlying raw database management object of current DAO. +// DB retrieves and returns the underlying raw database management object of the current DAO. func (dao *User1Dao) DB() gdb.DB { return g.DB(dao.group) } -// Table returns the table name of current dao. +// Table returns the table name of the current DAO. func (dao *User1Dao) Table() string { return dao.table } -// Columns returns all column names of current dao. +// Columns returns all column names of the current DAO. func (dao *User1Dao) Columns() User1Columns { return dao.columns } -// Group returns the configuration group name of database of current dao. +// Group returns the database configuration group name of the current DAO. func (dao *User1Dao) Group() string { return dao.group } -// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation. +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *User1Dao) Ctx(ctx context.Context) *gdb.Model { return dao.DB().Model(dao.table).Safe().Ctx(ctx) } // Transaction wraps the transaction logic using function f. -// It rollbacks the transaction and returns the error from function f if it returns non-nil error. +// It rolls back the transaction and returns the error if function f returns a non-nil error. // It commits the transaction and returns nil if function f returns nil. // -// Note that, you should not Commit or Rollback the transaction in function f +// Note: Do not commit or roll back the transaction in function f, // as it is automatically handled by this function. func (dao *User1Dao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { return dao.Ctx(ctx).Transaction(ctx, f) diff --git a/cmd/gf/internal/cmd/testdata/issue/2616/dao/internal/user_2.go b/cmd/gf/internal/cmd/testdata/issue/2616/dao/internal/user_2.go index 7e9cf2fa9ac..65c04197f58 100644 --- a/cmd/gf/internal/cmd/testdata/issue/2616/dao/internal/user_2.go +++ b/cmd/gf/internal/cmd/testdata/issue/2616/dao/internal/user_2.go @@ -11,14 +11,14 @@ import ( "github.com/gogf/gf/v2/frame/g" ) -// User2Dao is the data access object for table user2. +// User2Dao is the data access object for the table user2. type User2Dao struct { table string // table is the underlying table name of the DAO. - group string // group is the database configuration group name of current DAO. + group string // group is the database configuration group name of the current DAO. columns User2Columns // columns contains all the column names of Table for convenient usage. } -// User2Columns defines and stores column names for table user2. +// User2Columns defines and stores column names for the table user2. type User2Columns struct { Id string // User ID Passport string // User Passport @@ -29,7 +29,7 @@ type User2Columns struct { UpdateAt string // Updated Time } -// user2Columns holds the columns for table user2. +// user2Columns holds the columns for the table user2. var user2Columns = User2Columns{ Id: "id", Passport: "passport", @@ -49,36 +49,36 @@ func NewUser2Dao() *User2Dao { } } -// DB retrieves and returns the underlying raw database management object of current DAO. +// DB retrieves and returns the underlying raw database management object of the current DAO. func (dao *User2Dao) DB() gdb.DB { return g.DB(dao.group) } -// Table returns the table name of current dao. +// Table returns the table name of the current DAO. func (dao *User2Dao) Table() string { return dao.table } -// Columns returns all column names of current dao. +// Columns returns all column names of the current DAO. func (dao *User2Dao) Columns() User2Columns { return dao.columns } -// Group returns the configuration group name of database of current dao. +// Group returns the database configuration group name of the current DAO. func (dao *User2Dao) Group() string { return dao.group } -// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation. +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *User2Dao) Ctx(ctx context.Context) *gdb.Model { return dao.DB().Model(dao.table).Safe().Ctx(ctx) } // Transaction wraps the transaction logic using function f. -// It rollbacks the transaction and returns the error from function f if it returns non-nil error. +// It rolls back the transaction and returns the error if function f returns a non-nil error. // It commits the transaction and returns nil if function f returns nil. // -// Note that, you should not Commit or Rollback the transaction in function f +// Note: Do not commit or roll back the transaction in function f, // as it is automatically handled by this function. func (dao *User2Dao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { return dao.Ctx(ctx).Transaction(ctx, f) diff --git a/cmd/gf/internal/cmd/testdata/issue/2616/dao/internal/user_3.go b/cmd/gf/internal/cmd/testdata/issue/2616/dao/internal/user_3.go index db59440164d..58c955a88c6 100644 --- a/cmd/gf/internal/cmd/testdata/issue/2616/dao/internal/user_3.go +++ b/cmd/gf/internal/cmd/testdata/issue/2616/dao/internal/user_3.go @@ -11,14 +11,14 @@ import ( "github.com/gogf/gf/v2/frame/g" ) -// User3Dao is the data access object for table user3. +// User3Dao is the data access object for the table user3. type User3Dao struct { table string // table is the underlying table name of the DAO. - group string // group is the database configuration group name of current DAO. + group string // group is the database configuration group name of the current DAO. columns User3Columns // columns contains all the column names of Table for convenient usage. } -// User3Columns defines and stores column names for table user3. +// User3Columns defines and stores column names for the table user3. type User3Columns struct { Id string // User ID Passport string // User Passport @@ -29,7 +29,7 @@ type User3Columns struct { UpdateAt string // Updated Time } -// user3Columns holds the columns for table user3. +// user3Columns holds the columns for the table user3. var user3Columns = User3Columns{ Id: "id", Passport: "passport", @@ -49,36 +49,36 @@ func NewUser3Dao() *User3Dao { } } -// DB retrieves and returns the underlying raw database management object of current DAO. +// DB retrieves and returns the underlying raw database management object of the current DAO. func (dao *User3Dao) DB() gdb.DB { return g.DB(dao.group) } -// Table returns the table name of current dao. +// Table returns the table name of the current DAO. func (dao *User3Dao) Table() string { return dao.table } -// Columns returns all column names of current dao. +// Columns returns all column names of the current DAO. func (dao *User3Dao) Columns() User3Columns { return dao.columns } -// Group returns the configuration group name of database of current dao. +// Group returns the database configuration group name of the current DAO. func (dao *User3Dao) Group() string { return dao.group } -// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation. +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *User3Dao) Ctx(ctx context.Context) *gdb.Model { return dao.DB().Model(dao.table).Safe().Ctx(ctx) } // Transaction wraps the transaction logic using function f. -// It rollbacks the transaction and returns the error from function f if it returns non-nil error. +// It rolls back the transaction and returns the error if function f returns a non-nil error. // It commits the transaction and returns nil if function f returns nil. // -// Note that, you should not Commit or Rollback the transaction in function f +// Note: Do not commit or roll back the transaction in function f, // as it is automatically handled by this function. func (dao *User3Dao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { return dao.Ctx(ctx).Transaction(ctx, f) diff --git a/cmd/gf/internal/cmd/testdata/issue/2616/dao/internal/user_4.go b/cmd/gf/internal/cmd/testdata/issue/2616/dao/internal/user_4.go index 0488034d842..6cff3565047 100644 --- a/cmd/gf/internal/cmd/testdata/issue/2616/dao/internal/user_4.go +++ b/cmd/gf/internal/cmd/testdata/issue/2616/dao/internal/user_4.go @@ -11,14 +11,14 @@ import ( "github.com/gogf/gf/v2/frame/g" ) -// User4Dao is the data access object for table user4. +// User4Dao is the data access object for the table user4. type User4Dao struct { table string // table is the underlying table name of the DAO. - group string // group is the database configuration group name of current DAO. + group string // group is the database configuration group name of the current DAO. columns User4Columns // columns contains all the column names of Table for convenient usage. } -// User4Columns defines and stores column names for table user4. +// User4Columns defines and stores column names for the table user4. type User4Columns struct { Id string // User ID Passport string // User Passport @@ -29,7 +29,7 @@ type User4Columns struct { UpdateAt string // Updated Time } -// user4Columns holds the columns for table user4. +// user4Columns holds the columns for the table user4. var user4Columns = User4Columns{ Id: "id", Passport: "passport", @@ -49,36 +49,36 @@ func NewUser4Dao() *User4Dao { } } -// DB retrieves and returns the underlying raw database management object of current DAO. +// DB retrieves and returns the underlying raw database management object of the current DAO. func (dao *User4Dao) DB() gdb.DB { return g.DB(dao.group) } -// Table returns the table name of current dao. +// Table returns the table name of the current DAO. func (dao *User4Dao) Table() string { return dao.table } -// Columns returns all column names of current dao. +// Columns returns all column names of the current DAO. func (dao *User4Dao) Columns() User4Columns { return dao.columns } -// Group returns the configuration group name of database of current dao. +// Group returns the database configuration group name of the current DAO. func (dao *User4Dao) Group() string { return dao.group } -// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation. +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *User4Dao) Ctx(ctx context.Context) *gdb.Model { return dao.DB().Model(dao.table).Safe().Ctx(ctx) } // Transaction wraps the transaction logic using function f. -// It rollbacks the transaction and returns the error from function f if it returns non-nil error. +// It rolls back the transaction and returns the error if function f returns a non-nil error. // It commits the transaction and returns nil if function f returns nil. // -// Note that, you should not Commit or Rollback the transaction in function f +// Note: Do not commit or roll back the transaction in function f, // as it is automatically handled by this function. func (dao *User4Dao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { return dao.Ctx(ctx).Transaction(ctx, f) diff --git a/cmd/gf/internal/cmd/testdata/issue/2616/dao/user_1.go b/cmd/gf/internal/cmd/testdata/issue/2616/dao/user_1.go index 69af67a98bb..4c46f1a6941 100644 --- a/cmd/gf/internal/cmd/testdata/issue/2616/dao/user_1.go +++ b/cmd/gf/internal/cmd/testdata/issue/2616/dao/user_1.go @@ -1,5 +1,5 @@ // ================================================================================= -// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. // ================================================================================= // I am not overwritten. @@ -10,20 +10,20 @@ import ( "/internal" ) -// internalUser1Dao is internal type for wrapping internal DAO implements. +// internalUser1Dao is an internal type for wrapping the internal DAO implementation. type internalUser1Dao = *internal.User1Dao -// user1Dao is the data access object for table user1. -// You can define custom methods on it to extend its functionality as you wish. +// user1Dao is the data access object for the table user1. +// You can define custom methods on it to extend its functionality as needed. type user1Dao struct { internalUser1Dao } var ( - // User1 is globally public accessible object for table user1 operations. + // User1 is a globally accessible object for table user1 operations. User1 = user1Dao{ internal.NewUser1Dao(), } ) -// Fill with you ideas below. +// Add your custom methods and functionality below. diff --git a/cmd/gf/internal/cmd/testdata/issue/2616/dao/user_2.go b/cmd/gf/internal/cmd/testdata/issue/2616/dao/user_2.go index 895d406cb3d..692ed1b9614 100644 --- a/cmd/gf/internal/cmd/testdata/issue/2616/dao/user_2.go +++ b/cmd/gf/internal/cmd/testdata/issue/2616/dao/user_2.go @@ -1,5 +1,5 @@ // ================================================================================= -// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. // ================================================================================= // I am not overwritten. @@ -10,20 +10,20 @@ import ( "/internal" ) -// internalUser2Dao is internal type for wrapping internal DAO implements. +// internalUser2Dao is an internal type for wrapping the internal DAO implementation. type internalUser2Dao = *internal.User2Dao -// user2Dao is the data access object for table user2. -// You can define custom methods on it to extend its functionality as you wish. +// user2Dao is the data access object for the table user2. +// You can define custom methods on it to extend its functionality as needed. type user2Dao struct { internalUser2Dao } var ( - // User2 is globally public accessible object for table user2 operations. + // User2 is a globally accessible object for table user2 operations. User2 = user2Dao{ internal.NewUser2Dao(), } ) -// Fill with you ideas below. +// Add your custom methods and functionality below. diff --git a/cmd/gf/internal/cmd/testdata/issue/2616/dao/user_3.go b/cmd/gf/internal/cmd/testdata/issue/2616/dao/user_3.go index 375276e4823..41b681d9f36 100644 --- a/cmd/gf/internal/cmd/testdata/issue/2616/dao/user_3.go +++ b/cmd/gf/internal/cmd/testdata/issue/2616/dao/user_3.go @@ -1,5 +1,5 @@ // ================================================================================= -// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. // ================================================================================= package dao @@ -8,20 +8,20 @@ import ( "/internal" ) -// internalUser3Dao is internal type for wrapping internal DAO implements. +// internalUser3Dao is an internal type for wrapping the internal DAO implementation. type internalUser3Dao = *internal.User3Dao -// user3Dao is the data access object for table user3. -// You can define custom methods on it to extend its functionality as you wish. +// user3Dao is the data access object for the table user3. +// You can define custom methods on it to extend its functionality as needed. type user3Dao struct { internalUser3Dao } var ( - // User3 is globally public accessible object for table user3 operations. + // User3 is a globally accessible object for table user3 operations. User3 = user3Dao{ internal.NewUser3Dao(), } ) -// Fill with you ideas below. +// Add your custom methods and functionality below. diff --git a/cmd/gf/internal/cmd/testdata/issue/2616/dao/user_4.go b/cmd/gf/internal/cmd/testdata/issue/2616/dao/user_4.go index 7d023591979..29b6947907e 100644 --- a/cmd/gf/internal/cmd/testdata/issue/2616/dao/user_4.go +++ b/cmd/gf/internal/cmd/testdata/issue/2616/dao/user_4.go @@ -1,5 +1,5 @@ // ================================================================================= -// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. // ================================================================================= package dao @@ -8,20 +8,20 @@ import ( "/internal" ) -// internalUser4Dao is internal type for wrapping internal DAO implements. +// internalUser4Dao is an internal type for wrapping the internal DAO implementation. type internalUser4Dao = *internal.User4Dao -// user4Dao is the data access object for table user4. -// You can define custom methods on it to extend its functionality as you wish. +// user4Dao is the data access object for the table user4. +// You can define custom methods on it to extend its functionality as needed. type user4Dao struct { internalUser4Dao } var ( - // User4 is globally public accessible object for table user4 operations. + // User4 is a globally accessible object for table user4 operations. User4 = user4Dao{ internal.NewUser4Dao(), } ) -// Fill with you ideas below. +// Add your custom methods and functionality below. diff --git a/cmd/gf/internal/cmd/testdata/issue/3460/controller/hello/hello.go b/cmd/gf/internal/cmd/testdata/issue/3460/controller/hello/hello.go index f72082fbfb9..9792425eac8 100644 --- a/cmd/gf/internal/cmd/testdata/issue/3460/controller/hello/hello.go +++ b/cmd/gf/internal/cmd/testdata/issue/3460/controller/hello/hello.go @@ -1,5 +1,5 @@ // ================================================================================= -// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. // ================================================================================= package hello diff --git a/cmd/gf/internal/cmd/testdata/issue/3460/controller/hello/hello_new.go b/cmd/gf/internal/cmd/testdata/issue/3460/controller/hello/hello_new.go index 6774d918367..df771d49f0f 100644 --- a/cmd/gf/internal/cmd/testdata/issue/3460/controller/hello/hello_new.go +++ b/cmd/gf/internal/cmd/testdata/issue/3460/controller/hello/hello_new.go @@ -1,5 +1,5 @@ // ================================================================================= -// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. // ================================================================================= package hello diff --git a/cmd/gf/internal/cmd/testdata/issue/3749/dao/internal/table_user.go b/cmd/gf/internal/cmd/testdata/issue/3749/dao/internal/table_user.go index 871b7d65748..bb7bf30a875 100644 --- a/cmd/gf/internal/cmd/testdata/issue/3749/dao/internal/table_user.go +++ b/cmd/gf/internal/cmd/testdata/issue/3749/dao/internal/table_user.go @@ -11,14 +11,14 @@ import ( "github.com/gogf/gf/v2/frame/g" ) -// TableUserDao is the data access object for table table_user. +// TableUserDao is the data access object for the table table_user. type TableUserDao struct { table string // table is the underlying table name of the DAO. - group string // group is the database configuration group name of current DAO. + group string // group is the database configuration group name of the current DAO. columns TableUserColumns // columns contains all the column names of Table for convenient usage. } -// TableUserColumns defines and stores column names for table table_user. +// TableUserColumns defines and stores column names for the table table_user. type TableUserColumns struct { Id string // User ID ParentId string // @@ -29,7 +29,7 @@ type TableUserColumns struct { UpdateAt string // Updated Time } -// tableUserColumns holds the columns for table table_user. +// tableUserColumns holds the columns for the table table_user. var tableUserColumns = TableUserColumns{ Id: "Id", ParentId: "parentId", @@ -49,36 +49,36 @@ func NewTableUserDao() *TableUserDao { } } -// DB retrieves and returns the underlying raw database management object of current DAO. +// DB retrieves and returns the underlying raw database management object of the current DAO. func (dao *TableUserDao) DB() gdb.DB { return g.DB(dao.group) } -// Table returns the table name of current dao. +// Table returns the table name of the current DAO. func (dao *TableUserDao) Table() string { return dao.table } -// Columns returns all column names of current dao. +// Columns returns all column names of the current DAO. func (dao *TableUserDao) Columns() TableUserColumns { return dao.columns } -// Group returns the configuration group name of database of current dao. +// Group returns the database configuration group name of the current DAO. func (dao *TableUserDao) Group() string { return dao.group } -// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation. +// Ctx creates and returns a Model for the current DAO. It automatically sets the context for the current operation. func (dao *TableUserDao) Ctx(ctx context.Context) *gdb.Model { return dao.DB().Model(dao.table).Safe().Ctx(ctx) } // Transaction wraps the transaction logic using function f. -// It rollbacks the transaction and returns the error from function f if it returns non-nil error. +// It rolls back the transaction and returns the error if function f returns a non-nil error. // It commits the transaction and returns nil if function f returns nil. // -// Note that, you should not Commit or Rollback the transaction in function f +// Note: Do not commit or roll back the transaction in function f, // as it is automatically handled by this function. func (dao *TableUserDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { return dao.Ctx(ctx).Transaction(ctx, f) diff --git a/cmd/gf/internal/cmd/testdata/issue/3749/dao/table_user.go b/cmd/gf/internal/cmd/testdata/issue/3749/dao/table_user.go index 9bc9cff6f7d..28d2d47973d 100644 --- a/cmd/gf/internal/cmd/testdata/issue/3749/dao/table_user.go +++ b/cmd/gf/internal/cmd/testdata/issue/3749/dao/table_user.go @@ -1,5 +1,5 @@ // ================================================================================= -// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. +// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. // ================================================================================= package dao @@ -8,20 +8,20 @@ import ( "for-gendao-test/pkg/dao/internal" ) -// internalTableUserDao is internal type for wrapping internal DAO implements. +// internalTableUserDao is an internal type for wrapping the internal DAO implementation. type internalTableUserDao = *internal.TableUserDao -// tableUserDao is the data access object for table table_user. -// You can define custom methods on it to extend its functionality as you wish. +// tableUserDao is the data access object for the table table_user. +// You can define custom methods on it to extend its functionality as needed. type tableUserDao struct { internalTableUserDao } var ( - // TableUser is globally public accessible object for table table_user operations. + // TableUser is a globally accessible object for table table_user operations. TableUser = tableUserDao{ internal.NewTableUserDao(), } ) -// Fill with you ideas below. +// Add your custom methods and functionality below. From 3eee2e54f87e4052590333c25f0164fbcf106026 Mon Sep 17 00:00:00 2001 From: houseme Date: Thu, 5 Dec 2024 20:57:07 +0800 Subject: [PATCH 7/7] revert --- .../internal/cmd/testdata/issue/3460/controller/hello/hello.go | 2 +- .../cmd/testdata/issue/3460/controller/hello/hello_new.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/gf/internal/cmd/testdata/issue/3460/controller/hello/hello.go b/cmd/gf/internal/cmd/testdata/issue/3460/controller/hello/hello.go index 9792425eac8..f72082fbfb9 100644 --- a/cmd/gf/internal/cmd/testdata/issue/3460/controller/hello/hello.go +++ b/cmd/gf/internal/cmd/testdata/issue/3460/controller/hello/hello.go @@ -1,5 +1,5 @@ // ================================================================================= -// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. // ================================================================================= package hello diff --git a/cmd/gf/internal/cmd/testdata/issue/3460/controller/hello/hello_new.go b/cmd/gf/internal/cmd/testdata/issue/3460/controller/hello/hello_new.go index df771d49f0f..6774d918367 100644 --- a/cmd/gf/internal/cmd/testdata/issue/3460/controller/hello/hello_new.go +++ b/cmd/gf/internal/cmd/testdata/issue/3460/controller/hello/hello_new.go @@ -1,5 +1,5 @@ // ================================================================================= -// This file is auto-generated by the GoFrame CLI tool. You may modify it as needed. +// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. // ================================================================================= package hello