Skip to content

Commit

Permalink
refactor: move complex conditional to a method
Browse files Browse the repository at this point in the history
The `f.SQLDefault == ""` part seems redundant before addReturningField,
as RETURNING makes sense for a field that was given its default value.
  • Loading branch information
bevzzz committed Nov 29, 2023
1 parent 6f96bd9 commit adcb2c6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/dbtest/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,8 @@ func TestQuery(t *testing.T) {
Where("model.id = _data.id")
},
func(db *bun.DB) schema.QueryAppender {
// "nullzero" marshalls zero values as DEFAULT or NULL (if DEFAULT placeholder is not supported)
// DB drivers that support DEFAULT placeholder resolve it to NULL for columns that do not have a DEFAULT value.
// "nullzero" marshals zero values as DEFAULT or NULL (if DEFAULT placeholder is not supported)
// DB drivers which support DEFAULT placeholder resolve it to NULL for columns that do not have a DEFAULT value.
type Model struct {
Int int64 `bun:",nullzero"`
Uint uint64 `bun:",nullzero"`
Expand Down Expand Up @@ -1019,7 +1019,7 @@ func TestQuery(t *testing.T) {
}).Column("is_active").WherePK()
},
func(db *bun.DB) schema.QueryAppender {
// "default" marshalls zero values as DEFAULT or specified default value
// "default" marshals zero values as DEFAULT or the specified default value
type Model struct {
Int int64 `bun:",default:42"`
Uint uint64 `bun:",default:42"`
Expand Down

0 comments on commit adcb2c6

Please sign in to comment.