This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package repository
|
||||
|
||||
import (
|
||||
"context"
|
||||
"kontor-api-gin/internal/models"
|
||||
"log/slog"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type BookshelfPublisherRepository struct {
|
||||
db *gorm.DB
|
||||
}
|
||||
|
||||
func NewBookshelfPublisherRepository(db *gorm.DB) *BookshelfPublisherRepository {
|
||||
repo := &BookshelfPublisherRepository{db: db}
|
||||
return repo
|
||||
}
|
||||
|
||||
func (repository *BookshelfPublisherRepository) FindAll(context context.Context) ([]models.BookshelfPublisher, error) {
|
||||
var bookshelfPublishers []models.BookshelfPublisher
|
||||
|
||||
result := repository.db.Find(&bookshelfPublishers)
|
||||
slog.Info("BookshelfPublisherRepository#FindAll", "count", result.RowsAffected)
|
||||
|
||||
return bookshelfPublishers, nil
|
||||
}
|
||||
Reference in New Issue
Block a user