From adcb2c66fef7de107ab191a632b2474f1fd882f7 Mon Sep 17 00:00:00 2001 From: dyma solovei Date: Wed, 29 Nov 2023 19:22:05 +0100 Subject: [PATCH] refactor: move complex conditional to a method The `f.SQLDefault == ""` part seems redundant before addReturningField, as RETURNING makes sense for a field that was given its default value. --- internal/dbtest/query_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/dbtest/query_test.go b/internal/dbtest/query_test.go index 1feb5c14e..f47652992 100644 --- a/internal/dbtest/query_test.go +++ b/internal/dbtest/query_test.go @@ -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"` @@ -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"`