Documentation
¶
Index ¶
- Constants
- Variables
- type Answer
- type BoolAnswer
- type DateAnswer
- type DuplicateProtectionType
- type MultiOptionsAnswer
- type NumberAnswer
- type Question
- type QuestionAnswer
- type QuestionType
- type QuestionValidation
- type Questions
- type Security
- type SingleOptionAnswer
- type Survey
- type SurveyConfig
- func (s *SurveyConfig) FindQuestionByUUID(questionUUID string) (*Question, error)
- func (s *SurveyConfig) GenerateHash()
- func (s *SurveyConfig) Normalize()
- func (a *SurveyConfig) Scan(value interface{}) error
- func (s *SurveyConfig) SetOptionsFromVariables() error
- func (s *SurveyConfig) Validate() error
- func (a SurveyConfig) Value() (driver.Value, error)
- type SurveyDeliveryStatus
- type SurveyParseError
- type SurveyParseStatus
- type SurveySession
- type SurveySessionStatus
- type SurveySessionsFilter
- type SurveyStats
- type SurveysSyncResult
- type TextAnswer
- type Variable
- type VariableType
- type Variables
Constants ¶
View Source
const ( Theme_Default = "default" Theme_Custom = "custom" )
View Source
const ( SurveyParseStatus_Success = "success" SurveyParseStatus_Error = "error" SurveyParseStatus_Deleted = "deleted" )
View Source
const ( SurveyDeliveryStatus_Launched = "launched" SurveyDeliveryStatus_Stopped = "stopped" )
View Source
const ( SurveySessionStatus_InProgress = "in_progress" SurveySessionStatus_Completed = "completed" )
View Source
const DATE_FORMAT = "2006-01-02"
Variables ¶
View Source
var SupportedThemes = map[string]bool{ Theme_Default: true, Theme_Custom: true, }
Functions ¶
This section is empty.
Types ¶
type BoolAnswer ¶
type BoolAnswer struct {
AnswerValue bool `json:"value"`
}
func (*BoolAnswer) Validate ¶
func (a *BoolAnswer) Validate(q Question) error
type DateAnswer ¶
type DateAnswer struct {
AnswerValue string `json:"value"`
}
func (*DateAnswer) Validate ¶
func (a *DateAnswer) Validate(q Question) error
type DuplicateProtectionType ¶
type DuplicateProtectionType string
const ( DuplicateProtectionType_Cookie DuplicateProtectionType = "cookie" DuplicateProtectionType_Ip DuplicateProtectionType = "ip" )
type MultiOptionsAnswer ¶
type MultiOptionsAnswer struct {
AnswerValue []string `json:"value"`
}
func (*MultiOptionsAnswer) Validate ¶
func (a *MultiOptionsAnswer) Validate(q Question) error
type NumberAnswer ¶
type NumberAnswer struct {
AnswerValue int64 `json:"value"`
}
func (*NumberAnswer) Validate ¶
func (a *NumberAnswer) Validate(q Question) error
type Question ¶
type Question struct {
Type QuestionType `json:"type" yaml:"type"`
Label string `json:"label" yaml:"label"`
ID string `json:"id" yaml:"id"`
Description string `json:"description" yaml:"description"`
Min *int `json:"min,omitempty" yaml:"min,omitempty"`
Max *int `json:"max,omitempty" yaml:"max,omitempty"`
OptionsFromVariable *string `json:"-" yaml:"optionsFromVariable,omitempty"`
Options []string `json:"options,omitempty" yaml:"options,omitempty"`
UUID string `json:"uuid" yaml:"-"`
Validation *QuestionValidation `json:"validation,omitempty" yaml:"validation,omitempty"`
}
func (Question) GenerateHash ¶
func (Question) GetAnswerType ¶
func (Question) ValidateAnswer ¶
func (Question) ValidateMinMax ¶
func (Question) ValidateOptions ¶
type QuestionAnswer ¶
type QuestionType ¶
type QuestionType string
const ( QuestionType_DropdownSingle QuestionType = "single-choice" QuestionType_DropdownMultiple QuestionType = "multiple-choice" QuestionType_ShortText QuestionType = "short-text" QuestionType_LongText QuestionType = "long-text" QuestionType_Date QuestionType = "date" QuestionType_Rating QuestionType = "rating" QuestionType_Ranking QuestionType = "ranking" QuestionType_YesNo QuestionType = "yes-no" )
type QuestionValidation ¶
type QuestionValidation struct {
Min *int `json:"min,omitempty" yaml:"min,omitempty"`
Max *int `json:"max,omitempty" yaml:"max,omitempty"`
}
func (QuestionValidation) Validate ¶
func (v QuestionValidation) Validate() error
type Security ¶
type Security struct {
DuplicateProtection DuplicateProtectionType `json:"duplicateProtection" yaml:"duplicateProtection"`
}
type SingleOptionAnswer ¶
type SingleOptionAnswer struct {
AnswerValue string `json:"value"`
}
func (*SingleOptionAnswer) Validate ¶
func (a *SingleOptionAnswer) Validate(q Question) error
type Survey ¶
type Survey struct {
ID int64 `json:"-"`
UUID string `json:"uuid"`
CreatedAt time.Time `json:"created_at"`
ParseStatus SurveyParseStatus `json:"parse_status"`
DeliveryStatus SurveyDeliveryStatus `json:"delivery_status"`
ErrorLog string `json:"error_log"`
Name string `json:"name"`
URLSlug string `json:"url_slug"`
URL string `json:"url"`
Config *SurveyConfig `json:"config"`
Stats SurveyStats `json:"stats"`
}
type SurveyConfig ¶
type SurveyConfig struct {
Title string `json:"title" yaml:"title"`
Intro string `json:"intro" yaml:"intro"`
Outro string `json:"outro" yaml:"outro"`
Theme string `json:"theme" yaml:"theme"`
Hash string `json:"hash" yaml:"-"`
Questions *Questions `json:"questions" yaml:"-"`
Variables *Variables `json:"variables" yaml:"-"`
Security *Security `json:"security" yaml:"-"`
}
func (*SurveyConfig) FindQuestionByUUID ¶
func (s *SurveyConfig) FindQuestionByUUID(questionUUID string) (*Question, error)
func (*SurveyConfig) GenerateHash ¶
func (s *SurveyConfig) GenerateHash()
func (*SurveyConfig) Normalize ¶
func (s *SurveyConfig) Normalize()
func (*SurveyConfig) Scan ¶
func (a *SurveyConfig) Scan(value interface{}) error
func (*SurveyConfig) SetOptionsFromVariables ¶
func (s *SurveyConfig) SetOptionsFromVariables() error
func (*SurveyConfig) Validate ¶
func (s *SurveyConfig) Validate() error
type SurveyDeliveryStatus ¶
type SurveyDeliveryStatus string
type SurveyParseError ¶
type SurveyParseStatus ¶
type SurveyParseStatus string
type SurveySession ¶
type SurveySession struct {
ID int64 `json:"-"`
UUID string `json:"uuid"`
CreatedAt time.Time `json:"created_at"`
CompletedAt *time.Time `json:"completed_at"`
Status SurveySessionStatus `json:"status"`
SurveyUUID string `json:"survey_uuid"`
IPAddr string `json:"ip_addr"`
QuestionAnswers []QuestionAnswer `json:"question_answers"`
}
type SurveySessionStatus ¶
type SurveySessionStatus string
type SurveySessionsFilter ¶
type SurveySessionsFilter struct {
Limit int `query:"limit"`
Offset int `query:"offset"`
SortBy string `query:"sort_by"`
Order string `query:"order"`
}
func (*SurveySessionsFilter) ToString ¶
func (v *SurveySessionsFilter) ToString() string
func (*SurveySessionsFilter) Validate ¶
func (v *SurveySessionsFilter) Validate() error
type SurveyStats ¶
type SurveysSyncResult ¶
type SurveysSyncResult struct {
Surveys []*Survey `json:"surveys"`
Errors []SurveyParseError `json:"errors"`
}
type TextAnswer ¶
type TextAnswer struct {
AnswerValue string `json:"value"`
}
func (*TextAnswer) Validate ¶
func (a *TextAnswer) Validate(q Question) error
type Variable ¶
type Variable struct {
ID string `json:"id" yaml:"id"`
Type VariableType `json:"type" yaml:"type"`
Options []string `json:"options,omitempty" yaml:"options,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.