Documentation ¶
Index ¶
- func DeleteItemHandler(ctx api.Context, itemCollection *ItemCollection) http.HandlerFunc
- func FindItemsHandler(ctx api.Context, itemCollection *ItemCollection, formKeys ...string) http.HandlerFunc
- func GetAllItemsHandler(ctx api.Context, itemCollection *ItemCollection) http.HandlerFunc
- func GetItemHandler(ctx api.Context, itemCollection *ItemCollection) http.HandlerFunc
- func PostItemFromDataHandler(ctx api.Context, itemCollection *ItemCollection) http.HandlerFunc
- func PostItemHandler(ctx api.Context, itemCollection *ItemCollection) http.HandlerFunc
- func UpdateItemFromDataHandler(ctx api.Context, itemCollection *ItemCollection) http.HandlerFunc
- func UpdateItemHandler(ctx api.Context, itemCollection *ItemCollection) http.HandlerFunc
- type ItemCollection
- func (ic *ItemCollection) Count(ctx context.Context) (int64, error)
- func (ic *ItemCollection) FindAll(ctx context.Context) (interface{}, error)
- func (ic *ItemCollection) FindByID(ctx context.Context, id string) (database.IDItem, error)
- func (ic *ItemCollection) FindByQuery(ctx context.Context, query map[string]interface{}) (interface{}, error)
- func (ic *ItemCollection) GetItemName() string
- func (ic *ItemCollection) GetName() string
- func (ic *ItemCollection) Insert(ctx context.Context, item database.IDItem) (string, error)
- func (ic *ItemCollection) RemoveByID(ctx context.Context, id string) error
- func (ic *ItemCollection) Update(ctx context.Context, item database.IDItem) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteItemHandler ¶
func DeleteItemHandler(ctx api.Context, itemCollection *ItemCollection) http.HandlerFunc
DeleteItemHandler handles deleting a single item
func FindItemsHandler ¶
func FindItemsHandler(ctx api.Context, itemCollection *ItemCollection, formKeys ...string) http.HandlerFunc
FindItemsHandler is the handler for finding items in a collection using URL parameters
func GetAllItemsHandler ¶
func GetAllItemsHandler(ctx api.Context, itemCollection *ItemCollection) http.HandlerFunc
GetAllItemsHandler is the handler for all items in a collection
func GetItemHandler ¶
func GetItemHandler(ctx api.Context, itemCollection *ItemCollection) http.HandlerFunc
GetItemHandler is the handler for a single item
func PostItemFromDataHandler ¶
func PostItemFromDataHandler(ctx api.Context, itemCollection *ItemCollection) http.HandlerFunc
PostItemFromDataHandler is a handler for item interface that accepts message json
func PostItemHandler ¶
func PostItemHandler(ctx api.Context, itemCollection *ItemCollection) http.HandlerFunc
PostItemHandler is a handler for item interface that accepts message json
func UpdateItemFromDataHandler ¶
func UpdateItemFromDataHandler(ctx api.Context, itemCollection *ItemCollection) http.HandlerFunc
UpdateItemFromDataHandler handles updating a single item
func UpdateItemHandler ¶
func UpdateItemHandler(ctx api.Context, itemCollection *ItemCollection) http.HandlerFunc
UpdateItemHandler handles updating a single item
Types ¶
type ItemCollection ¶
type ItemCollection struct {
// contains filtered or unexported fields
}
ItemCollection for handling access to a collection of items through a data access object interface
func NewItemCollection ¶
func NewItemCollection(itemDisplayName string, queryLimit int64, dao database.DAO, initialiseItem func() database.IDItem, initialiseList func() interface{}, initialiseFormData func() database.ItemFormData, ) *ItemCollection
NewItemCollection - new instance of a collection of items
func (*ItemCollection) Count ¶
func (ic *ItemCollection) Count(ctx context.Context) (int64, error)
Count - returns the number of items in the collection
func (*ItemCollection) FindAll ¶
func (ic *ItemCollection) FindAll(ctx context.Context) (interface{}, error)
FindAll - returns all items from the collection
func (*ItemCollection) FindByID ¶
FindByID - returns the specified item from the collection using item ID and returns an interface to it
func (*ItemCollection) FindByQuery ¶
func (ic *ItemCollection) FindByQuery(ctx context.Context, query map[string]interface{}) (interface{}, error)
FindByQuery - returns a list of items according to the query and returns an interface to it
func (*ItemCollection) GetItemName ¶
func (ic *ItemCollection) GetItemName() string
GetItemName - returns name the items in the collection
func (*ItemCollection) GetName ¶
func (ic *ItemCollection) GetName() string
GetName - returns name of collection
func (*ItemCollection) RemoveByID ¶
func (ic *ItemCollection) RemoveByID(ctx context.Context, id string) error
RemoveByID - removes the specified item from the collection