kekcollections

package module
v0.0.0-...-b0d47bd Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const COLLECTION_PATH = "c/"
View Source
const SLUG_PATH = "slugs/"

Variables

This section is empty.

Functions

This section is empty.

Types

type Collection

type Collection struct {
	ResourceIds map[string]bool       `json:"resource_ids"`
	Slug        string                `json:"slug"`
	CreatedAt   time.Time             `json:"created_at"`
	UpdatedAt   time.Time             `json:"updated_at"`
	Id          string                `json:"id"`
	Name        string                `json:"name"`
	Description string                `json:"description"`
	Revisions   revchain.ChainMaker   `json:"revisions"`
	Rev         string                `json:"rev"`
	Docs        map[string]kek.Doc    `json:"docs"`
	Collections map[string]Collection `json:"collections"`
	// contains filtered or unexported fields
}

func (*Collection) AddResource

func (c *Collection) AddResource(resourceId string) error

func (Collection) All

func (c Collection) All(withDocs bool, withKek bool) (map[string]Collection, error)

func (Collection) Delete

func (c Collection) Delete(delRev bool) error

func (*Collection) DeleteResource

func (c *Collection) DeleteResource(resourceId string) error

func (Collection) LoadById

func (c Collection) LoadById(id string, withResources, withRevisions bool) (Collection, error)

func (Collection) LoadBySlug

func (c Collection) LoadBySlug(slug string, withResources, withKek bool) (Collection, error)

func (Collection) New

func (c Collection) New(name, description string, resourceIds map[string]bool) (Collection, error)

New generates and stores a new Collection item based on the current store location. You can optionally specify the initial name, description and resourceIds or just leave zero values. It will create the remaining properties of CreatedAt, UpdatedAt, Id, Slug, Revision & Revisions. You shouldn't ever set these values.

func (Collection) Save

func (c Collection) Save() error

func (Collection) SetStore

func (c Collection) SetStore(store kekstore.Storer) Collection

SetStore sets the location for which to store the collections. By default, Collections will use the kekstore.Store which stores content in the ~/.kek directory. You probably should avoid setting the store unless you are testing or are positive you want to change the location that you are storing your kek collections.

func (Collection) Store

func (c Collection) Store() kekstore.Storer

Store returns back the collection store location.

Jump to

Keyboard shortcuts

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