Versions in this module Expand all Collapse all v1 v1.0.0 Mar 12, 2023 Changes in this version + var ErrRecordNotFound = errors.New("record not found") + func OpenDB(t *testing.T) (*gorm.DB, func()) + type Book struct + Author string + ID string + Name string + OwnerID string + Status string + type BookOperationsService interface + ListByUser func(userID string) ([]Book, error) + type BookService struct + DB *gorm.DB + func NewBookService(db *gorm.DB, ps PostingService) *BookService + func (bs *BookService) Get(id string) (*Book, error) + func (bs *BookService) List() ([]Book, error) + func (bs *BookService) ListByUser(userID string) ([]Book, error) + func (bs *BookService) SwapBook(bookID, userID string) (*Book, error) + func (bs *BookService) Upsert(b Book) Book + type BookStatus int + const Available + const Swapped + func (o BookStatus) String() string + type Magazine struct + ID string + IssueNumber int + Name string + OwnerID string + Status string + type MagazineOperationsService interface + ListByUser func(userID string) ([]Magazine, error) + type MagazineService struct + DB *gorm.DB + func NewMagazineService(db *gorm.DB, ps PostingService) *MagazineService + func (ms *MagazineService) Get(id string) (*Magazine, error) + func (ms *MagazineService) List() ([]Magazine, error) + func (ms *MagazineService) ListByUser(userID string) ([]Magazine, error) + func (ms *MagazineService) SwapMagazine(magID, userID string) (*Magazine, error) + func (ms *MagazineService) Upsert(m Magazine) Magazine + type PostingService interface + NewBookOrder func(b Book) error + NewMagazineOrder func(m Magazine) error + func NewPostingService() PostingService + type StubbedPostingService struct + func (sps *StubbedPostingService) NewBookOrder(b Book) error + func (sps *StubbedPostingService) NewMagazineOrder(m Magazine) error + type User struct + Address string + Country string + ID string + Name string + PostCode string + type UserProfile struct + Books []Book + Magazines []Magazine + User User + type UserService struct + DB *gorm.DB + func NewUserService(db *gorm.DB, bs BookOperationsService, ms MagazineOperationsService) *UserService + func (us *UserService) Exists(id string) error + func (us *UserService) Get(id string) (*UserProfile, error) + func (us *UserService) Upsert(u User) (User, error)