storage

package
v0.0.36 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2017 License: MIT Imports: 12 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Sql

type Sql struct {
	Db *sql.DB
}

func NewSql

func NewSql(conDsn string) (s *Sql, err error)

func (*Sql) AddCustomQuestion added in v0.0.20

func (s *Sql) AddCustomQuestion(questionId string, text string, replyText string) error

func (*Sql) AddRawLineEvent

func (s *Sql) AddRawLineEvent(eventType, rawevent string) error

func (*Sql) AddUpdateUserProfile added in v0.0.14

func (s *Sql) AddUpdateUserProfile(userID, displayName string) error

AddUpdateUserProfile adds a user profile if the user already exists in the table this method does nothing

func (*Sql) Close

func (s *Sql) Close() error

func (*Sql) CustomQuestion added in v0.0.20

func (s *Sql) CustomQuestion(userId string) (questionId string, replyText string, qTs int, err error)

CustomQuestion returns the last question sent based on when the user registered on the website

func (*Sql) FindUserLocation added in v0.0.28

func (s *Sql) FindUserLocation(userId string) (l domain.LocationThai, err error)

func (*Sql) GetAllActiveUserProfiles added in v0.0.20

func (s *Sql) GetAllActiveUserProfiles() (profiles []domain.UserProfile, err error)

func (*Sql) GetConfigVal added in v0.0.14

func (s *Sql) GetConfigVal(key string) (string, error)

func (*Sql) GetGpsAnswerData added in v0.0.5

func (s *Sql) GetGpsAnswerData() (answerGpsData []UserGpsAnswerData, err error)

func (*Sql) GetLastNormalisedIslandId added in v0.0.19

func (s *Sql) GetLastNormalisedIslandId() (answerId int, err error)

func (*Sql) GetLastNormalisedPriceId added in v0.0.19

func (s *Sql) GetLastNormalisedPriceId() (answerId int, err error)

func (*Sql) GetLocationPrices added in v0.0.28

func (s *Sql) GetLocationPrices() (locs []domain.LocationPrice, err error)

func (*Sql) GetLocations added in v0.0.11

func (s *Sql) GetLocations() (locs []domain.LocationThai, err error)

func (*Sql) GetPriceTplMsg added in v0.0.11

func (s *Sql) GetPriceTplMsg() (string, error)

func (*Sql) GetQuestions

func (s *Sql) GetQuestions() (qs *domain.Questions, err error)

func (*Sql) GetRawLineEvents added in v0.0.20

func (s *Sql) GetRawLineEvents() (evts []domain.LineEventExport, err error)

func (*Sql) GetUserAnswerData added in v0.0.5

func (s *Sql) GetUserAnswerData() (answerData []UserAnswerData, err error)

func (*Sql) GetUserNearbyPrices added in v0.0.11

func (s *Sql) GetUserNearbyPrices(userId string) (lp []domain.LocationPrice, err error)

func (*Sql) GetUserProfile

func (s *Sql) GetUserProfile(userId string) (domain.UserProfile, error)

func (*Sql) GetWebSurveyBtnConfig added in v0.0.14

func (s *Sql) GetWebSurveyBtnConfig() (WebSurveyBtnConfig, error)

func (*Sql) GetWelcomeMsgs

func (s *Sql) GetWelcomeMsgs(tplVars *WelcomeMsgTplVars) (msgs []string, err error)

func (*Sql) NormaliseIslands added in v0.0.19

func (s *Sql) NormaliseIslands(fromAnswerId int) (answerId int, err error)

func (*Sql) NormalisePrices added in v0.0.19

func (s *Sql) NormalisePrices(fromAnswerId int) (answerId int, err error)

NormalisePrices will go through all Price answers and returns answerId - last successfully normalised answerId

func (*Sql) ToggleUserSurvey added in v0.0.14

func (s *Sql) ToggleUserSurvey(userId string, started bool) error

func (*Sql) UpdateUserProfile added in v0.0.14

func (s *Sql) UpdateUserProfile(p domain.UserProfile) error

func (*Sql) UserAddAnswer

func (s *Sql) UserAddAnswer(answer domain.Answer) error

func (*Sql) UserAddGpsAnswer

func (s *Sql) UserAddGpsAnswer(answer domain.AnswerGps) error

func (*Sql) UserAnsweredCustomQuestion added in v0.0.20

func (s *Sql) UserAnsweredCustomQuestion(userId, questionId string, qTs int) (bool, error)

func (*Sql) UserGetLastAnswer

func (s *Sql) UserGetLastAnswer(uid string) (domain.Answer, error)

func (*Sql) UserHasAnswers

func (s *Sql) UserHasAnswers(userId string) (bool, error)

func (*Sql) UserLastLocationAnswer added in v0.0.20

func (s *Sql) UserLastLocationAnswer(userId string) (string, error)

func (*Sql) UsersSurveyNotStarted added in v0.0.14

func (s *Sql) UsersSurveyNotStarted(delaySecs int64) (userIds []string, err error)

func (*Sql) WipeUser

func (s *Sql) WipeUser(userId string) error

type UserAnswerData added in v0.0.5

type UserAnswerData struct {
	// @TODO embed domain.Answer
	// domain.Answer
	Id         uint
	UserId     string
	QuestionId string
	Answer     string
	Channel    string
	Timestamp  int
}

type UserGpsAnswerData added in v0.0.5

type UserGpsAnswerData struct {
	Id        uint
	UserId    string
	Address   string
	Lat       float64
	Lon       float64
	Timestamp int
	Channel   string
}

type WebSurveyBtnConfig added in v0.0.14

type WebSurveyBtnConfig struct {
	Title     string
	Text      string
	Label     string
	ImageName string
}

type WelcomeMsgTplVars

type WelcomeMsgTplVars struct {
	UserId   string
	Hostname string
}

Jump to

Keyboard shortcuts

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