Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cmd/gf/internal/consts/consts_gen_dao_template_dao.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (dao *{{.TplTableNameCamelCase}}Dao) Ctx(ctx context.Context) *gdb.Model {
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Safe().Ctx(ctx)
return model.Ctx(ctx)
}

Comment on lines +127 to 129
Copy link

Copilot AI Aug 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing Safe() mode changes the default behavior of generated DAOs which could be a breaking change. Safe mode typically provides protections against concurrent modifications. Consider documenting this change or providing a configuration option to enable Safe mode when needed.

Suggested change
return model.Ctx(ctx)
}
// SafeCtx creates and returns a Model for the current DAO with Safe mode enabled.
// Safe mode provides protections against concurrent modifications.
// Use this method if you need concurrency safety for your operations.
func (dao *{{.TplTableNameCamelCase}}Dao) SafeCtx(ctx context.Context) *gdb.Model {
model := dao.DB().Model(dao.table).Safe()
for _, handler := range dao.handlers {
model = handler(model)
}
return model.Ctx(ctx)
}

Copilot uses AI. Check for mistakes.
// Transaction wraps the transaction logic using function f.
Expand Down
Loading