Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var All = [...]string{"DbUserRepo", "DbAnimalRepo", "DbAdoptionRepo", "DbAdopterRepo"}
All is a list of all the repository names
Functions ¶
This section is empty.
Types ¶
type DbAdopterRepo ¶
type DbAdopterRepo DbRepo
DbAdopterRepo is the repository for adopters.
func NewDbAdopterRepo ¶
func NewDbAdopterRepo(dbHandlers map[string]DbHandler) *DbAdopterRepo
NewDbAdopterRepo istanciates and returns a user repository.
type DbAdoptionRepo ¶
type DbAdoptionRepo DbRepo
DbAdoptionRepo is the repository for adoptions.
func NewDbAdoptionRepo ¶
func NewDbAdoptionRepo(dbHandlers map[string]DbHandler) *DbAdoptionRepo
NewDbAdoptionRepo istanciates and returns a user repository.
func (*DbAdoptionRepo) FindAllByAdopterID ¶
func (db *DbAdoptionRepo) FindAllByAdopterID(id int) ([]domain.Adoption, error)
FindAllByAdopterID returns a list of all the adoptions related to the specified user ID.
func (*DbAdoptionRepo) FindByID ¶
func (db *DbAdoptionRepo) FindByID(id int) (domain.Adoption, error)
FindByID retrieves an adoptions given its ID
func (*DbAdoptionRepo) FindMaxID ¶
func (db *DbAdoptionRepo) FindMaxID() (id int, err error)
FindMaxID retrieves the last inserted ID. This is a bad practice, we are using it here just to enable the project to run as a demo.
type DbAnimalRepo ¶
type DbAnimalRepo DbRepo
DbAnimalRepo is the repository for animals.
func NewDbAnimalRepo ¶
func NewDbAnimalRepo(dbHandlers map[string]DbHandler) *DbAnimalRepo
NewDbAnimalRepo istanciates and returns a user repository.
func (*DbAnimalRepo) FindAllAdoptable ¶
func (db *DbAnimalRepo) FindAllAdoptable() ([]domain.Animal, error)
FindAllAdoptable returns a list of all the animals in the repository.
type DbHandler ¶
DbHandler is a high level interface that allows repository interrogation by hiding all the low level aspects.
type DbRepo ¶
type DbRepo struct {
// contains filtered or unexported fields
}
DbRepo represents a general repository. The handlers map lets every repository use any other repository without giving up dependency injection.
type DbUserRepo ¶
type DbUserRepo DbRepo
DbUserRepo is the repository for the users.
func NewDbUserRepo ¶
func NewDbUserRepo(dbHandlers map[string]DbHandler) *DbUserRepo
NewDbUserRepo istanciates and returns a user repository.