36 lines
715 B
Go
36 lines
715 B
Go
package repository
|
|
|
|
import (
|
|
"github.com/jmoiron/sqlx"
|
|
"time"
|
|
|
|
"git.urec56.ru/urec/chat_back_go/internal/domain"
|
|
"git.urec56.ru/urec/chat_back_go/internal/logger"
|
|
)
|
|
|
|
//go:generate mockgen -source=repository.go -destination=mocks/mock.go
|
|
|
|
type User interface {
|
|
GetByID(userID int) (domain.User, error)
|
|
GetAll(username string) ([]domain.User, error)
|
|
FindOne(username, email string) (domain.User, error)
|
|
Register(email, hashedPassword, username string, dateOfBirth time.Time) (domain.User, error)
|
|
}
|
|
|
|
type Chat interface{}
|
|
|
|
type Repo interface {
|
|
User
|
|
Chat
|
|
}
|
|
|
|
type Repository struct {
|
|
User
|
|
Chat
|
|
}
|
|
|
|
func NewRepository(db *sqlx.DB, l logger.Log) *Repository {
|
|
return &Repository{
|
|
User: newUser(db, l),
|
|
}
|
|
}
|