Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Repository ¶
type Repository interface { FindByEmail(email string) (*User, error) FindByID(id uint32) (*User, error) Register(user *User) (*User, error) DoesEmailExist(email string) bool }
Repository is an interface to separate impl of different db func
func NewDatabaseRepo ¶
func NewDatabaseRepo(db *gorm.DB) Repository
NewDatabaseRepo adds a layer of abstraction so that everything in the interface Repository can be accessed only via the instance of this function
type Service ¶
type Service interface { Register(user *User) (*User, error) Login(email, password string) (*User, error) GetUserByID(id uint32) (*User, error) GetUserByEmail(email string) (*User, error) GetRepo() Repository }
Service interface for abstraction over higher functions
func NewService ¶
func NewService(r Repository) Service
NewService function to get new instance of server
Click to show internal directories.
Click to hide internal directories.