Documentation ¶
Index ¶
- Constants
- Variables
- func Create(context interface{}, db *db.DB, gallery *Gallery) error
- func Delete(context interface{}, db *db.DB, id string) error
- func Update(context interface{}, db *db.DB, id string, gallery *Gallery) error
- type Answer
- type Gallery
- func AddAnswer(context interface{}, db *db.DB, id, submissionID, answerID string) (*Gallery, error)
- func List(context interface{}, db *db.DB, formID string) ([]Gallery, error)
- func RemoveAnswer(context interface{}, db *db.DB, id, submissionID, answerID string) (*Gallery, error)
- func Retrieve(context interface{}, db *db.DB, id string) (*Gallery, error)
Constants ¶
View Source
const Collection = "form_galleries"
Collection is the mongo collection where Gallery documents are saved.
Variables ¶
View Source
var ErrInvalidID = errors.New("ID is not in it's proper form")
ErrInvalidID occurs when an ID is not in a valid form.
Functions ¶
func Create ¶
Create adds a form gallery based on the form id provided into the MongoDB database collection.
Types ¶
type Answer ¶
type Answer struct { SubmissionID bson.ObjectId `json:"submission_id" bson:"submission_id" validate:"required"` AnswerID string `json:"answer_id" bson:"answer_id" validate:"required"` Answer submission.Answer `json:"answer,omitempty" bson:"-" validate:"-"` IdentityAnswers []submission.Answer `json:"identity_answers,omitempty" bson:"-"` }
Answer describes an answer from a form which has been added to a Gallery.
type Gallery ¶
type Gallery struct { ID bson.ObjectId `json:"id" bson:"_id" validate:"required"` FormID bson.ObjectId `json:"form_id" bson:"form_id" validate:"required"` Headline string `json:"headline" bson:"headline"` Description string `json:"description" bson:"description"` Config map[string]interface{} `json:"config" bson:"config"` Answers []Answer `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"` }
Gallery is a Form that has been moved to a shared space.
func AddAnswer ¶
AddAnswer adds an answer to a form gallery. Duplicated answers are de-duplicated automatically and will not return an error.
func RemoveAnswer ¶
func RemoveAnswer(context interface{}, db *db.DB, id, submissionID, answerID string) (*Gallery, error)
RemoveAnswer adds an answer to a form gallery. Duplicated answers are de-duplicated automatically and will not return an error.
Click to show internal directories.
Click to hide internal directories.