Skip to content

Instantly share code, notes, and snippets.

@victorsteven
Last active March 2, 2020 22:39
Show Gist options
  • Save victorsteven/9443bae123072b47cc2723a61a946adc to your computer and use it in GitHub Desktop.
Save victorsteven/9443bae123072b47cc2723a61a946adc to your computer and use it in GitHub Desktop.
package application
import (
"food-app/domain/entity"
"food-app/domain/repository"
)
type userApp struct {
us repository.UserRepository
}
//UserApp implements the UserAppInterface
var _ UserAppInterface = &userApp{}
type UserAppInterface interface {
SaveUser(*entity.User) (*entity.User, map[string]string)
GetUsers() ([]entity.User, error)
GetUser(uint64) (*entity.User, error)
GetUserByEmailAndPassword(*entity.User) (*entity.User, map[string]string)
}
func (u *userApp) SaveUser(user *entity.User) (*entity.User, map[string]string) {
return u.us.SaveUser(user)
}
func (u *userApp) GetUser(userId uint64) (*entity.User, error) {
return u.us.GetUser(userId)
}
func (u *userApp) GetUsers() ([]entity.User, error) {
return u.us.GetUsers()
}
func (u *userApp) GetUserByEmailAndPassword(user *entity.User) (*entity.User, map[string]string) {
return u.us.GetUserByEmailAndPassword(user)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment