model

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DBTypeMySQL    = "mysql"
	DBTypePostgres = "postgres"
)
View Source
const (
	SurveyStatusInProgress = "in_progress"
	SurveyStatusEnded      = "ended"

	QuestionTypeLinearScale = "linear_scale"
	QuestionType            = "text"

	TeamFilterSendToAll       = "everyone"
	TeamFilterIncludeSelected = "include_selected"
	TeamFilterExcludeSelected = "exclude_selected"
)
View Source
const (
	ResponseTypeComplete = "complete"
	ResponseTypePartial  = "partial"
)

Variables

Functions

func IsErrNotFound

func IsErrNotFound(err error) bool

Types

type Config

type Config struct {
	EnableSurvey    bool            `json:"EnableSurvey"`
	SurveyDateTime  SurveyDateTime  `json:"SurveyDateTime"`
	SurveyExpiry    SurveyExpiry    `json:"SurveyExpiry"`
	SurveyQuestions SurveyQuestions `json:"SurveyQuestions"`
	TeamFilter      TeamFilter      `json:"TeamFilter"`
}

func (*Config) ParsedTime

func (c *Config) ParsedTime() time.Time

func (*Config) ShouldSurveyStart

func (c *Config) ShouldSurveyStart() (bool, error)

func (*Config) ToMap added in v1.0.1

func (c *Config) ToMap() (map[string]interface{}, error)

type ErrorResponse

type ErrorResponse struct {
	Error     string `json:"error"`
	ErrorCode int    `json:"errorCode"`
}

type Question

type Question struct {
	ID        string `json:"id"`
	Text      string `json:"text"`
	Type      string `json:"type"`
	System    bool   `json:"system"`
	Mandatory bool   `json:"mandatory"`
}

type Survey

type Survey struct {
	ID              string          `json:"id"`
	FilterTeamIDs   []string        `json:"excludedTeamIDs"`
	TeamFilterType  string          `json:"teamFilterType"`
	CreateAt        int64           `json:"createAt"`
	UpdateAt        int64           `json:"updateAt"`
	StartTime       int64           `json:"startTime"`
	Duration        int             `json:"duration"`
	SurveyQuestions SurveyQuestions `json:"surveyQuestions"`
	Status          string          `json:"status"`
}

func (*Survey) GetEndTime

func (s *Survey) GetEndTime() time.Time

func (*Survey) GetSystemRatingQuestionID

func (s *Survey) GetSystemRatingQuestionID() (string, error)

func (*Survey) IsEqual

func (s *Survey) IsEqual(survey *Survey) bool

func (*Survey) IsValid

func (s *Survey) IsValid() error

func (*Survey) SetDefaults

func (s *Survey) SetDefaults()

func (*Survey) ShouldSurveyStop

func (s *Survey) ShouldSurveyStop() bool

type SurveyDateTime

type SurveyDateTime struct {
	Timestamp int64 `json:"timestamp"`
}

type SurveyExpiry

type SurveyExpiry struct {
	Days int `json:"days"`
}

type SurveyQuestions

type SurveyQuestions struct {
	Questions         []Question `json:"questions"`
	SurveyMessageText string     `json:"surveyMessageText"`
}

func (*SurveyQuestions) GetMetadata

func (sq *SurveyQuestions) GetMetadata() []interface{}

type SurveyResponse

type SurveyResponse struct {
	ID           string            `json:"ID"`
	UserID       string            `json:"userID"`
	SurveyID     string            `json:"surveyID"`
	Response     map[string]string `json:"response"` // map of question ID to response
	CreateAt     int64             `json:"createAt"`
	ResponseType string            `json:"responseType"`
}

func (*SurveyResponse) IsValid

func (sr *SurveyResponse) IsValid() error

func (*SurveyResponse) SetDefaults

func (sr *SurveyResponse) SetDefaults()

func (*SurveyResponse) ToReportRow

func (sr *SurveyResponse) ToReportRow(surveyQuestions []Question) []string

type SurveyStat

type SurveyStat struct {
	Survey

	ReceiptCount   int64 `json:"receiptCount"`
	ResponseCount  int64 `json:"responseCount"`
	PassiveCount   int64 `json:"passiveCount"`
	PromoterCount  int64 `json:"promoterCount"`
	DetractorCount int64 `json:"detractorCount"`
}

func (*SurveyStat) ToMetadata

func (stat *SurveyStat) ToMetadata() map[string]interface{}

type TeamFilter

type TeamFilter struct {
	FilteredTeamIDs []string `json:"filteredTeamIDs"`
	FilterType      string   `json:"filterType"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL