models

package
v0.0.0-...-7e0fa43 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2018 License: MIT Imports: 4 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CREDchangeUserID

func CREDchangeUserID(db *sql.DB, oldID int, newID int) error

func GetOpenedVotesCount

func GetOpenedVotesCount(db *sql.DB) (count int)

func GetTestCredentials

func GetTestCredentials(db *sql.DB) (result string, err error)

func GetTodayVotesCountForUserID

func GetTodayVotesCountForUserID(userID int, db *sql.DB) (count int)

func IsActiveCredential

func IsActiveCredential(userID int, db *sql.DB) bool

func IsReferrerExists

func IsReferrerExists(referrer string, db *sql.DB) bool

func REFchangeUserID

func REFchangeUserID(db *sql.DB, oldID int, newID int) error

Types

type Credential

type Credential struct {
	UserID   int
	UserName string
	Power    int
	Active   bool
}

func GetAllActiveCredentials

func GetAllActiveCredentials(db *sql.DB) (credentials []Credential, err error)

func GetCredentialByUserID

func GetCredentialByUserID(userID int, db *sql.DB) (credential Credential, err error)

func GetCredentialByUserName

func GetCredentialByUserName(userName string, db *sql.DB) (credential Credential, err error)

func (Credential) Save

func (credential Credential) Save(db *sql.DB) (bool, error)

func (Credential) UpdatePower

func (credential Credential) UpdatePower(power int, db *sql.DB) error

type Referral

type Referral struct {
	UserID    int
	Referrer  string
	Completed bool
}

func GetReferralByUserID

func GetReferralByUserID(userID int, db *sql.DB) (referral Referral, err error)

func (Referral) Save

func (referral Referral) Save(db *sql.DB) (bool, error)

func (Referral) SetCompleted

func (referral Referral) SetCompleted(db *sql.DB) error

type Response

type Response struct {
	UserID int
	VoteID int64
	Result bool
	Date   time.Time
}

func GetAllResponsesForVoteID

func GetAllResponsesForVoteID(voteID int64, db *sql.DB) (responses []Response, err error)

func GetLastResponse

func GetLastResponse(db *sql.DB) (response Response)

func (Response) Exists

func (response Response) Exists(db *sql.DB) bool

func (Response) Save

func (response Response) Save(db *sql.DB) (bool, error)

type State

type State struct {
	UserID int
	Action string
}

func GetStateByUserID

func GetStateByUserID(userID int, db *sql.DB) (state State, err error)

func (State) Save

func (state State) Save(db *sql.DB) (bool, error)

type Vote

type Vote struct {
	VoteID    int64
	UserID    int
	Author    string
	Permalink string
	Percent   int
	Completed bool
	Date      time.Time
}

func GetLastVote

func GetLastVote(db *sql.DB) (vote Vote)

func GetVote

func GetVote(db *sql.DB, voteID int64) (vote Vote)

func (Vote) Exists

func (vote Vote) Exists(db *sql.DB) bool

func (Vote) Save

func (vote Vote) Save(db *sql.DB) (int64, error)

Jump to

Keyboard shortcuts

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