github.com/octohelm/storage@v0.0.0-20240516030302-1ac2cc1ea347/pkg/sqlbuilder/stmt_update_test.go (about) 1 package sqlbuilder_test 2 3 import ( 4 "testing" 5 6 "github.com/octohelm/storage/internal/testutil" 7 8 . "github.com/octohelm/storage/pkg/sqlbuilder" 9 ) 10 11 func TestStmtUpdate(t *testing.T) { 12 table := T("T") 13 14 t.Run("update", func(t *testing.T) { 15 fa := TypedCol[int]("F_a") 16 fb := TypedCol[int]("F_b") 17 18 testutil.ShouldBeExpr(t, 19 Update(table). 20 Set( 21 fa.By(Value(1)), 22 fb.By(Value(2)), 23 ). 24 Where( 25 fa.V(Eq(1)), 26 Comment("Comment"), 27 ), 28 ` 29 UPDATE T SET f_a = ?, f_b = ? 30 WHERE f_a = ? 31 /* Comment */`, 1, 2, 1) 32 }) 33 }