Documentation ¶
Index ¶
- type Content
- type ContentList
- type ContentNewParam
- type ContentRefSet
- type ContentType
- type ContentTypeField
- type ContentTypeList
- type ContentTypeNewParam
- type ContentTypeUpdateParam
- type ContentUpdateParam
- type ContentValue
- func (c *ContentValue) ID() string
- func (c *ContentValue) MarshalJSON() (ret []byte, err error)
- func (c *ContentValue) Name() string
- func (c *ContentValue) RefID() string
- func (c *ContentValue) RefListIDs() []string
- func (c *ContentValue) RefListNames() string
- func (c *ContentValue) RefName() string
- func (c *ContentValue) Type() string
- func (c *ContentValue) UnmarshalJSON(b []byte) error
- func (c *ContentValue) Value() string
- type DB
- func (db *DB) ContentDelete(space space.Space, ct contenttype.ContentType, content content.Content) error
- func (db *DB) ContentGet(space space.Space, ct contenttype.ContentType, contentID string) (content.Content, error)
- func (db *DB) ContentIter(space space.Space, ct contenttype.ContentType, sortField string) (*contentIter, *sql.Tx, error)
- func (db *DB) ContentNew(space space.Space, ct contenttype.ContentType, params []ContentNewParam) (content.Content, error)
- func (db *DB) ContentPerContentType(space space.Space, ct contenttype.ContentType, before int, order OrderType, ...) (content.ContentList, error)
- func (db *DB) ContentRefererList(contentID string) (ret []ContentRefSet, err error)
- func (db *DB) ContentSearch(space space.Space, ct contenttype.ContentType, sortField, query string, ...) (content.ContentList, error)
- func (db *DB) ContentTypeDelete(space space.Space, ct contenttype.ContentType) error
- func (db *DB) ContentTypeGet(space space.Space, contenttypeID string) (contenttype.ContentType, error)
- func (db *DB) ContentTypeIter(t *sql.Tx, space space.Space) *contentTypeIter
- func (db *DB) ContentTypeNew(space space.Space, name string, params []ContentTypeNewParam) (contenttype.ContentType, error)
- func (db *DB) ContentTypeSearch(space space.Space, query string, before int) (contenttype.ContentTypeList, error)
- func (db *DB) ContentTypeUpdate(space space.Space, contenttype contenttype.ContentType, name string, ...) (contenttype.ContentType, error)
- func (db *DB) ContentTypesPerSpace(space space.Space, before int) (contenttype.ContentTypeList, error)
- func (db *DB) ContentUpdate(space space.Space, ct contenttype.ContentType, content content.Content, ...) (content.Content, error)
- func (db *DB) EnsureSetup() error
- func (db *DB) FileExists(URL string) (bool, error)
- func (db *DB) HookDelete(s space.Space, h hook.Hook) error
- func (db *DB) HookGet(space space.Space, id string) (hook.Hook, error)
- func (db *DB) HookIter(t *sql.Tx, space space.Space) *hookIter
- func (db *DB) HookNew(space space.Space, url string) (hook.Hook, error)
- func (db *DB) HooksPerSpace(space space.Space, before int) (hook.HookList, error)
- func (db *DB) SpaceCopy(user user.User, prevS space.Space, name, desc string) (space.Space, error)
- func (db *DB) SpaceDelete(user user.User, space space.Space) error
- func (db *DB) SpaceGet(user user.User, spaceID string) (space.Space, error)
- func (db *DB) SpaceNew(user user.User, name, desc string) (space.Space, error)
- func (db *DB) SpaceUpdate(user user.User, space space.Space, name, desc string) (space.Space, error)
- func (db *DB) SpacesPerUser(user user.User, before int) (space.SpaceList, error)
- func (db *DB) UserGet(username, password string) (user.User, error)
- func (db *DB) UserGetFromToken(token string) (user.User, error)
- func (db *DB) UserNew(username, password, verifyPassword string) (user.User, error)
- type Hook
- type HookList
- type OrderType
- type Space
- type SpaceList
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Content ¶
type Content struct { // In DB. ContentID string ContentParentTypeID string // We set. ContentValues []ContentValue }
type ContentList ¶
type ContentList struct { ContentList []content.Content ContentListMore bool ContentListBefore int }
func (*ContentList) Before ¶
func (cl *ContentList) Before() int
func (*ContentList) List ¶
func (cl *ContentList) List() []content.Content
func (*ContentList) More ¶
func (cl *ContentList) More() bool
type ContentNewParam ¶
type ContentRefSet ¶
type ContentRefSet struct {
ContentTypeID, ContentID string
}
type ContentType ¶
type ContentType struct { ContentTypeID string ContentTypeName string ContentTypeFields []ContentTypeField }
func (*ContentType) Fields ¶
func (ct *ContentType) Fields() []valuetype.ValueType
func (*ContentType) FieldsWithRefCount ¶
func (ct *ContentType) FieldsWithRefCount() (count int)
func (*ContentType) ID ¶
func (ct *ContentType) ID() string
func (*ContentType) Name ¶
func (ct *ContentType) Name() string
type ContentTypeField ¶
func (*ContentTypeField) ID ¶
func (f *ContentTypeField) ID() string
func (*ContentTypeField) Name ¶
func (f *ContentTypeField) Name() string
func (*ContentTypeField) Type ¶
func (f *ContentTypeField) Type() string
type ContentTypeList ¶
type ContentTypeList struct { ContentTypeList []contenttype.ContentType ContentTypeListMore bool ContentTypeListBefore int }
func (*ContentTypeList) Before ¶
func (ctl *ContentTypeList) Before() int
func (*ContentTypeList) List ¶
func (ctl *ContentTypeList) List() []contenttype.ContentType
func (*ContentTypeList) More ¶
func (ctl *ContentTypeList) More() bool
type ContentTypeNewParam ¶
type ContentTypeNewParam struct {
Name, Type string
}
type ContentTypeUpdateParam ¶
type ContentTypeUpdateParam struct {
ID, Name, Type string
}
type ContentUpdateParam ¶
type ContentValue ¶
type ContentValue struct { FieldID string FieldType string // StringSmall FieldName string // Title of a blog post FieldValue string // "My First Blog Post!" FieldReference content.Content `json:",omitempty"` FieldReferenceList []content.Content `json:",omitempty"` }
func (*ContentValue) ID ¶
func (c *ContentValue) ID() string
func (*ContentValue) MarshalJSON ¶
func (c *ContentValue) MarshalJSON() (ret []byte, err error)
func (*ContentValue) Name ¶
func (c *ContentValue) Name() string
func (*ContentValue) RefID ¶
func (c *ContentValue) RefID() string
func (*ContentValue) RefListIDs ¶
func (c *ContentValue) RefListIDs() []string
func (*ContentValue) RefListNames ¶
func (c *ContentValue) RefListNames() string
func (*ContentValue) RefName ¶
func (c *ContentValue) RefName() string
func (*ContentValue) Type ¶
func (c *ContentValue) Type() string
func (*ContentValue) UnmarshalJSON ¶
func (c *ContentValue) UnmarshalJSON(b []byte) error
func (*ContentValue) Value ¶
func (c *ContentValue) Value() string
type DB ¶
func New ¶
New, does as one might expect, given a logger, type of database, database connection string, and securer interface, opens a pool'd connection to a mysql database and pings. If ping fails we return error and nil *DB.
func NewWithConn ¶
NewWithConn creates a *DB type and pings the MySQL server. If ping fails we return error.
func (*DB) ContentDelete ¶
func (db *DB) ContentDelete(space space.Space, ct contenttype.ContentType, content content.Content) error
func (*DB) ContentGet ¶
func (db *DB) ContentGet(space space.Space, ct contenttype.ContentType, contentID string) (content.Content, error)
func (*DB) ContentIter ¶
func (db *DB) ContentIter(space space.Space, ct contenttype.ContentType, sortField string) (*contentIter, *sql.Tx, error)
func (*DB) ContentNew ¶
func (db *DB) ContentNew(space space.Space, ct contenttype.ContentType, params []ContentNewParam) (content.Content, error)
func (*DB) ContentPerContentType ¶
func (db *DB) ContentPerContentType(space space.Space, ct contenttype.ContentType, before int, order OrderType, sortField string) (content.ContentList, error)
func (*DB) ContentRefererList ¶
func (db *DB) ContentRefererList(contentID string) (ret []ContentRefSet, err error)
ContentRefererList will retreive all content IDs that references a given piece of content.
func (*DB) ContentSearch ¶
func (db *DB) ContentSearch(space space.Space, ct contenttype.ContentType, sortField, query string, before int) (content.ContentList, error)
func (*DB) ContentTypeDelete ¶
func (db *DB) ContentTypeDelete(space space.Space, ct contenttype.ContentType) error
func (*DB) ContentTypeGet ¶
func (db *DB) ContentTypeGet(space space.Space, contenttypeID string) (contenttype.ContentType, error)
func (*DB) ContentTypeIter ¶
func (*DB) ContentTypeNew ¶
func (db *DB) ContentTypeNew(space space.Space, name string, params []ContentTypeNewParam) (contenttype.ContentType, error)
func (*DB) ContentTypeSearch ¶
func (db *DB) ContentTypeSearch(space space.Space, query string, before int) (contenttype.ContentTypeList, error)
TODO: Consolidate with other list function here. They are the same except for the query used.
func (*DB) ContentTypeUpdate ¶
func (db *DB) ContentTypeUpdate(space space.Space, contenttype contenttype.ContentType, name string, newParams []ContentTypeNewParam, updateParams []ContentTypeUpdateParam) (contenttype.ContentType, error)
ContentTypeUpdate will either remove fields are add fields to a contenttype. Note: field types cannot be changed (e.g. if a field is of type InputHTML it cannot become a StringSmall. Field type names can be changed.
func (*DB) ContentTypesPerSpace ¶
func (db *DB) ContentTypesPerSpace(space space.Space, before int) (contenttype.ContentTypeList, error)
func (*DB) ContentUpdate ¶
func (db *DB) ContentUpdate(space space.Space, ct contenttype.ContentType, content content.Content, newParams []ContentNewParam, updateParams []ContentUpdateParam) (content.Content, error)
func (*DB) EnsureSetup ¶
Ensure we have the tables we require. If we receive an error other than "table already exists" and also "duplicate entry" for built in data types that error will be returned. Mainly, we are runnin CREATE TABLE and some INSERT INTO of predefined value types.
func (*DB) FileExists ¶
FileExists makes sure SOME space and content owns the file. I.E. deleted spaces can't server files.
func (*DB) HooksPerSpace ¶
func (*DB) SpaceUpdate ¶
func (*DB) SpacesPerUser ¶
type OrderType ¶
type OrderType struct {
// contains filtered or unexported fields
}
iota doesn't quite pass the compile time checks I want.