improved Delete
This commit is contained in:
parent
f7bae81df7
commit
2ce3d755bd
10
delete.go
10
delete.go
@ -1,5 +1,11 @@
|
|||||||
package advsql
|
package advsql
|
||||||
|
|
||||||
func Delete[T any](db *Database, query string, encoder func(v *T, decode ScanFunc) error) DeleteFunc[T] {
|
func Delete[T any](db *Database, query string) DeleteFunc[T] {
|
||||||
return DeleteFunc[T](Insert(db, query, encoder))
|
prepareGlobal(db, query)
|
||||||
|
|
||||||
|
return func(args ...interface{}) error {
|
||||||
|
s := db.stmt(query)
|
||||||
|
_, err := s.Exec(args...)
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,6 @@ type QueryOneContextFunc[T any] func(ctx context.Context, args ...interface{}) *
|
|||||||
type InsertFunc[T any] func(v *T) error
|
type InsertFunc[T any] func(v *T) error
|
||||||
type UpdateFunc[T any] func(v *T) error
|
type UpdateFunc[T any] func(v *T) error
|
||||||
|
|
||||||
type DeleteFunc[T any] func(v *T) error
|
type DeleteFunc[T any] func(args ...interface{}) error
|
||||||
|
|
||||||
type ScanFunc = func(args ...interface{}) error
|
type ScanFunc = func(args ...interface{}) error
|
||||||
|
Loading…
Reference in New Issue
Block a user