add storages
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user