ch some
This commit is contained in:
@@ -41,7 +41,14 @@ func (r *Repository[T]) GetByID(ctx context.Context, id int64) (T, error) {
|
||||
}
|
||||
|
||||
func (r *Repository[T]) Delete(ctx context.Context, id int64) error {
|
||||
tag, err := r.client.Exec(ctx, `DELETE FROM `+r.table+` WHERE id = $1`, id)
|
||||
return Delete(ctx, r.client, r.table, id)
|
||||
}
|
||||
|
||||
// Delete runs the hard-delete-by-id pattern shared by every module that
|
||||
// doesn't need the full Repository[T] (e.g. association tables, or entities
|
||||
// whose List/GetByID require joins genericrepo doesn't model).
|
||||
func Delete(ctx context.Context, client postgresql.Client, table string, id int64) error {
|
||||
tag, err := client.Exec(ctx, `DELETE FROM `+table+` WHERE id = $1`, id)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user