This commit is contained in:
fede committed 2026-06-19 23:04:13 -03:00
1 parent 6c0e44cb45
commit 90e76d4963
11 files changed
+112 -38

No files matched your search

+4 -4
View File
@@ -8,7 +8,7 @@ type IRepositorio[T any] interface {
Guardar(entidad *T) error
ObtenerTodos() ([]T, error)
ObtenerPorID(id uint) (*T, error)
Crear(entidad *T) error
Crear(entidad T) error
Actualizar(entidad *T, input T) error
Eliminar(id uint) error
}
@@ -41,8 +41,8 @@ func (r *RepositorioBase[T]) ObtenerPorID(id uint) (*T, error) {
return &entidad, nil
}
func (r *RepositorioBase[T]) Crear(entidad *T) error {
return r.db.Create(entidad).Error
func (r *RepositorioBase[T]) Crear(entidad T) error {
return r.db.Create(&entidad).Error
}
func (r *RepositorioBase[T]) Actualizar(entidad *T, input T) error {
@@ -52,4 +52,4 @@ func (r *RepositorioBase[T]) Actualizar(entidad *T, input T) error {
func (r *RepositorioBase[T]) Eliminar(id uint) error {
var entidad T
return r.db.Delete(&entidad, id).Error
}
}