Documentation ¶
Index ¶
- type Answers
- type Survey
- func (s *Survey) AddQuestionBytes(question []byte) error
- func (s *Survey) AddQuestionJson(question string) error
- func (s *Survey) AddQuestionMap(question map[string]any) error
- func (s *Survey) Check(aws Answers) error
- func (s *Survey) RemoveQuestion(nameId string) error
- func (s *Survey) ToMap() (map[string]any, error)
- func (s *Survey) UpdateQuestionBytes(question []byte) error
- func (s *Survey) UpdateQuestionJson(question string) error
- func (s *Survey) UpdateQuestionMap(question map[string]any) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Survey ¶
type Survey struct { // Title is the title of the survey. Title *string `json:"title"` // Version is the version of the survey. Version *string `json:"version"` // Description is the description of the survey. Description *string `json:"description"` // NameIdPaths is a map of question nameId to its path in the survey json. NameIdPaths map[string]string `json:"idPaths"` // RequiredNameIds is a list of required question nameIds. RequiredNameIds []string `json:"required"` // FullJsonSurvey is the full json representation of the survey. FullJsonSurvey *string `json:"fullJsonSurvey"` }
Survey is a struct representation of a survey.
func NewSurvey ¶
NewSurvey creates a new Survey instance with the given title, version, and description. Title and version are required and an error is returned if they are not provided.
func ParseBytes ¶
ParseBytes converts the given json byte slice into a Survey instance.
func (*Survey) AddQuestionBytes ¶
AddQuestionBytes adds a question to the survey given its representation as a byte array
func (*Survey) AddQuestionJson ¶
AddQuestionJson adds a question to the survey given its representation as a JSON string
func (*Survey) AddQuestionMap ¶
AddQuestionMap adds a question to the survey given its representation as a map[string]any
func (*Survey) RemoveQuestion ¶
RemoveQuestion removes the question with the specified name ID from the survey
func (*Survey) UpdateQuestionBytes ¶
UpdateQuestionBytes updates a question in the survey given its representation as a byte array
func (*Survey) UpdateQuestionJson ¶
UpdateQuestionJson updates an existing question in the survey with the data provided as a JSON string.