Documentation
¶
Index ¶
- Variables
- type CheckboxQuestion
- type CreateFormParams
- type CreateQuestionParams
- type Form
- type GetQuestionsParams
- type ListFormsParams
- type Question
- type QuestionBase
- type QuestionType
- type RadioQuestion
- type Repo
- func (r *Repo) CreateForm(ctx context.Context, form Form, questions []Question) error
- func (r *Repo) GetLatestVersionOfBase(ctx context.Context, baseId uuid.UUID) (Form, error)
- func (r *Repo) GetQuestions(ctx context.Context, baseId uuid.UUID) ([]Question, error)
- func (r *Repo) GetQuestionsOfVersion(ctx context.Context, varsionId uuid.UUID) ([]Question, error)
- func (r *Repo) GetVersion(ctx context.Context, versionId string) (Form, error)
- func (r *Repo) ListForms(ctx context.Context, params ListFormsParams) ([]Form, error)
- type Service
- func (s *Service) CreateNewForm(ctx context.Context, params CreateFormParams) (Form, []Question, error)
- func (s *Service) GetForm(ctx context.Context, baseId uuid.UUID) (Form, error)
- func (s *Service) GetQuestions(ctx context.Context, params GetQuestionsParams) ([]Question, error)
- func (s *Service) ListForms(ctx context.Context, params ListFormsParams) ([]Form, error)
- func (s *Service) UpdateForm(ctx context.Context, params UpdateFormParams) (Form, []Question, error)
- type TextQuestion
- type UpdateFormParams
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // These variables are used to make the code testable UUIDNew = uuid.New TimeNow = time.Now )
View Source
var ( ErrNotFound = errors.New("not found") ErrBadArgs = errors.New("bad arguments") )
Functions ¶
This section is empty.
Types ¶
type CheckboxQuestion ¶
type CheckboxQuestion struct { QuestionBase Options []string }
func (CheckboxQuestion) Validate ¶
func (q CheckboxQuestion) Validate() error
type CreateFormParams ¶
type CreateFormParams struct { Title string Description string Questions []CreateQuestionParams }
type CreateQuestionParams ¶
type CreateQuestionParams struct { Type QuestionType Title string // Options is only required for radio and checkbox questions Options []string }
type ListFormsParams ¶
type ListFormsParams struct { }
type Question ¶
type Question interface { Question() QuestionBase Validate() error }
type QuestionBase ¶
func (QuestionBase) Question ¶
func (q QuestionBase) Question() QuestionBase
func (QuestionBase) Validate ¶
func (q QuestionBase) Validate() error
type QuestionType ¶
type QuestionType int
const ( QuestionTypeText QuestionType = 0 QuestionTypeRadio QuestionType = 1 QuestionTypeCheckbox QuestionType = 2 )
type RadioQuestion ¶
type RadioQuestion struct { QuestionBase Options []string }
func (RadioQuestion) Validate ¶
func (q RadioQuestion) Validate() error
type Repo ¶
type Repo struct {
// contains filtered or unexported fields
}
func (*Repo) CreateForm ¶
func (*Repo) GetLatestVersionOfBase ¶
func (*Repo) GetQuestions ¶
func (*Repo) GetQuestionsOfVersion ¶
func (*Repo) GetVersion ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) CreateNewForm ¶
func (*Service) GetQuestions ¶
func (*Service) UpdateForm ¶
type TextQuestion ¶
type TextQuestion struct {
QuestionBase
}
func (TextQuestion) Validate ¶
func (q TextQuestion) Validate() error
type UpdateFormParams ¶
type UpdateFormParams struct { Id uuid.UUID CreateFormParams }
Click to show internal directories.
Click to hide internal directories.