models

package
v0.0.0-...-18143ea Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2018 License: MIT Imports: 3 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActivateCurator

func ActivateCurator(userID int, db *sql.DB) error

func ComputeIntervalForUser

func ComputeIntervalForUser(userID int, n int, baseInterval int, db *sql.DB) (time.Duration, error)

computes interval based on last n posts

func DeactivateCurator

func DeactivateCurator(userID int, db *sql.DB) error

func GetAllActiveCurstorsChatID

func GetAllActiveCurstorsChatID(db *sql.DB) ([]int64, error)

func GetAllActiveCurstorsID

func GetAllActiveCurstorsID(db *sql.DB) ([]int, error)

func GetLastReportDate

func GetLastReportDate(db *sql.DB) (lastReportDate time.Time)

func GetLastRewardDate

func GetLastRewardDate(db *sql.DB) (lastReportDate time.Time)

func GetNumResponsesForMotivation

func GetNumResponsesForMotivation(date time.Time, db *sql.DB) (num int)

func GetNumResponsesForMotivationForUserID

func GetNumResponsesForMotivationForUserID(userID int, date time.Time, db *sql.DB) (num int)

func GetNumResponsesVoteID

func GetNumResponsesVoteID(voteID int64, db *sql.DB) (int, int)

func GetOpenedVotesCount

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

func GetUserIDsForMotivation

func GetUserIDsForMotivation(date time.Time, db *sql.DB) (userIDs []int, err error)

func IsActiveCredential

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

func IsActiveCurator

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

func IsReferralExists

func IsReferralExists(referral string, db *sql.DB) bool

func NewReportPosted

func NewReportPosted(db *sql.DB) (int64, error)

func NewRewardDistributed

func NewRewardDistributed(db *sql.DB) (int64, error)

func WannaSleepOneDay

func WannaSleepOneDay(hour, min int) (sleepTime time.Duration)

func WannaSleepTill

func WannaSleepTill(weekday time.Weekday, hour, min int) (sleepTime time.Duration)

Types

type Credential

type Credential struct {
	UserID   int
	ChatID   int64
	UserName string
	Power    int
	Active   bool
	Curates  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
	UserName  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 (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
	Rejected  bool
	Addled    bool
	Date      time.Time
}

func GetAllOpenedVotes

func GetAllOpenedVotes(db *sql.DB) (votes []Vote, err error)

func GetLastVoteForUserID

func GetLastVoteForUserID(userID int, db *sql.DB) (vote Vote)

func GetLastVotesForUserID

func GetLastVotesForUserID(userID int, num int, db *sql.DB) (votes []Vote, err error)

func GetTrulyCompletedVotesSince

func GetTrulyCompletedVotesSince(date time.Time, db *sql.DB) (votes []Vote, err error)

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