Documentation
¶
Overview ¶
Package application is the package that holds the application logic between database and communication layers
Package application is the package that holds the application logic between database and communication layers ¶
Package application is the package that holds the application logic between database and communication layers ¶
Package application is the package that holds the application logic between database and communication layers ¶
Package application is the package that holds the application logic between database and communication layers
Index ¶
- type DataContext
- type DataContextCarrier
- type LookupRepository
- type LookupService
- func (ls LookupService) ListAreas() ([]domain.Area, error)
- func (ls LookupService) ListCities() ([]domain.City, error)
- func (ls LookupService) ListMembershipTypes() ([]domain.MembershipType, error)
- func (ls LookupService) ListProvinceCities(provinceID string) ([]domain.City, error)
- func (ls LookupService) ListProvinces() ([]domain.Province, error)
- type MemberRepository
- type MemberService
- func (ms MemberService) CreateMember(member domain.Member) (string, error)
- func (ms MemberService) GetMember(id string) (domain.Member, error)
- func (ms MemberService) ListMembers(pageSize, pageNum int, searchName string, searchCity int, searchArea int) ([]domain.Member, int, error)
- func (ms MemberService) UpdateMember(member domain.Member) error
- type UserRepository
- type UserService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataContext ¶
type DataContext struct {
// contains filtered or unexported fields
}
DataContext represents a struct that holds concrete repositories
func (*DataContext) GetLookupRepository ¶
func (dc *DataContext) GetLookupRepository() LookupRepository
GetLookupRepository returns the lookup repository
func (*DataContext) GetMemberRepository ¶
func (dc *DataContext) GetMemberRepository() MemberRepository
GetMemberRepository returns the member repository
func (*DataContext) GetUserRepository ¶
func (dc *DataContext) GetUserRepository() UserRepository
GetUserRepository returns the user repository
func (*DataContext) SetRepositories ¶
func (dc *DataContext) SetRepositories(ur UserRepository, mr MemberRepository, lr LookupRepository)
SetRepositories sets the repositories of the datacontext
type DataContextCarrier ¶
type DataContextCarrier interface { SetRepositories(ur UserRepository, mr MemberRepository, lr LookupRepository) GetUserRepository() UserRepository GetMemberRepository() MemberRepository GetLookupRepository() LookupRepository }
DataContextCarrier is the interface to be passed to the application layer
type LookupRepository ¶
type LookupRepository interface { ListCities() ([]domain.City, error) ListProvinceCities(provinceID string) ([]domain.City, error) ListAreas() ([]domain.Area, error) ListProvinces() ([]domain.Province, error) ListMembershipTypes() ([]domain.MembershipType, error) }
LookupRepository is the interface to interact with Lookup objects
type LookupService ¶
type LookupService struct {
// contains filtered or unexported fields
}
LookupService is the struct to let outer layers to interact to the Lookup Applicatopn
func NewLookupService ¶
func NewLookupService(dc DataContextCarrier) LookupService
NewLookupService creates a new LookupService instance and sets its repository
func (LookupService) ListAreas ¶
func (ls LookupService) ListAreas() ([]domain.Area, error)
ListAreas simply returns the whole list of areas or an error that is returned from the repository
func (LookupService) ListCities ¶
func (ls LookupService) ListCities() ([]domain.City, error)
ListCities simply returns the whole list of cities or an error that is returned from the repository
func (LookupService) ListMembershipTypes ¶
func (ls LookupService) ListMembershipTypes() ([]domain.MembershipType, error)
ListMembershipTypes simply returns the whole list of membership types or an error that is returned from the repository
func (LookupService) ListProvinceCities ¶
func (ls LookupService) ListProvinceCities(provinceID string) ([]domain.City, error)
ListProvinceCities simply returns the whole list of cities in the given province or an error that is returned from the repository
func (LookupService) ListProvinces ¶
func (ls LookupService) ListProvinces() ([]domain.Province, error)
ListProvinces simply returns the whole list of provinces or an error that is returned from the repository
type MemberRepository ¶
type MemberRepository interface { ListMembers(pageSize, pageNum int, searchName string, searchCity int, searchArea int) ([]domain.Member, int, error) GetMember(id string) (domain.Member, error) UpdateMember(member domain.Member) error CreateMember(member domain.Member) (string, error) }
MemberRepository is the interface to interact with Member domain object
type MemberService ¶
type MemberService struct {
// contains filtered or unexported fields
}
MemberService is the struct to let outer layers to interact to the Member Applicatopn
func NewMemberService ¶
func NewMemberService(dc DataContextCarrier) MemberService
NewMemberService creates a new MemberService instance and sets its repository
func (MemberService) CreateMember ¶
func (ms MemberService) CreateMember(member domain.Member) (string, error)
CreateMember simply creates a new member with the given data or an error that is returned from the repository
func (MemberService) GetMember ¶
func (ms MemberService) GetMember(id string) (domain.Member, error)
GetMember simply returns the member with the given id or an error that is returned from the repository
func (MemberService) ListMembers ¶
func (ms MemberService) ListMembers(pageSize, pageNum int, searchName string, searchCity int, searchArea int) ([]domain.Member, int, error)
ListMembers simply returns the whole list of member or an error that is returned from the repository
func (MemberService) UpdateMember ¶
func (ms MemberService) UpdateMember(member domain.Member) error
UpdateMember simply updates the member with the given id or an error that is returned from the repository
type UserRepository ¶
type UserRepository interface { GetUser(ID string) (domain.User, error) CheckUser(username string) (domain.User, error) AddUser(u domain.User) (string, error) UpdateUser(u domain.User) error AddConfirmationCode(userID string, confirmationCode string) error CheckConfirmationCode(userID string, confirmationCode string) error ActivateUser(userID string) error }
UserRepository is the interface to interact with User domain object
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
UserService is the struct to let outer layers to interact to the User Applicatopn
func NewUserService ¶
func NewUserService(dc DataContextCarrier) UserService
NewUserService creates a new UserService instance and sets its repository
func (UserService) CheckConfirmationCode ¶
func (us UserService) CheckConfirmationCode(userID string, confirmationCode string) error
CheckConfirmationCode checks if the confirmation code matches the one in the repository, if so, activates the user
func (UserService) CheckUser ¶
func (us UserService) CheckUser(username, password string) (domain.User, error)
CheckUser checks if the username and password maches any from the repository by first hashing its password, returns error if none found
func (UserService) GetUser ¶
func (us UserService) GetUser(ID string) (domain.User, error)
GetUser simply returns a single user or an error that is returned from the repository
func (UserService) UpsertUser ¶
func (us UserService) UpsertUser(u domain.User) (string, error)
UpsertUser inserts or updates a user to the repository by first hashing its password