community: Index | Files

package category

import ""

Package category handles API calls and persistence for categories. Categories sub-divide spaces.


Package Files

endpoint.go store.go

type Handler Uses

type Handler struct {
    Runtime *env.Runtime
    Store   *store.Store

Handler contains the runtime information such as logging and database.

func (*Handler) Add Uses

func (h *Handler) Add(w http.ResponseWriter, r *http.Request)

Add saves space category.

func (*Handler) Delete Uses

func (h *Handler) Delete(w http.ResponseWriter, r *http.Request)

Delete removes category and associated member records.

func (*Handler) FetchSpaceData Uses

func (h *Handler) FetchSpaceData(w http.ResponseWriter, r *http.Request)

FetchSpaceData returns: 1. categories that user can see for given space 2. summary data for each category 3. category viewing membership records

func (*Handler) Get Uses

func (h *Handler) Get(w http.ResponseWriter, r *http.Request)

Get returns categories visible to user within a space.

func (*Handler) GetAll Uses

func (h *Handler) GetAll(w http.ResponseWriter, r *http.Request)

GetAll returns categories within a space, disregarding permissions. Used in admin screens, lists, functions.

func (*Handler) GetDocumentCategoryMembership Uses

func (h *Handler) GetDocumentCategoryMembership(w http.ResponseWriter, r *http.Request)

GetDocumentCategoryMembership returns user viewable categories associated with a given document.

func (*Handler) GetSpaceCategoryMembers Uses

func (h *Handler) GetSpaceCategoryMembers(w http.ResponseWriter, r *http.Request)

GetSpaceCategoryMembers returns category/document associations within space.

func (*Handler) GetSummary Uses

func (h *Handler) GetSummary(w http.ResponseWriter, r *http.Request)

GetSummary returns number of documents and users for space categories.

func (*Handler) SetDocumentCategoryMembership Uses

func (h *Handler) SetDocumentCategoryMembership(w http.ResponseWriter, r *http.Request)

SetDocumentCategoryMembership will link/unlink document from categories (query string switch mode=link or mode=unlink).

func (*Handler) Update Uses

func (h *Handler) Update(w http.ResponseWriter, r *http.Request)

Update saves existing space category.

type Store Uses

type Store struct {

Store provides data access to space category information.

func (Store) Add Uses

func (s Store) Add(ctx domain.RequestContext, c category.Category) (err error)

Add inserts the given record into the category table.

func (Store) AssociateDocument Uses

func (s Store) AssociateDocument(ctx domain.RequestContext, m category.Member) (err error)

AssociateDocument inserts category membership record into the category member table.

func (Store) Delete Uses

func (s Store) Delete(ctx domain.RequestContext, id string) (rows int64, err error)

Delete removes category from the store.

func (Store) DeleteBySpace Uses

func (s Store) DeleteBySpace(ctx domain.RequestContext, spaceID string) (rows int64, err error)

DeleteBySpace removes all category and category associations for given space.

func (Store) DisassociateDocument Uses

func (s Store) DisassociateDocument(ctx domain.RequestContext, categoryID, documentID string) (rows int64, err error)

DisassociateDocument removes document associatation from category.

func (Store) Get Uses

func (s Store) Get(ctx domain.RequestContext, id string) (c category.Category, err error)

Get returns specified category

func (Store) GetAllBySpace Uses

func (s Store) GetAllBySpace(ctx domain.RequestContext, spaceID string) (c []category.Category, err error)

GetAllBySpace returns all space categories.

func (Store) GetByOrg Uses

func (s Store) GetByOrg(ctx domain.RequestContext, userID string) (c []category.Category, err error)

GetByOrg returns all categories accessible by user for their org.

func (Store) GetBySpace Uses

func (s Store) GetBySpace(ctx domain.RequestContext, spaceID string) (c []category.Category, err error)

GetBySpace returns space categories accessible by user. Context is used to for user ID.

func (Store) GetDocumentCategoryMembership Uses

func (s Store) GetDocumentCategoryMembership(ctx domain.RequestContext, documentID string) (c []category.Category, err error)

GetDocumentCategoryMembership returns all space categories associated with given document.

func (Store) GetOrgCategoryMembership Uses

func (s Store) GetOrgCategoryMembership(ctx domain.RequestContext, userID string) (c []category.Member, err error)

GetOrgCategoryMembership returns category/document associations within organization.

func (Store) GetSpaceCategoryMembership Uses

func (s Store) GetSpaceCategoryMembership(ctx domain.RequestContext, spaceID string) (c []category.Member, err error)

GetSpaceCategoryMembership returns category/document associations within space, for specified user.

func (Store) GetSpaceCategorySummary Uses

func (s Store) GetSpaceCategorySummary(ctx domain.RequestContext, spaceID string) (c []category.SummaryModel, err error)

GetSpaceCategorySummary returns number of documents and users for space categories.

func (Store) RemoveCategoryMembership Uses

func (s Store) RemoveCategoryMembership(ctx domain.RequestContext, categoryID string) (rows int64, err error)

RemoveCategoryMembership removes all category associations from the store.

func (Store) RemoveDocumentCategories Uses

func (s Store) RemoveDocumentCategories(ctx domain.RequestContext, documentID string) (rows int64, err error)

RemoveDocumentCategories removes all document category associations from the store.

func (Store) RemoveSpaceCategoryMemberships Uses

func (s Store) RemoveSpaceCategoryMemberships(ctx domain.RequestContext, spaceID string) (rows int64, err error)

RemoveSpaceCategoryMemberships removes all category associations from the store for the space.

func (Store) Update Uses

func (s Store) Update(ctx domain.RequestContext, c category.Category) (err error)

Update saves category name change.

Package category imports 18 packages (graph) and is imported by 2 packages. Updated 2019-11-21. Refresh now. Tools for package owners.