28 lines
513 B
Go
28 lines
513 B
Go
package repository
|
|
|
|
import (
|
|
"esauth"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type Authorization interface {
|
|
CreateUser(user *esauth.User) (int64, error)
|
|
SaveUser(user *esauth.User) (int64, error)
|
|
GetUser(id int64) (esauth.User, error)
|
|
FindUser(query, param string) (esauth.User, error)
|
|
GetUsers(start, limit int) []int64
|
|
DeleteUser(id int64) error
|
|
GetUsersCount() int64
|
|
}
|
|
|
|
type Repository struct {
|
|
Authorization
|
|
}
|
|
|
|
func NewRepository(db *gorm.DB) *Repository {
|
|
return &Repository{
|
|
Authorization: NewAuthSchema(db),
|
|
}
|
|
}
|