Documentation ¶
Index ¶
Constants ¶
View Source
const (
TIME_LAYOUT = "2006-01-02 15:04:05 MST"
)
Variables ¶
This section is empty.
Functions ¶
func SubmissionCount ¶
func SurveyCount ¶
func SurveyCount() int
SurveyCount will return the total number of surveys in the database that aren't marked as deleted.
Types ¶
type Answer ¶
type Answer struct { ID int `json:"id"` Answer string `json:"answer"` DataType string `json:"data_type"` DateAdded time.Time `json:"date_added"` DateModified time.Time `json:"date_modified"` UserID int `json:"-"` Deleted bool `json:"-"` Revisions []AnswerRevision `json:"revisions"` }
Answer contains information for a possible answer for a given Question.
type AnswerRevision ¶
type AnswerRevision struct { ID int `json:"id"` User RevisionUser `json:"user"` NewAnswer string `json:"new_answer"` OldAnswer string `json:"old_answer"` Date time.Time `json:"date"` ChangeType string `json:"change_type"` }
AnswerRevision is a change record for an Answer.
type Question ¶
type Question struct { ID int `json:"id"` Question string `json:"question"` DateModified time.Time `json:"date_modified"` DateAdded time.Time `json:"date_added"` UserID int `json:"-"` Deleted bool `json:"-"` Revisions []QuestionRevision `json:"revisions"` Answers []Answer `json:"answers"` }
Question contains information for a question on a survey. It contains answers and revision history for both the question an each answer.
func (*Question) GetRevisions ¶
type QuestionRevision ¶
type QuestionRevision struct { ID int `json:"id"` User RevisionUser `json:"user"` NewQuestion string `json:"new_question"` OldQuestion string `json:"old_question"` Date time.Time `json:"date"` ChangeType string `json:"change_type"` }
QuestionRevision is a change record for a Question.
type RevisionUser ¶
type Survey ¶
type Survey struct { ID int `json:"id"` Name string `json:"name"` Description string `json:"description"` DateAdded time.Time `json:"date_added"` DateModified time.Time `json:"date_modified"` UserID int `json:"-"` Deleted bool `json:"-"` Revisions []SurveyRevision `json:"revisions"` Questions []Question `json:"questions"` Completion SurveyStatus `json:"-"` }
func GetSurveys ¶
GetSurveys will return a list of surveys in the database or an error if empty.
func (*Survey) AddQuestion ¶
AddQuestion will commit a new question to a referenced Survey.
func (*Survey) Delete ¶
Delete will remove (mark as deleted) a Survey from the list of returned results
type SurveyRevision ¶
type SurveyStatus ¶
type SurveySubmission ¶
type SurveySubmission struct { ID int `json:"id"` User SurveyUser `json:"user"` Questions []SurveySubmissionAnswer `json:"questions"` Survey Survey `json:"survey"` }
func GetAllSubmissions ¶
func GetAllSubmissions(skip, take, surveyID int) ([]SurveySubmission, error)
func (*SurveySubmission) Get ¶
func (s *SurveySubmission) Get() error
func (*SurveySubmission) Submit ¶
func (s *SurveySubmission) Submit() error
type SurveySubmissionAnswer ¶
Click to show internal directories.
Click to hide internal directories.