ch some
Some checks failed
CI/CD / Vet, test, build (push) Has been cancelled
CI/CD / Docker image (push) Has been cancelled
CI/CD / Deploy binary to server (push) Has been cancelled

This commit is contained in:
2026-09-04 19:33:26 +05:00
parent 28509eb4ca
commit d1a6fcaadc
102 changed files with 2089 additions and 1957 deletions

View File

@@ -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
}