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

@@ -518,6 +518,11 @@ type DeleteSpec struct {
Predicate func(*sql.Selector)
}
// NewDeleteSpec creates a new node deletion spec.
func NewDeleteSpec(table string, id *FieldSpec) *DeleteSpec {
return &DeleteSpec{Node: &NodeSpec{Table: table, ID: id}}
}
// DeleteNodes applies the DeleteSpec on the graph.
func DeleteNodes(ctx context.Context, drv dialect.Driver, spec *DeleteSpec) (int, error) {
var (