Documentation
¶
Index ¶
- Constants
- type Collection
- func (c *Collection) AddResource(resourceId string) error
- func (c Collection) All(withDocs bool, withKek bool) (map[string]Collection, error)
- func (c Collection) Delete(delRev bool) error
- func (c *Collection) DeleteResource(resourceId string) error
- func (c Collection) LoadById(id string, withResources, withRevisions bool) (Collection, error)
- func (c Collection) LoadBySlug(slug string, withResources, withKek bool) (Collection, error)
- func (c Collection) New(name, description string, resourceIds map[string]bool) (Collection, error)
- func (c Collection) Save() error
- func (c Collection) SetStore(store kekstore.Storer) Collection
- func (c Collection) Store() kekstore.Storer
Constants ¶
const COLLECTION_PATH = "c/"
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.