Documentation ¶
Index ¶
- Constants
- func GenerateSchema(c *ContentType) ([]byte, error)
- func Init(d string, s Store)
- type ContentType
- type Field
- type Repository
- func (r *Repository) CreateIndex(namespace string) error
- func (r *Repository) GetDocument(typeID, id string) ([]byte, error)
- func (r *Repository) GetSchema(id string) ([]byte, error)
- func (r *Repository) GetType(id string) ([]byte, error)
- func (r *Repository) IndexDocument(namespace, id string, document []byte) error
- func (r *Repository) ListDocuments(typeID string) ([][]byte, error)
- func (r *Repository) PutDocument(typeID, id string, content []byte) error
- func (r *Repository) PutSchema(id string, content []byte) error
- func (r *Repository) PutType(id string, content []byte) error
- func (r *Repository) Query(namespace, query string, count, offset int) ([]string, error)
- type Store
Constants ¶
const ContentTypeSchema = `` /* 1359-byte string literal not displayed */
ContentTypeSchema is the core schema for all content types
Variables ¶
This section is empty.
Functions ¶
func GenerateSchema ¶
func GenerateSchema(c *ContentType) ([]byte, error)
GenerateSchema generates a JSON schema for a given ContentType
Types ¶
type ContentType ¶
type ContentType struct { ID string `json:"id"` Type string `json:"type"` Name string `json:"name"` Description string `json:"description"` DisplayField string `json:"displayField"` Fields []*Field `json:"fields"` }
ContentType defines the structure
type Field ¶
type Field struct { ID string `json:"id"` Type string `json:"type"` Required bool `json:"required"` Items struct { Type string `json:"type"` ReferenceType string `json:"referenceType"` ReferenceID string `json:"referenceID"` } `json:"items,omitempty"` }
Field defines the structure
type Repository ¶
Repository represents a single repository
func NewRepository ¶
func NewRepository(name string) (*Repository, error)
NewRepository returns a Repository for the given store/bucket
func (*Repository) CreateIndex ¶
func (r *Repository) CreateIndex(namespace string) error
CreateIndex is an experiment with indexing
func (*Repository) GetDocument ¶
func (r *Repository) GetDocument(typeID, id string) ([]byte, error)
GetDocument gets a document from the Repository
func (*Repository) GetSchema ¶
func (r *Repository) GetSchema(id string) ([]byte, error)
GetSchema gets a schema from the Repository
func (*Repository) GetType ¶
func (r *Repository) GetType(id string) ([]byte, error)
GetType returns a type from the repository
func (*Repository) IndexDocument ¶
func (r *Repository) IndexDocument(namespace, id string, document []byte) error
IndexDocument indexes the document in the correct index with the given id
func (*Repository) ListDocuments ¶
func (r *Repository) ListDocuments(typeID string) ([][]byte, error)
ListDocuments returns a collection of documents of the specified type
func (*Repository) PutDocument ¶
func (r *Repository) PutDocument(typeID, id string, content []byte) error
PutDocument stores a document in the Repository
func (*Repository) PutSchema ¶
func (r *Repository) PutSchema(id string, content []byte) error
PutSchema stores a schema in the repository
type Store ¶
type Store interface { CreateBucket(name string) error PutDocument(bucket, namespace, id string, data []byte) error GetDocument(bucket, namespace, id string) ([]byte, error) ListDocuments(bucket, namespace string) ([][]byte, error) Close() error }
Store is the generic interface to a uCMS store