Documentation ¶
Index ¶
- func RouterItems(itemRepo Repository, router *httprouter.Router)
- type ItemController
- func (c *ItemController) Create(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (c *ItemController) Delete(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (c *ItemController) Find(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (c *ItemController) List(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- func (c *ItemController) Update(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
- type ItemService
- func (s *ItemService) AddItem(item models.Item) error
- func (s *ItemService) DeleteItemByName(name string) error
- func (s *ItemService) GetAllItems() ([]models.Item, error)
- func (s *ItemService) GetItemByName(name string) (models.Item, error)
- func (s *ItemService) IsValid(item models.Item) (bool, string)
- func (s *ItemService) ItemExists(name string) bool
- func (s *ItemService) UpdateItem(item models.Item) error
- type MongoRepository
- func (r *MongoRepository) AddItem(item models.Item) error
- func (r *MongoRepository) DeleteItemByName(name string) error
- func (r *MongoRepository) GetAllItems() ([]models.Item, error)
- func (r *MongoRepository) GetItemByName(name string) (models.Item, error)
- func (r *MongoRepository) UpdateItem(item models.Item) error
- type Read
- type Repository
- type Service
- type Write
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ItemController ¶
type ItemController struct {
// contains filtered or unexported fields
}
ItemController |
func NewItemController ¶
func NewItemController(service *ItemService) *ItemController
NewItemController |
func (*ItemController) Create ¶
func (c *ItemController) Create(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
Create |
func (*ItemController) Delete ¶
func (c *ItemController) Delete(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
Delete |
func (*ItemController) Find ¶
func (c *ItemController) Find(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
Find |
func (*ItemController) List ¶
func (c *ItemController) List(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
List |
func (*ItemController) Update ¶
func (c *ItemController) Update(w http.ResponseWriter, r *http.Request, ps httprouter.Params)
Update |
type ItemService ¶
type ItemService struct {
// contains filtered or unexported fields
}
ItemService |
func (*ItemService) DeleteItemByName ¶
func (s *ItemService) DeleteItemByName(name string) error
DeleteItemByName |
func (*ItemService) GetAllItems ¶
func (s *ItemService) GetAllItems() ([]models.Item, error)
GetAllItems |
func (*ItemService) GetItemByName ¶
func (s *ItemService) GetItemByName(name string) (models.Item, error)
GetItemByName |
func (*ItemService) IsValid ¶
func (s *ItemService) IsValid(item models.Item) (bool, string)
IsValid |
func (*ItemService) UpdateItem ¶
func (s *ItemService) UpdateItem(item models.Item) error
UpdateItem |
type MongoRepository ¶
type MongoRepository struct {
// contains filtered or unexported fields
}
MongoRepository |
func NewMongoRepository ¶
func NewMongoRepository(session *mgo.Session) *MongoRepository
NewMongoRepository |
func (*MongoRepository) AddItem ¶
func (r *MongoRepository) AddItem(item models.Item) error
AddItem |
func (*MongoRepository) DeleteItemByName ¶
func (r *MongoRepository) DeleteItemByName(name string) error
DeleteItemByName |
func (*MongoRepository) GetAllItems ¶
func (r *MongoRepository) GetAllItems() ([]models.Item, error)
GetAllItems |
func (*MongoRepository) GetItemByName ¶
func (r *MongoRepository) GetItemByName(name string) (models.Item, error)
GetItemByName |
func (*MongoRepository) UpdateItem ¶
func (r *MongoRepository) UpdateItem(item models.Item) error
UpdateItem |
Click to show internal directories.
Click to hide internal directories.