store

package
v0.0.0-...-182d517 Latest Latest
Warning

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

Go to latest
Published: May 25, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TablePrefix = "user_survey_"
)

Variables

View Source
var Assets embed.FS
View Source
var (
	ErrUnsupportedDatabaseType = errors.New("database type is unsupported")
)

Functions

This section is empty.

Types

type Params

type Params struct {
	DBType           string
	ConnectionString string
	TablePrefix      string
	DB               *sql.DB
	PluginAPI        plugin.API
	SkipMigrations   bool
	Driver           plugin.Driver
}

func (Params) IsValid

func (p Params) IsValid() error

type SQLStore

type SQLStore struct {
	// contains filtered or unexported fields
}

func New

func New(params Params) (*SQLStore, error)

func (*SQLStore) GetAllResponses

func (s *SQLStore) GetAllResponses(surveyID, lastResponseID string, perPage uint64) ([]*model.SurveyResponse, error)

func (*SQLStore) GetLatestEndedSurvey

func (s *SQLStore) GetLatestEndedSurvey() (*model.Survey, error)

func (*SQLStore) GetSchemaName

func (s *SQLStore) GetSchemaName() (string, error)

func (*SQLStore) GetSurveyResponse

func (s *SQLStore) GetSurveyResponse(userID, surveyID string) (*model.SurveyResponse, error)

func (*SQLStore) GetSurveyStat

func (s *SQLStore) GetSurveyStat(surveyID string) (*model.SurveyStat, error)

func (*SQLStore) GetSurveyStatList

func (s *SQLStore) GetSurveyStatList() ([]*model.SurveyStat, error)

func (*SQLStore) GetSurveysByID

func (s *SQLStore) GetSurveysByID(surveyID string) (*model.Survey, error)

func (*SQLStore) GetSurveysByStatus

func (s *SQLStore) GetSurveysByStatus(status string) ([]*model.Survey, error)

func (*SQLStore) GetTemplateHelperFuncs

func (s *SQLStore) GetTemplateHelperFuncs() template.FuncMap

func (*SQLStore) IncrementSurveyReceiptCount

func (s *SQLStore) IncrementSurveyReceiptCount(surveyID string) error

func (*SQLStore) IncrementSurveyResponseCount

func (s *SQLStore) IncrementSurveyResponseCount(surveyID string) error

func (*SQLStore) MarshalJSONB

func (s *SQLStore) MarshalJSONB(data interface{}) ([]byte, error)

func (*SQLStore) Migrate

func (s *SQLStore) Migrate() error

func (*SQLStore) ResetData

func (s *SQLStore) ResetData() error

func (*SQLStore) SaveSurvey

func (s *SQLStore) SaveSurvey(survey *model.Survey) error

func (*SQLStore) SaveSurveyResponse

func (s *SQLStore) SaveSurveyResponse(response *model.SurveyResponse) error

func (*SQLStore) Shutdown

func (s *SQLStore) Shutdown() error

func (*SQLStore) SurveysFromRows

func (s *SQLStore) SurveysFromRows(rows *sql.Rows) ([]*model.Survey, error)

func (*SQLStore) UpdateRatingGroupCount

func (s *SQLStore) UpdateRatingGroupCount(surveyID string, promoterFactor, neutralFactor, detractorFactor int) error

func (*SQLStore) UpdateSurveyResponse

func (s *SQLStore) UpdateSurveyResponse(response *model.SurveyResponse) error

func (*SQLStore) UpdateSurveyStatus

func (s *SQLStore) UpdateSurveyStatus(surveyID, status string) error

type Store

type Store interface {
	Shutdown() error
	Migrate() error
	GetTemplateHelperFuncs() template.FuncMap
	GetSchemaName() (string, error)
	GetSurveysByStatus(status string) ([]*model.Survey, error)
	GetSurveysByID(surveyID string) (*model.Survey, error)
	SurveysFromRows(rows *sql.Rows) ([]*model.Survey, error)
	SaveSurvey(survey *model.Survey) error
	UpdateSurveyStatus(surveyID, status string) error
	SaveSurveyResponse(response *model.SurveyResponse) error
	GetSurveyResponse(userID, surveyID string) (*model.SurveyResponse, error)
	UpdateSurveyResponse(response *model.SurveyResponse) error
	IncrementSurveyReceiptCount(surveyID string) error
	IncrementSurveyResponseCount(surveyID string) error
	GetSurveyStatList() ([]*model.SurveyStat, error)
	GetSurveyStat(surveyID string) (*model.SurveyStat, error)
	UpdateRatingGroupCount(surveyID string, promoterFactor, neutralFactor, detractorFactor int) error
	ResetData() error
	GetAllResponses(surveyID, lastResponseID string, perPage uint64) ([]*model.SurveyResponse, error)
	GetLatestEndedSurvey() (*model.Survey, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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