dataaccess

package
v0.0.0-...-4e290a4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 6, 2020 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

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

func (ic *ItemCollection) FindByID(ctx context.Context, id string) (database.IDItem, error)

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) Insert

func (ic *ItemCollection) Insert(ctx context.Context, item database.IDItem) (string, error)

Insert - creates a new item in the collection

func (*ItemCollection) RemoveByID

func (ic *ItemCollection) RemoveByID(ctx context.Context, id string) error

RemoveByID - removes the specified item from the collection

func (*ItemCollection) Update

func (ic *ItemCollection) Update(ctx context.Context, item database.IDItem) error

Update - updates an item in the collection

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL