github.com/machinefi/w3bstream@v1.6.5-rc9.0.20240426031326-b8c7c4876e72/pkg/depends/kit/sqlx/builder/builder_stmt_delete.go (about)

     1  package builder
     2  
     3  import "context"
     4  
     5  func Delete() *StmtDelete { return &StmtDelete{} }
     6  
     7  type StmtDelete struct {
     8  	tbl  *Table
     9  	adds Additions
    10  }
    11  
    12  func (s StmtDelete) From(tbl *Table, adds ...Addition) *StmtDelete {
    13  	s.tbl, s.adds = tbl, adds
    14  	return &s
    15  }
    16  
    17  func (s *StmtDelete) IsNil() bool { return s == nil || IsNilExpr(s.tbl) }
    18  
    19  func (s *StmtDelete) Ex(ctx context.Context) *Ex {
    20  	e := Expr("DELETE FROM ")
    21  	e.WriteExpr(s.tbl)
    22  	WriteAdditions(e, s.adds...)
    23  	return e.Ex(ctx)
    24  }