Documentation ¶
Index ¶
- Constants
- Variables
- func ObjectTypeInstance(objectType string) interface{}
- func ObjectTypes() []string
- func ValidateObjectType(objectType string) error
- type Action
- type Asset
- type Author
- type CayUserAction
- type Comment
- type CommentHistory
- type Content
- type Dimension
- type Event
- type Form
- type FormGallery
- type FormGalleryAnswer
- type FormStats
- type FormStep
- type FormSubmission
- type FormSubmissionAnswer
- type FormSubmissionAnswerInput
- type FormSubmissionEditInput
- type FormSubmissionInput
- type FormWidget
- type ImportSource
- type Index
- type Metadata
- type Model
- type Note
- type PayloadAction
- type PayloadComment
- type PayloadTag
- type Search
- type SearchHistory
- type SearchResult
- type Section
- type Tag
- type TagTarget
- type Taxonomy
- type User
Constants ¶
const ( EventUserImport string = "user_import" EventAssetImport string = "asset_import" EventActionImport string = "action_import" EventCommentImport string = "comment_import" EventNoteImport string = "note_import" EventUserAddUpdate string = "user_add_update" EventAssetAddUpdate string = "asset_add_update" EventActionAddUpdate string = "action_add_update" EventCommentAddUpdate string = "comment_add_update" EventNoteAddUpdate string = "note_add_update" EventSearchAddUpdate string = "search_add_update" EventAuthorAddUpdate string = "author_add_update" EventSectionAddUpdate string = "section_add_update" EventTagAdded string = "tag_added" EventTagRemoved string = "tag_removed" )
Various Events
const ( //Various Stats (counts) StatsLikes string = "likes" StatsFlags string = "flags" StatsComments string = "comments" //Various Collections Users string = "users" UserStatistics string = "user_statistics" Assets string = "assets" Actions string = "actions" Comments string = "comments" Tags string = "tags" Authors string = "authors" Sections string = "sections" TagTargets string = "tag_targets" CayUserActions string = "cay_user_actions" Searches string = "searches" SrchHistory string = "search_history" // Ask collections Forms string = "forms" FormSubmissions string = "form_submissions" FormGalleries string = "form_galleries" )
Various Constants
Variables ¶
var Indicies = []Index{ { Actions, mgo.Index{ Key: []string{"source.id"}, }, }, { Actions, mgo.Index{ Key: []string{"user_id", "target_id", "target", "type"}, }, }, { Assets, mgo.Index{ Key: []string{"source.id"}, }, }, { Assets, mgo.Index{ Key: []string{"url"}, }, }, { Comments, mgo.Index{ Key: []string{"source.id"}, }, }, { Comments, mgo.Index{ Key: []string{"user_id"}, }, }, { Comments, mgo.Index{ Key: []string{"source.parent_id"}, }, }, { FormSubmissions, mgo.Index{ Key: []string{"form_id"}, Unique: false, DropDups: false, }, }, { Tags, mgo.Index{ Key: []string{"name"}, }, }, { TagTargets, mgo.Index{ Key: []string{"target_id", "name", "target"}, }, }, { Users, mgo.Index{ Key: []string{"source.id"}, }, }, { UserStatistics, mgo.Index{ Key: []string{"statistics.comments.all.all.count"}, }, }, { UserStatistics, mgo.Index{ Key: []string{"statistics.comments.all.all.replied_count"}, }, }, { UserStatistics, mgo.Index{ Key: []string{"statistics.comments.all.all.replied_ratio"}, }, }, { UserStatistics, mgo.Index{ Key: []string{"statistics.comments.all.all.reply_count"}, }, }, { UserStatistics, mgo.Index{ Key: []string{"statistics.comments.all.all.reply_ratio"}, }, }, { UserStatistics, mgo.Index{ Key: []string{"statistics.comments.all.all.word_count_average"}, }, }, { UserStatistics, mgo.Index{ Key: []string{"statistics.comments.all.ModeratorDeleted.count"}, }, }, { UserStatistics, mgo.Index{ Key: []string{"statistics.comments.all.ratios.ModeratorDeleted"}, }, }, { UserStatistics, mgo.Index{ Key: []string{"statistics.comments.all.ModeratorApproved.count"}, }, }, { UserStatistics, mgo.Index{ Key: []string{"statistics.comments.all.ratios.ModeratorApproved"}, }, }, { UserStatistics, mgo.Index{ Key: []string{"statistics.comments.all.CommunityFlagged.count"}, }, }, { UserStatistics, mgo.Index{ Key: []string{"statistics.comments.all.ratios.Communityflagged"}, }, }, { UserStatistics, mgo.Index{ Key: []string{"statistics.actions.received.likes.count"}, }, }, { UserStatistics, mgo.Index{ Key: []string{"statistics.actions.performed.likes.count"}, }, }, { UserStatistics, mgo.Index{ Key: []string{"statistics.actions.received.flags.count"}, }, }, { UserStatistics, mgo.Index{ Key: []string{"statistics.actions.performed.flags.count"}, }, }, }
Indicies defines all the indicies for Coral mongo database.
Functions ¶
func ObjectTypeInstance ¶
func ObjectTypeInstance(objectType string) interface{}
ObjectTypeInstance is a factory method for known valid types. Any other input value will produce an insance of `map[string]interface{}`.
func ObjectTypes ¶
func ObjectTypes() []string
func ValidateObjectType ¶
Types ¶
type Action ¶
type Action struct { ID bson.ObjectId `json:"id" bson:"_id"` Type string `json:"type" bson:"type" validate:"required"` UserID bson.ObjectId `json:"user_id" bson:"user_id" validate:"required"` Target string `json:"target" bson:"target" validate:"required"` TargetID bson.ObjectId `json:"target_id" bson:"target_id" validate:"required"` Date time.Time `json:"date" bson:"date" validate:"required"` Value string `json:"value,omitempty" bson:"value,omitempty"` Metadata bson.M `json:"metadata,omitempty" bson:"metadata,omitempty"` Source *ImportSource `json:"source,omitempty" bson:"source,omitempty"` }
Action denotes an action taken by an actor (User) on someone/something. TargetType and TargetID may be zero value if data is a sub-document of the Target UserID may be zero value if the data is a subdocument of the actor
func (Action) ImportSource ¶ added in v0.3.4
func (object Action) ImportSource() *ImportSource
ImportSource returns the Source model
type Asset ¶
type Asset struct { ID bson.ObjectId `json:"id" bson:"_id"` URL string `json:"url" bson:"url" validate:"required"` Headline string `json:"headline,omitempty" bson:"headline,omitempty"` Tags []string `json:"tags,omitempty" bson:"tags,omitempty"` Authors []Author `json:"authors,omitempty" bson:"authors,omitempty"` Section string `json:"section,omitempty" bson:"section,omitempty"` Subsection string `json:"subsection,omitempty" bson:"subsection,omitempty"` Status string `json:"status,omitempty" bson:"status,omitempty"` DateCreated time.Time `json:"date_created,omitempty" bson:"date_created,omitempty"` DateUpdated time.Time `json:"date_updated,omitempty" bson:"date_updated,omitempty"` DatePublished time.Time `json:"date_published,omitempty" bson:"date_published,omitempty"` Stats bson.M `json:"stats,omitempty" bson:"stats,omitempty"` Metadata bson.M `json:"metadata,omitempty" bson:"metadata,omitempty"` Source *ImportSource `json:"source,omitempty" bson:"source,omitempty"` }
Asset denotes an asset in the system e.g. an article or a blog etc.
func (Asset) ImportSource ¶ added in v0.3.4
func (object Asset) ImportSource() *ImportSource
ImportSource returns the Source model
type Author ¶
type Author struct { ID string `json:"id" bson:"_id"` Name string `json:"name" bson:"name" validate:"required"` URL string `json:"url,omitempty" bson:"url,omitempty"` Twitter string `json:"twitter,omitempty" bson:"twitter,omitempty"` Facebook string `json:"facebook,omitempty" bson:"facebook,omitempty"` Stats bson.M `json:"stats,omitempty" bson:"stats,omitempty"` Metadata bson.M `json:"metadata,omitempty" bson:"metadata,omitempty"` }
Author denotes a writer who curated an Asset (or story).
func (Author) ImportSource ¶ added in v0.3.4
func (object Author) ImportSource() *ImportSource
ImportSource returns the Source model
type CayUserAction ¶
type CayUserAction struct { ID bson.ObjectId `json:"id" bson:"_id"` Date time.Time `json:"date" bson:"date" validate:"required"` Data bson.M `json:"data" bson:"data" validate:"required"` Release string `json:"release" bson:"release" validate:"required"` }
CayUserAction denotes a user action from the user using the system.
type Comment ¶
type Comment struct { ID bson.ObjectId `json:"id" bson:"_id"` UserID bson.ObjectId `json:"user_id" bson:"user_id"` AssetID bson.ObjectId `json:"asset_id" bson:"asset_id"` RootID bson.ObjectId `json:"root_id,omitempty" bson:"root_id,omitempty"` Parents []bson.ObjectId `json:"parents,omitempty" bson:"parents,omitempty"` Children []bson.ObjectId `json:"children,omitempty" bson:"children,omitempty"` Body string `json:"body" bson:"body" validate:"required"` Status string `json:"status" bson:"status"` DateCreated time.Time `json:"date_created" bson:"date_created"` DateUpdated time.Time `json:"date_updated" bson:"date_updated"` Actions []Action `json:"actions,omitempty" bson:"actions,omitempty"` Notes []Note `json:"notes,omitempty" bson:"notes,omitempty"` Tags []string `json:"tags,omitempty" bson:"tags,omitempty"` Roles []string `json:"roles,omitempty" bson:"roles,omitempty"` Stats bson.M `json:"stats,omitempty" bson:"stats,omitempty"` Metadata bson.M `json:"metadata,omitempty" bson:"metadata,omitempty"` Source *ImportSource `json:"source,omitempty" bson:"source,omitempty"` }
Comment denotes a comment by a user in the system.
func (Comment) ImportSource ¶ added in v0.3.4
func (object Comment) ImportSource() *ImportSource
ImportSource returns the Source model
type CommentHistory ¶ added in v0.3.4
type CommentHistory struct { ID bson.ObjectId `json:"id" bson:"_id"` UserID bson.ObjectId `json:"user_id" bson:"user_id" validate:"required"` Comment Comment `json:"comment" bson:"comment" validate:"required"` Event string `json:"event" bson:"event" validate:"required"` Date time.Time `json:"date" bson:"date" validate:"required"` }
CommentHistory encapsulates a snapshot of comment when it was last updated.
type Content ¶ added in v0.3.4
type Content struct { MimeType string `json:"type" bson:"type" validate:"required"` Body string `json:"body" bson:"body" validate:"required"` }
Content encapsulates content-type and its data.
type Dimension ¶ added in v0.3.4
type Dimension struct { Name string `json:"name" bson:"name" validate:"required"` Constituents []string `json:"constituents" bson:"constituents"` }
Dimension will hold all the variables on which aggregations/statistics can be get for the specific type
type Event ¶ added in v0.3.4
type Event struct { Name string `json:"name" bson:"name"` Payload interface{} `json:"payload" bson:"payload"` }
Event denotes an event in Pillar
type Form ¶ added in v0.3.4
type Form struct { ID bson.ObjectId `json:"id" bson:"_id"` Status string `json:"status" bson:"status"` Theme interface{} `json:"theme" bson:"theme"` Settings interface{} `json:"settings" bson:"settings"` Header interface{} `json:"header" bson:"header"` FinishedScreen interface{} `json:"finishedScreen" bson:"finishedScreen"` Steps []FormStep `json:"steps" bson:"steps"` Stats FormStats `json:"stats" bson:"stats"` CreatedBy interface{} `json:"created_by" bson:"created_by"` // Todo, decide how to represent ownership here UpdatedBy interface{} `json:"updated_by" bson:"updated_by"` // Todo, decide how to represent ownership here DeletedBy interface{} `json:"deleted_by" bson:"deleted_by"` // Todo, decide how to represent ownership here DateCreated time.Time `json:"date_created,omitempty" bson:"date_created,omitempty"` DateUpdated time.Time `json:"date_updated,omitempty" bson:"date_updated,omitempty"` DateDeleted time.Time `json:"date_deleted,omitempty" bson:"date_deleted,omitempty"` }
func (Form) ImportSource ¶ added in v0.3.4
func (object Form) ImportSource() *ImportSource
ImportSource returns the Source model
type FormGallery ¶ added in v0.3.4
type FormGallery struct { ID bson.ObjectId `json:"id" bson:"_id"` FormId bson.ObjectId `json:"form_id" bson:"form_id"` Headline string `json:"headline" bson:"headline"` Description string `json:"description" bson:"description"` Config map[string]interface{} `json:"config" bson:"config"` Answers []FormGalleryAnswer `json:"answers" bson:"answers"` DateCreated time.Time `json:"date_created,omitempty" bson:"date_created,omitempty"` DateUpdated time.Time `json:"date_updated,omitempty" bson:"date_updated,omitempty"` }
func (FormGallery) GetType ¶ added in v0.3.4
func (o FormGallery) GetType() string
I am, form_gallery
func (FormGallery) Id ¶ added in v0.3.4
func (object FormGallery) Id() string
Id returns the ID for this Model
func (FormGallery) ImportSource ¶ added in v0.3.4
func (object FormGallery) ImportSource() *ImportSource
ImportSource returns the Source model
func (FormGallery) IsRecordableEvent ¶ added in v0.3.4
func (o FormGallery) IsRecordableEvent(e string) bool
Record all Historical Events for FormGalleries
func (FormGallery) Validate ¶ added in v0.3.4
func (object FormGallery) Validate() error
type FormGalleryAnswer ¶ added in v0.3.4
type FormGalleryAnswer struct { SubmissionId bson.ObjectId `json:"submission_id" bson:"submission_id"` AnswerId string `json:"answer_id" bson:"answer_id"` Answer FormSubmissionAnswer `json:"answer,omitempty" bson:"answer,omitempty"` // not saved to db, hydrated when reading only! IdentityAnswers []FormSubmissionAnswer `json:"identity_answers,omitempty" bson:"identity_answers,omitempty"` // not saved to db, hydrated when reading only! }
type FormStats ¶ added in v0.3.4
type FormStats struct {
Responses int `json:"responses" bson:"responses"`
}
type FormStep ¶ added in v0.3.4
type FormStep struct { ID string `json:"id" bson:"_id"` Name string `json:"name" bson:"name"` Widgets []FormWidget `json:"widgets" bson:"widgets"` }
type FormSubmission ¶ added in v0.3.4
type FormSubmission struct { ID bson.ObjectId `json:"id" bson:"_id"` FormId bson.ObjectId `json:"form_id" bson:"form_id"` Number int `json:"number" bson:"number"` Status string `json:"status" bson:"status"` Answers []FormSubmissionAnswer `json:"replies" bson:"replies"` Flags []string `json:"flags" bson:"flags"` // simple, flexible string flagging Header interface{} `json:"header" bson:"header"` FinishedScreen interface{} `json:"finishedScreen" bson:"finishedScreen"` CreatedBy interface{} `json:"created_by" bson:"created_by"` // Todo, decide how to represent ownership here UpdatedBy interface{} `json:"updated_by" bson:"updated_by"` // Todo, decide how to represent ownership here DateCreated time.Time `json:"date_created,omitempty" bson:"date_created,omitempty"` DateUpdated time.Time `json:"date_updated,omitempty" bson:"date_updated,omitempty"` }
func (FormSubmission) Id ¶ added in v0.3.4
func (object FormSubmission) Id() string
Id returns the ID for this Model
func (FormSubmission) ImportSource ¶ added in v0.3.4
func (object FormSubmission) ImportSource() *ImportSource
ImportSource returns the Source model
func (FormSubmission) Validate ¶ added in v0.3.4
func (object FormSubmission) Validate() error
type FormSubmissionAnswer ¶ added in v0.3.4
type FormSubmissionAnswer struct { WidgetId string `json:"widget_id" bson:"widget_id"` Identity bool `json:"identity" bson:"identity"` Answer interface{} `json:"answer" bson:"answer"` EditedAnswer interface{} `json:"edited" bson:"edited"` Question interface{} `json:"question" bson:"question"` Props interface{} `json:"props" bson:"props"` }
here's what a form submission is
type FormSubmissionAnswerInput ¶ added in v0.3.4
type FormSubmissionAnswerInput struct { WidgetId string `json:"widget_id"` Answer interface{} `json:"answer"` }
this is what we expect for input for a form submission
type FormSubmissionEditInput ¶ added in v0.3.4
type FormSubmissionEditInput struct {
EditedAnswer interface{} `json:"edited"`
}
type FormSubmissionInput ¶ added in v0.3.4
type FormSubmissionInput struct { FormId string `jsont:"form_id"` Status string `json:"status" bson:"status"` Answers []FormSubmissionAnswerInput `json:"replies"` }
func (FormSubmissionInput) Id ¶ added in v0.3.4
func (object FormSubmissionInput) Id() string
Id returns the ID for this Model
func (FormSubmissionInput) ImportSource ¶ added in v0.3.4
func (object FormSubmissionInput) ImportSource() *ImportSource
ImportSource returns the Source model
func (FormSubmissionInput) Validate ¶ added in v0.3.4
func (object FormSubmissionInput) Validate() error
type FormWidget ¶ added in v0.3.4
type FormWidget struct { ID string `json:"id" bson:"_id"` Type string `json:"type" bson:"type"` Identity bool `json:"identity" bson:"identity"` Component string `json:"component" bson:"component"` Title string `json:"title" bson:"title"` Description string `json:"description" bson:"description"` Wrapper interface{} `json:"wrapper" bson:"wrapper"` Props interface{} `json:"props" bson:"props"` }
type ImportSource ¶
type ImportSource struct { ID string `json:"id,omitempty" bson:"id,omitempty"` UserID string `json:"user_id,omitempty" bson:"user_id,omitempty"` TargetID string `json:"target_id,omitempty" bson:"target_id,omitempty"` AssetID string `json:"asset_id,omitempty" bson:"asset_id,omitempty"` ParentID string `json:"parent_id,omitempty" bson:"parent_id,omitempty"` User *User `json:"user,omitempty" bson:"user,omitempty"` }
ImportSource encapsulates all original id from the source system this is a common struct used primarily for import purposes client is responsible for passing in valid/correct source data
type Index ¶
type Index struct { Target string `json:"target" bson:"target" validate:"required"` Index mgo.Index `json:"index" bson:"index" validate:"required"` }
Index denotes a request to add Index to various entities.
type Metadata ¶
type Metadata struct { Target string `json:"target" bson:"target" validate:"required"` TargetID bson.ObjectId `json:"target_id" bson:"target_id" validate:"required"` Metadata bson.M `json:"metadata,omitempty" bson:"metadata,omitempty"` Source ImportSource `json:"source,omitempty" bson:"source,omitempty"` }
Metadata denotes a request to add/update Metadata for an entity
type Model ¶ added in v0.3.4
type Model interface { Id() string Validate() error ImportSource() *ImportSource }
type Note ¶
type Note struct { UserID bson.ObjectId `json:"user_id" bson:"user_id"` Body string `json:"body" bson:"body" validate:"required"` Date time.Time `json:"date" bson:"date" validate:"required"` TargetID bson.ObjectId `json:"target_id" bson:"target_id" validate:"required"` Target string `json:"target" bson:"target" validate:"required"` Source ImportSource `json:"source,omitempty" bson:"source,omitempty"` }
Note denotes a note by a user in the system.
func (Note) ImportSource ¶ added in v0.3.4
func (object Note) ImportSource() *ImportSource
ImportSource returns the Source model
type PayloadAction ¶ added in v0.3.4
type PayloadAction struct { Action Action `json:"action" bson:"action"` Actor User `json:"actor" bson:"actor"` User User `json:"user" bson:"user"` Comment Comment `json:"comment" bson:"comment"` }
PayloadAction denotes an message to be used when an action is created/updated.
type PayloadComment ¶ added in v0.3.4
type PayloadComment struct { Comment Comment `json:"comment" bson:"comment"` Asset Asset `json:"asset" bson:"asset"` User User `json:"user" bson:"user"` }
PayloadComment denotes a payload to be used when a comment is created/updated.
type PayloadTag ¶ added in v0.3.4
PayloadTag denotes an message to be used when a tag is added/removed
type Search ¶ added in v0.3.4
type Search struct { ID bson.ObjectId `json:"id" bson:"_id"` Name string `json:"name" bson:"name" validate:"required"` Description string `json:"description,omitempty" bson:"description,omitempty"` Query string `json:"query" bson:"query"` // generated internally from ID // QuerySet interface{} `json:"querySet" bson:"querySet"` Tag string `json:"tag" bson:"tag"` Filters bson.M `json:"filters,omitempty" bson:"filters,omitempty"` ExcludedTags []string `json:"excluded_tags" bson:"excluded_tags"` Result SearchResult `json:"result,omitempty" bson:"result,omitempty"` DateCreated time.Time `json:"date_created" bson:"date_created"` DateUpdated time.Time `json:"date_updated,omitempty" bson:"date_updated,omitempty"` UserCreated string `json:"user_created,omitempty" bson:"user_created,omitempty"` UserUpdated string `json:"user_updated,omitempty" bson:"user_updated,omitempty"` }
Search denotes a search bound by a query and tag.
func (Search) ImportSource ¶ added in v0.3.4
func (object Search) ImportSource() *ImportSource
ImportSource returns the Source model
type SearchHistory ¶ added in v0.3.4
type SearchResult ¶ added in v0.3.4
type Section ¶
type Section struct { Name string `json:"name" bson:"_id" validate:"required"` Description string `json:"description" bson:"description" validate:"required"` DateCreated time.Time `json:"date_created" bson:"date_created"` DateUpdated time.Time `json:"date_updated,omitempty" bson:"date_updated,omitempty"` Stats bson.M `json:"stats,omitempty" bson:"stats,omitempty"` Metadata bson.M `json:"metadata,omitempty" bson:"metadata,omitempty"` }
Section denotes a media section
func (Section) ImportSource ¶ added in v0.3.4
func (object Section) ImportSource() *ImportSource
ImportSource returns the Source model
type Tag ¶
type Tag struct { Name string `json:"name" bson:"_id" validate:"required"` OldName string `json:"old_name,omitempty" bson:"old_name,omitempty"` Description string `json:"description" bson:"description" validate:"required"` DateCreated time.Time `json:"date_created" bson:"date_created"` DateUpdated time.Time `json:"date_updated,omitempty" bson:"date_updated,omitempty"` }
Tag denotes a unique tag in the system
func (Tag) ImportSource ¶ added in v0.3.4
func (object Tag) ImportSource() *ImportSource
ImportSource returns the Source model
type TagTarget ¶
type TagTarget struct { ID bson.ObjectId `json:"id" bson:"_id"` Target string `json:"target" bson:"target" validate:"required"` TargetID bson.ObjectId `json:"target_id" bson:"target_id" validate:"required"` Name string `json:"name" bson:"name" validate:"required"` DateCreated time.Time `json:"date_created" bson:"date_created"` }
TagTarget denotes relationship between an entity and its tags
type Taxonomy ¶
type Taxonomy struct { Name string `json:"name" bson:"name"` Value string `json:"value" bson:"value"` }
Taxonomy holds all name-value pairs.
type User ¶
type User struct { ID bson.ObjectId `json:"id" bson:"_id"` Name string `json:"name" bson:"name" validate:"required"` Avatar string `json:"avatar" bson:"avatar"` Status string `json:"status" bson:"status"` LastLogin time.Time `json:"last_login,omitempty" bson:"last_login,omitempty"` MemberSince time.Time `json:"member_since,omitempty" bson:"member_since,omitempty"` Actions []Action `json:"actions,omitempty" bson:"actions,omitempty"` Notes []Note `json:"notes,omitempty" bson:"notes,omitempty"` Tags []string `json:"tags,omitempty" bson:"tags,omitempty"` Stats bson.M `json:"stats,omitempty" bson:"stats,omitempty"` Metadata bson.M `json:"metadata,omitempty" bson:"metadata,omitempty"` Source *ImportSource `json:"source,omitempty" bson:"source,omitempty"` }
User denotes a user in the system.
func (User) ImportSource ¶ added in v0.3.4
func (object User) ImportSource() *ImportSource
ImportSource returns the Source model