storage

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Interface

type Interface interface {
	Init() error
	Ping() error
	Close() error
	Migrate() error

	CreateSurvey(survey *types.Survey) error
	UpdateSurvey(survey *types.Survey) error
	GetSurveys() ([]*types.Survey, error)
	GetSurveyByField(field string, value interface{}) (*types.Survey, error)

	CreateSurveySession(session *types.SurveySession) error
	UpdateSurveySessionStatus(sessionUUID string, newStatus types.SurveySessionStatus) error
	GetSurveySessionByIPAddress(surveyUUID string, ipAddr string) (*types.SurveySession, error)
	GetSurveySession(surveyUUID string, sessionUUID string) (*types.SurveySession, error)
	UpsertSurveyQuestions(survey *types.Survey) error
	GetSurveyQuestions(surveyID int64) ([]types.Question, error)
	GetSurveySessionsWithAnswers(surveyUUID string, filter *types.SurveySessionsFilter) ([]types.SurveySession, int, error)
	GetSurveySessionAnswers(sessionUUID string) ([]types.QuestionAnswer, error)
	UpsertSurveyQuestionAnswer(sessionUUID string, questionUUID string, answer types.Answer) error
}

type Postgres

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

func (*Postgres) Close

func (p *Postgres) Close() error

func (*Postgres) CreateSurvey

func (p *Postgres) CreateSurvey(survey *types.Survey) error

func (*Postgres) CreateSurveySession

func (p *Postgres) CreateSurveySession(session *types.SurveySession) error

func (*Postgres) GetSurveyByField

func (p *Postgres) GetSurveyByField(field string, value interface{}) (*types.Survey, error)

func (*Postgres) GetSurveyQuestions

func (p *Postgres) GetSurveyQuestions(surveyID int64) ([]types.Question, error)

func (*Postgres) GetSurveySession

func (p *Postgres) GetSurveySession(surveyUUID string, sessionUUID string) (*types.SurveySession, error)

func (*Postgres) GetSurveySessionAnswers

func (p *Postgres) GetSurveySessionAnswers(sessionUUID string) ([]types.QuestionAnswer, error)

func (*Postgres) GetSurveySessionByIPAddress

func (p *Postgres) GetSurveySessionByIPAddress(surveyUUID string, ipAddr string) (*types.SurveySession, error)

func (*Postgres) GetSurveySessionsWithAnswers

func (p *Postgres) GetSurveySessionsWithAnswers(surveyUUID string, filter *types.SurveySessionsFilter) ([]types.SurveySession, int, error)

func (*Postgres) GetSurveys

func (p *Postgres) GetSurveys() ([]*types.Survey, error)

func (*Postgres) Init

func (p *Postgres) Init() error

func (*Postgres) Migrate

func (p *Postgres) Migrate() error

func (*Postgres) Ping

func (p *Postgres) Ping() error

func (*Postgres) UpdateSurvey

func (p *Postgres) UpdateSurvey(survey *types.Survey) error

func (*Postgres) UpdateSurveySessionStatus

func (p *Postgres) UpdateSurveySessionStatus(sessionUUID string, newStatus types.SurveySessionStatus) error

func (*Postgres) UpsertSurveyQuestionAnswer

func (p *Postgres) UpsertSurveyQuestionAnswer(sessionUUID string, questionUUID string, answer types.Answer) error

func (*Postgres) UpsertSurveyQuestions

func (p *Postgres) UpsertSurveyQuestions(survey *types.Survey) error

Jump to

Keyboard shortcuts

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