github.com/octohelm/storage@v0.0.0-20240516030302-1ac2cc1ea347/pkg/sqlbuilder/stmt_delete.go (about) 1 package sqlbuilder 2 3 import ( 4 "context" 5 ) 6 7 func Delete() *StmtDelete { 8 return &StmtDelete{} 9 } 10 11 type StmtDelete struct { 12 table Table 13 additions []Addition 14 } 15 16 func (s *StmtDelete) IsNil() bool { 17 return s == nil || IsNilExpr(s.table) 18 } 19 20 func (s StmtDelete) From(table Table, additions ...Addition) *StmtDelete { 21 s.table = table 22 s.additions = additions 23 return &s 24 } 25 26 func (s *StmtDelete) Ex(ctx context.Context) *Ex { 27 e := Expr("DELETE FROM ") 28 29 e.WriteExpr(s.table) 30 31 WriteAdditions(e, s.additions...) 32 33 return e.Ex(ctx) 34 }