Documentation
¶
Index ¶
- func ExportSurvey(s *Survey, exporter Exporter) error
- func SaveSurvey(survey *Survey, repo Repository) error
- func WriteSurvey(s *Survey, writer io.Writer) (int, error)
- type DropdownQuestion
- type Exporter
- type GCSExporter
- type InMemoryRepository
- type Question
- type QuestionWithOptions
- type Repository
- type S3Exporter
- type Survey
- type SurveyManager
- type TextQuestion
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExportSurvey ¶
func SaveSurvey ¶
func SaveSurvey(survey *Survey, repo Repository) error
Decouple the SaveSurvey function from the concrete Repository implementation
Types ¶
type DropdownQuestion ¶
func (*DropdownQuestion) AddOption ¶
func (q *DropdownQuestion) AddOption(option string)
func (*DropdownQuestion) SetTitle ¶
func (q *DropdownQuestion) SetTitle(title string)
type GCSExporter ¶
type GCSExporter struct{}
func (*GCSExporter) Export ¶
func (e *GCSExporter) Export(survey *Survey) error
type InMemoryRepository ¶
type InMemoryRepository struct {
// contains filtered or unexported fields
}
func (*InMemoryRepository) Save ¶
func (r *InMemoryRepository) Save(survey *Survey) error
type QuestionWithOptions ¶
type QuestionWithOptions interface { Question AddOption() }
Has addtional method AddOption
type Repository ¶
Repository is an interface that defines the methods that a concrete repository must implement
type S3Exporter ¶
type S3Exporter struct{}
func (*S3Exporter) Export ¶
func (e *S3Exporter) Export(survey *Survey) error
type SurveyManager ¶
type SurveyManager struct {
// contains filtered or unexported fields
}
func NewSurveyManager ¶
func NewSurveyManager(store Repository) *SurveyManager
Pass the Repository interface instead of the concrete InMemoryRepository
func (*SurveyManager) Save ¶
func (m *SurveyManager) Save(survey *Survey) error
type TextQuestion ¶
type TextQuestion struct {
Title string
}
func (*TextQuestion) SetTitle ¶
func (q *TextQuestion) SetTitle(title string)
Click to show internal directories.
Click to hide internal directories.