github.com/octohelm/storage@v0.0.0-20240516030302-1ac2cc1ea347/pkg/sqlbuilder/stmt_delete_test.go (about)

     1  package sqlbuilder_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/octohelm/storage/internal/testutil"
     7  	. "github.com/octohelm/storage/pkg/sqlbuilder"
     8  )
     9  
    10  func TestStmtDelete(t *testing.T) {
    11  	table := T("T")
    12  
    13  	t.Run("delete", func(t *testing.T) {
    14  		testutil.ShouldBeExpr(t,
    15  			Delete().From(table,
    16  				Where(TypedCol[int]("F_a").V(Eq(1))),
    17  				Comment("Comment"),
    18  			),
    19  			`
    20  DELETE FROM T
    21  WHERE f_a = ?
    22  /* Comment */
    23  `, 1)
    24  	})
    25  }