Documentation ¶
Index ¶
- func AutoMigrateModels(db *gorm.DB) error
- func BuildSurveyFromYMLFiles(builder YamlFileToSurveyJSBuilder) (string, error)
- func GenerateSurveyJSON(sjs JSSurvey) (string, error)
- func PackGenerate(url string)
- func PopulateSurveyJSFromYML(sjs *JSSurvey, yamlString string) error
- type Component
- type JSElement
- type JSKVPair
- type JSPage
- type JSSurvey
- type Model
- type Result
- type ResultSearchParameters
- type Survey
- func (s *Survey) AfterSave()
- func (s *Survey) BeforeSave()
- func (s Survey) Get(db *gorm.DB, id uint) (Survey, error)
- func (s Survey) GetAll(db *gorm.DB) ([]Survey, error)
- func (s Survey) GetAllResults(db *gorm.DB, p ResultSearchParameters) (Survey, error)
- func (s Survey) GetByName(db *gorm.DB, name string) (Survey, error)
- func (s Survey) GetByNameAndShareCode(db *gorm.DB, name, shareCode string) (Survey, error)
- func (s Survey) Save(db *gorm.DB) (Survey, error)
- type Team
- type YamlFileToSurveyJSBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AutoMigrateModels ¶
AutoMigrateModels imports the models into the DB
func BuildSurveyFromYMLFiles ¶
func BuildSurveyFromYMLFiles(builder YamlFileToSurveyJSBuilder) (string, error)
BuildSurveyFromYMLFiles build a JSSurvey from a YamlFileToSurveyJSBuilder
func GenerateSurveyJSON ¶
GenerateSurveyJSON generates JSON without escaping HTML
func PopulateSurveyJSFromYML ¶
PopulateSurveyJSFromYML yaml > JSSurvey
Types ¶
type Component ¶
type Component struct { Model Category string `json:"category"` Name string `json:"name"` Weight int `json:"weight"` SurveyID uint `json:"-"` }
Component is the a component of the survey e.g. Westrum
type JSElement ¶
type JSElement struct { Type string `json:"type" yaml:"type"` Name string `json:"name" yaml:"name"` Title string `json:"title" yaml:"title"` IsRequired bool `json:"isRequired" yaml:"isRequired"` ColCount int `json:"colCount" yaml:"colCount"` Choices []string `json:"choices,omitempty" yaml:"choices"` VisibleIf string `json:"visibleIf,omitempty" yaml:"visibleIf"` Columns []JSKVPair `json:"columns,omitempty" yaml:"columns"` Rows []JSKVPair `json:"rows,omitempty" yaml:"rows"` }
JSElement struct
type JSKVPair ¶
type JSKVPair struct { Value interface{} `json:"value" yaml:"value"` Text string `json:"text" yaml:"text"` }
JSKVPair struct
type JSPage ¶
type JSPage struct { Name string `json:"name" yaml:"name"` Title string `json:"title" yaml:"title"` Elements []JSElement `json:"elements" yaml:"elements"` }
JSPage struct
type JSSurvey ¶
type JSSurvey struct { CompletedHTML template.HTML `json:"completedHtml" yaml:"completedHtml"` Pages []JSPage `json:"pages" yaml:"pages"` ShowQuestionNumbers string `json:"showQuestionNumbers" yaml:"showQuestionNumbers"` }
JSSurvey struct
type Model ¶
type Model struct { ID uint `gorm:"primary_key" json:"id"` CreatedAt time.Time `json:"created"` UpdatedAt time.Time `json:"updated"` DeletedAt *time.Time `json:"-"` }
Model is a GORM compatible model
type Result ¶
type Result struct { Model Time time.Time `json:"timestamp"` CurrentRole string `json:"current_role"` CurrentRoleOther string `json:"current_role_other"` EmploymentStatus string `json:"employment_status"` Team string `json:"team"` ProgrammingLanguages1 string `json:"programming_languages.1"` ProgrammingLanguages2 string `json:"programming_languages.2"` ProgrammingLanguages3 string `json:"programming_languages.3"` ProgrammingLanguages4 string `json:"programming_languages.4"` ProgrammingLanguages5 string `json:"programming_languages.5"` ProgrammingLanguages6 string `json:"programming_languages.6"` ProgrammingLanguages7 string `json:"programming_languages.7"` ProgrammingLanguages8 string `json:"programming_languages.8"` ProgrammingLanguages9 string `json:"programming_languages.9"` ProgrammingLanguages10 string `json:"programming_languages.10"` ProgrammingLanguagesOther string `json:"programming_languages_other"` AboutTheTeamInformationActivelySought int `json:"about_the_team.information_actively_sought,string"` AboutTheTeamMessengersNotPunished int `json:"about_the_team.messengers_not_punished,string"` AboutTheTeamCollaborationEncouraged int `json:"about_the_team.collaboration_encouraged,string"` AboutTheTeamFailureCausesEnquiry int `json:"about_the_team.failure_causes_enquiry,string"` AboutTheTeamNewIdeasWelcomed int `json:"about_the_team.new_ideas_welcomed,string"` AboutTheTeamFailureTreatedAsOpportunity int `json:"about_the_team.failure_treated_as_opportunity,string"` AboutTheTeamExtendedUnguardedDiscussion int `json:"about_the_team_extended.unguarded_discussion,string"` AboutTheTeamExtendedCallOutUnproductiveBehaviour int `json:"about_the_team_extended.call_out_unproductive_behaviour,string"` AboutTheTeamExtendedContributeToCollectiveGood int `json:"about_the_team_extended.contribute_to_collective_good,string"` AboutTheTeamExtendedApologise int `json:"about_the_team_extended.apologise,string"` AboutTheTeamExtendedWillinglyMakeSacrifices int `json:"about_the_team_extended.willingly_make_sacrifices,string"` AboutTheTeamExtendedAdmitMistakes int `json:"about_the_team_extended.admit_mistakes,string"` AboutTheTeamExtendedCompellingMeetings int `json:"about_the_team_extended.compelling_meetings,string"` AboutTheTeamExtendedLeaveMeetingsCommitted int `json:"about_the_team_extended.leave_meetings_committed,string"` AboutTheTeamExtendedMoraleAffectedByFailure int `json:"about_the_team_extended.morale_affected_by_failure,string"` AboutTheTeamExtendedDifficultIssuesRaised int `json:"about_the_team_extended.difficult_issues_raised,string"` AboutTheTeamExtendedConcernedAboutLettingDownPeers int `json:"about_the_team_extended.concerned_about_letting_down_peers,string"` AboutTheTeamExtendedComfortableDiscussingPersonalLives int `json:"about_the_team_extended.comfortable_discussing_personal_lives,string"` AboutTheTeamExtendedClearResolutionDiscussions int `json:"about_the_team_extended.clear_resolution_discussions,string"` AboutTheTeamExtendedChallengeOneAnother int `json:"about_the_team_extended.challenge_one_another,string"` AboutTheTeamExtendedSlowToSeekCredit int `json:"about_the_team_extended.slow_to_seek_credit,string"` LeadTime string `json:"lead_time"` DeploymentFrequency string `json:"deployment_frequency"` Mttr string `json:"mttr"` ChangeFailure string `json:"change_failure"` SurveyID uint `json:"-"` }
Result Struct
type ResultSearchParameters ¶
ResultSearchParameters is used for searching Results
type Survey ¶
type Survey struct { Model Results []Result `json:"results"` Team Team `json:"team"` Name string `gorm:"unique;not null;unique_index" json:"name"` TeamID uint `json:"-"` Components []Component }
Survey Struct
func (*Survey) BeforeSave ¶
func (s *Survey) BeforeSave()
BeforeSave will sanitize input data to be safe
func (Survey) GetAllResults ¶
GetAllResults returns a survey with all results
func (Survey) GetByNameAndShareCode ¶
GetByNameAndShareCode will return a survey by name and share code
type Team ¶
Team Struct
func (*Team) BeforeSave ¶
func (t *Team) BeforeSave()
BeforeSave executes before a team is persisted
type YamlFileToSurveyJSBuilder ¶
YamlFileToSurveyJSBuilder holds the componets to build a SurveyJS survey from YAML