Documentation ¶
Overview ¶
Package question provides Question for a Questionnaire.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Func ¶
Func allows to set options.
func WithImageURL ¶
WithImageURL sets the question image URL.
func WithOption ¶
WithOption add an option to the question.
func WithRequired ¶
WithRequired sets the question as required.
type Meta ¶
type Meta struct { // ID of the question. ID string `json:"id" bson:"id"` // ImageURL is the URL of the image. ImageURL string `json:"url" bson:"url"` // Index is the index of the question. Index int `json:"index" bson:"index"` // Required is a flag to indicate if the question is required. Required bool `json:"required" default:"false" bson:"required"` // Weight is the weight of the question. Weight int `json:"weight" bson:"weight"` // contains filtered or unexported fields }
Meta enriches the question with metadata. Add here anything you need.
type NextQuestionFunc ¶
type NextQuestionFunc func() string
NextQuestionFunc is a function which determines the next question.
type Question ¶
type Question struct { common.Common `json:",inline" bson:",inline"` // Meta is the metadata of the question. Meta Meta `json:"meta" bson:"meta"` // Label is the question. Label string `json:"label" bson:"label"` // Options is a list of options for the question to be answered. Options *safeorderedmap.SafeOrderedMap[any] `json:"options" bson:"options"` // PreviousQuestionID is the ID of the previous question. PreviousQuestionID string `json:"-" bson:"-"` // Type of the question. Type types.Type `json:"type" bson:"type"` }
Question with options to be answered.
Click to show internal directories.
Click to hide internal directories.