dialect/sql/sqlgraph: add deletion spec builder (#3291)

This commit is contained in:
Ariel Mashraki
2023-02-01 11:55:00 +02:00
committed by GitHub
parent cb2f75932f
commit 92cc7438f7
125 changed files with 129 additions and 1102 deletions

View File

@@ -44,15 +44,7 @@ func (cd *CityDelete) ExecX(ctx context.Context) int {
}
func (cd *CityDelete) sqlExec(ctx context.Context) (int, error) {
_spec := &sqlgraph.DeleteSpec{
Node: &sqlgraph.NodeSpec{
Table: city.Table,
ID: &sqlgraph.FieldSpec{
Type: field.TypeInt,
Column: city.FieldID,
},
},
}
_spec := sqlgraph.NewDeleteSpec(city.Table, sqlgraph.NewFieldSpec(city.FieldID, field.TypeInt))
if ps := cd.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {

View File

@@ -44,15 +44,7 @@ func (sd *StreetDelete) ExecX(ctx context.Context) int {
}
func (sd *StreetDelete) sqlExec(ctx context.Context) (int, error) {
_spec := &sqlgraph.DeleteSpec{
Node: &sqlgraph.NodeSpec{
Table: street.Table,
ID: &sqlgraph.FieldSpec{
Type: field.TypeInt,
Column: street.FieldID,
},
},
}
_spec := sqlgraph.NewDeleteSpec(street.Table, sqlgraph.NewFieldSpec(street.FieldID, field.TypeInt))
if ps := sd.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {