Documentation ¶
Index ¶
- Variables
- type Manager
- type ShoppingItemManager
- func (m *ShoppingItemManager) AddItemToList(listID string, item types.ShoppingItemSpec) (itemInserted types.ShoppingItemSpec, err error)
- func (m *ShoppingItemManager) Delete(itemID string, listID string) (err error)
- func (m *ShoppingItemManager) DeleteAll(listID string) (err error)
- func (m *ShoppingItemManager) Get(listid, itemID string) (item types.ShoppingItemSpec, err error)
- func (m *ShoppingItemManager) GetListItemCount(listID string) (count int, err error)
- func (m *ShoppingItemManager) List(listID string, options types.ShoppingItemOptions) (items []types.ShoppingItemSpec, err error)
- func (m *ShoppingItemManager) Patch(listid string, itemID string, item types.ShoppingItemSpec) (itemPatched types.ShoppingItemSpec, err error)
- func (m *ShoppingItemManager) SetItemObtained(listID string, itemID string, obtained bool, authorLast string) (item types.ShoppingItemSpec, err error)
- func (m *ShoppingItemManager) Update(listID string, itemID string, item types.ShoppingItemSpec) (itemUpdated types.ShoppingItemSpec, err error)
- func (m *ShoppingItemManager) Validate(item types.ShoppingItemSpec) (valid bool, err error)
- type ShoppingListManager
- func (m *ShoppingListManager) Create(shoppingList types.ShoppingListSpec, options types.ShoppingItemOptions) (shoppingListInserted types.ShoppingListSpec, err error)
- func (m *ShoppingListManager) Delete(listID string) (err error)
- func (m *ShoppingListManager) Get(listID string) (shoppingList types.ShoppingListSpec, err error)
- func (m *ShoppingListManager) GetListCount() (count int, err error)
- func (m *ShoppingListManager) List(options types.ShoppingListOptions) (shoppingLists []types.ShoppingListSpec, err error)
- func (m *ShoppingListManager) Patch(listID string, shoppingList types.ShoppingListSpec) (shoppingListPatched types.ShoppingListSpec, err error)
- func (m *ShoppingListManager) SetListCompleted(listID string, completed bool, userID string) (list types.ShoppingListSpec, err error)
- func (m *ShoppingListManager) Update(listID string, shoppingList types.ShoppingListSpec) (shoppingListUpdated types.ShoppingListSpec, err error)
- func (m *ShoppingListManager) Validate(shoppingList types.ShoppingListSpec) (valid bool, err error)
- type ShoppingTagManager
- func (m *ShoppingTagManager) Create(newTag types.ShoppingTag) (tag types.ShoppingTag, err error)
- func (m *ShoppingTagManager) Delete(id string) (err error)
- func (m *ShoppingTagManager) Get(id string) (tag types.ShoppingTag, err error)
- func (m *ShoppingTagManager) GetInList(listID string, tag string) (tagInDB string, err error)
- func (m *ShoppingTagManager) List(options types.ShoppingTagOptions) (tags []types.ShoppingTag, err error)
- func (m *ShoppingTagManager) ListTagsInList(listID string) (tags []string, err error)
- func (m *ShoppingTagManager) Update(id string, tag types.ShoppingTag) (tagUpdated types.ShoppingTag, err error)
- func (m *ShoppingTagManager) UpdateInList(listID string, tag string, tagUpdate string) (tagNew string, err error)
- func (m *ShoppingTagManager) Validate(tag types.ShoppingTag) (valid bool, err error)
Constants ¶
This section is empty.
Variables ¶
var ( ErrFailedToAddItemToShoppingListFromTemplate = fmt.Errorf("Failed to add new item to new shopping list from template") ErrFailedToCreateShoppingList = fmt.Errorf("Failed to create shopping list") ErrFailedToFindShoppingTagToUpdate = fmt.Errorf("Unable to find tag to update") ErrFailedToGetExistingShoppingList = fmt.Errorf("Failed to get existing shopping list") ErrFailedToGetItemsFromShoppingList = fmt.Errorf("Failed to get items from shopping list") ErrFailedToPatchShoppingList = fmt.Errorf("Failed to patch shopping list") ErrFailedToRemoveAllItemsFromList = fmt.Errorf("Failed to remove all items from list") ErrFailedToUpdateShoppingItemFields = fmt.Errorf("Failed to update fields in the item") ErrInvalidItemQuantityMustBeOne = fmt.Errorf("Unable to use item quantity must be at least one") ErrInvalidShoppingItemName = fmt.Errorf("Unable to use the provided name, as it is either empty or too long or too short") ErrInvalidShoppingItemTag = fmt.Errorf("Unable to use the provided tag, as it is either empty or too long or too short") ErrInvalidShoppingListNotes = fmt.Errorf("Unable to save shopping list notes, as they are too long") ErrInvalidShoppingItemNotes = fmt.Errorf("Unable to save shopping item notes, as they are too long") ErrShoppingListByIDNotFoundForTemplate = fmt.Errorf("Unable to find list to use as template from provided id") )
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func (*Manager) ShoppingItem ¶
func (m *Manager) ShoppingItem() *ShoppingItemManager
func (*Manager) ShoppingList ¶
func (m *Manager) ShoppingList() *ShoppingListManager
func (*Manager) ShoppingTag ¶
func (m *Manager) ShoppingTag() *ShoppingTagManager
type ShoppingItemManager ¶
type ShoppingItemManager struct {
// contains filtered or unexported fields
}
func (*ShoppingItemManager) AddItemToList ¶
func (m *ShoppingItemManager) AddItemToList(listID string, item types.ShoppingItemSpec) (itemInserted types.ShoppingItemSpec, err error)
AddItemToList ... adds a new item
func (*ShoppingItemManager) Delete ¶
func (m *ShoppingItemManager) Delete(itemID string, listID string) (err error)
Delete ... given an item id, remove it
func (*ShoppingItemManager) DeleteAll ¶
func (m *ShoppingItemManager) DeleteAll(listID string) (err error)
DeleteAll ... given an item id, remove all items
func (*ShoppingItemManager) Get ¶
func (m *ShoppingItemManager) Get(listid, itemID string) (item types.ShoppingItemSpec, err error)
Get ... given an item id, return it's properties
func (*ShoppingItemManager) GetListItemCount ¶
func (m *ShoppingItemManager) GetListItemCount(listID string) (count int, err error)
GetListItemCount ... returns a count of the items in a list
func (*ShoppingItemManager) List ¶
func (m *ShoppingItemManager) List(listID string, options types.ShoppingItemOptions) (items []types.ShoppingItemSpec, err error)
List ... returns a list of items on a shopping list
func (*ShoppingItemManager) Patch ¶
func (m *ShoppingItemManager) Patch(listid string, itemID string, item types.ShoppingItemSpec) (itemPatched types.ShoppingItemSpec, err error)
Patch ... patches a shopping item
func (*ShoppingItemManager) SetItemObtained ¶
func (m *ShoppingItemManager) SetItemObtained(listID string, itemID string, obtained bool, authorLast string) (item types.ShoppingItemSpec, err error)
SetItemObtained ... updates the item's obtained field
func (*ShoppingItemManager) Update ¶
func (m *ShoppingItemManager) Update(listID string, itemID string, item types.ShoppingItemSpec) (itemUpdated types.ShoppingItemSpec, err error)
Update ... patches a shopping item
func (*ShoppingItemManager) Validate ¶
func (m *ShoppingItemManager) Validate(item types.ShoppingItemSpec) (valid bool, err error)
Validate ... given a shopping list item, return it's validity
type ShoppingListManager ¶
type ShoppingListManager struct {
// contains filtered or unexported fields
}
func (*ShoppingListManager) Create ¶
func (m *ShoppingListManager) Create(shoppingList types.ShoppingListSpec, options types.ShoppingItemOptions) (shoppingListInserted types.ShoppingListSpec, err error)
Create ... creates a shopping list for adding items to
func (*ShoppingListManager) Delete ¶
func (m *ShoppingListManager) Delete(listID string) (err error)
DeleteShoppingList ... deletes a shopping list, given a shopping list Id
func (*ShoppingListManager) Get ¶
func (m *ShoppingListManager) Get(listID string) (shoppingList types.ShoppingListSpec, err error)
Get ... returns a given shopping list, by it's ID
func (*ShoppingListManager) GetListCount ¶
func (m *ShoppingListManager) GetListCount() (count int, err error)
GetListCount ... returns a count lists
func (*ShoppingListManager) List ¶
func (m *ShoppingListManager) List(options types.ShoppingListOptions) (shoppingLists []types.ShoppingListSpec, err error)
List ... returns a list of all shopping lists (name, notes, author, etc...)
func (*ShoppingListManager) Patch ¶
func (m *ShoppingListManager) Patch(listID string, shoppingList types.ShoppingListSpec) (shoppingListPatched types.ShoppingListSpec, err error)
Patch ... patches a shopping list
func (*ShoppingListManager) SetListCompleted ¶
func (m *ShoppingListManager) SetListCompleted(listID string, completed bool, userID string) (list types.ShoppingListSpec, err error)
SetListCompleted ... updates the list's completed field
func (*ShoppingListManager) Update ¶
func (m *ShoppingListManager) Update(listID string, shoppingList types.ShoppingListSpec) (shoppingListUpdated types.ShoppingListSpec, err error)
UpdateShoppingList ... updates a shopping list
func (*ShoppingListManager) Validate ¶
func (m *ShoppingListManager) Validate(shoppingList types.ShoppingListSpec) (valid bool, err error)
Validate ... given a shopping list, return it's validity
type ShoppingTagManager ¶
type ShoppingTagManager struct {
// contains filtered or unexported fields
}
func (*ShoppingTagManager) Create ¶
func (m *ShoppingTagManager) Create(newTag types.ShoppingTag) (tag types.ShoppingTag, err error)
Create ... adds a new tag to be used in lists
func (*ShoppingTagManager) Delete ¶
func (m *ShoppingTagManager) Delete(id string) (err error)
Delete ... deletes a shopping tag
func (*ShoppingTagManager) Get ¶
func (m *ShoppingTagManager) Get(id string) (tag types.ShoppingTag, err error)
Get ... returns a tag, given an id
func (*ShoppingTagManager) GetInList ¶
func (m *ShoppingTagManager) GetInList(listID string, tag string) (tagInDB string, err error)
GetInList ... returns a tags used in items in a list
func (*ShoppingTagManager) List ¶
func (m *ShoppingTagManager) List(options types.ShoppingTagOptions) (tags []types.ShoppingTag, err error)
List ... returns a list of all tags used in items across lists
func (*ShoppingTagManager) ListTagsInList ¶
func (m *ShoppingTagManager) ListTagsInList(listID string) (tags []string, err error)
ListTagsInList ... returns a list of tags used in items in a list
func (*ShoppingTagManager) Update ¶
func (m *ShoppingTagManager) Update(id string, tag types.ShoppingTag) (tagUpdated types.ShoppingTag, err error)
UpdateShoppingTag ... updates a tag's name
func (*ShoppingTagManager) UpdateInList ¶
func (m *ShoppingTagManager) UpdateInList(listID string, tag string, tagUpdate string) (tagNew string, err error)
UpdateInList ... updates a tag's name in a list
func (*ShoppingTagManager) Validate ¶
func (m *ShoppingTagManager) Validate(tag types.ShoppingTag) (valid bool, err error)
Validate ... given a shopping tag, return it's validity