add storages

This commit is contained in:
Rogee
2025-01-16 17:02:30 +08:00
parent 3a8bb03cb7
commit d72f384177
5 changed files with 211 additions and 25 deletions

View File

@@ -108,3 +108,19 @@ func (svc *Service) GetMediaByHash(ctx context.Context, tenantID, userID int64,
}
return &ret, nil
}
func (svc *Service) DeleteByID(ctx context.Context, id ...int64) error {
if len(id) == 0 {
return nil
}
_, span := otel.Start(ctx, "medias.service.DeleteByID")
defer span.End()
tbl := table.Medias
stmt := tbl.DELETE().WHERE(tbl.ID.IN(lo.Map(id, func(item int64, _ int) Expression { return Int64(item) })...))
span.SetAttributes(semconv.DBStatementKey.String(stmt.DebugSql()))
_, err := stmt.ExecContext(ctx, svc.db)
return err
}