models

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2016 License: MIT Imports: 3 Imported by: 8

Documentation

Index

Constants

View Source
const (
	IncomeTypeReward    = 0
	IncomeTypeOfferwall = 1
)

Income Type

View Source
const (
	RewardRateTypeLess = "reward-today-less"
	RewardRateTypeMore = "reward-today-more"
)

RewardRateType

View Source
const (
	SessionTypeVerifyEmail   = "verify-email"
	SessionTypeResetPassword = "reset-password"
)

Session type

View Source
const (
	UserStatusBanned     = "banned"
	UserStatusUnverified = "unverified"
	UserStatusVerified   = "verified"
)

User status

View Source
const (
	WithdrawalStatusPending    = 0
	WithdrawalStatusProcessing = 1
	WithdrawalStatusProcessed  = 2
)

WithdrawalStatus

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthToken

type AuthToken struct {
	ID        int64     `db:"id"`
	UserID    int64     `db:"user_id"`
	AuthToken string    `db:"auth_token"`
	CreatedAt time.Time `db:"created_at"`
}

AuthToken model

func (AuthToken) MarshalJSON

func (a AuthToken) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

type Config

type Config struct {
	ID                   int64     `db:"id"`
	TotalRewardThreshold int64     `db:"total_reward_threshold"`
	RefererRewardRate    int64     `db:"referer_reward_rate"`
	UpdatedAt            time.Time `db:"updated_at"`
	CreatedAt            time.Time `db:"created_at"`
}

Config model

type Income

type Income struct {
	ID            int64     `db:"id"`
	UserID        int64     `db:"user_id"`
	RefererID     int64     `db:"referer_id"`
	Type          int64     `db:"type"`
	Income        int64     `db:"income"`
	RefererIncome int64     `db:"referer_income"`
	CreatedAt     time.Time `db:"created_at"`
}

Income model

func (Income) MarshalJSON

func (i Income) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface

type RewardRate

type RewardRate struct {
	ID        int64     `db:"id"`
	Min       int64     `db:"min"`
	Max       int64     `db:"max"`
	Weight    int64     `db:"weight"`
	Type      string    `db:"type"`
	CreatedAt time.Time `db:"created_at"`
	UpdatedAt time.Time `db:"updated_at"`
}

RewardRate model

type Session

type Session struct {
	ID        int64     `db:"id"`
	UserID    int64     `db:"user_id"`
	Token     string    `db:"token"`
	Type      string    `db:"type"`
	UpdatedAt time.Time `db:"updated_at"`
}

Session model

type TotalReward

type TotalReward struct {
	ID        int64     `db:"id"`
	Total     int64     `db:"total"`
	CreatedAt time.Time `db:"created_at"`
}

TotalReward model

func (*TotalReward) IsSameDay

func (t *TotalReward) IsSameDay(now time.Time) bool

IsSameDay checks if created_at and now are in the same day

type User

type User struct {
	ID                  int64     `db:"id" json:"id,omitempty"`
	Email               string    `db:"email" json:"email,omitempty"`
	Address             string    `db:"address" json:"address,omitempty"`
	Status              string    `db:"status" json:"status,omitempty"`
	Balance             int64     `db:"balance" json:"balance"`
	MinWithdrawalAmount int64     `db:"min_withdrawal_amount" json:"min_withdrawal_amount"`
	RewardInterval      int64     `db:"reward_interval" json:"reward_interval"`
	RewardedAt          time.Time `db:"rewarded_at" json:"rewarded_at"`
	RefererID           int64     `db:"referer_id" json:"-"`
	UpdatedAt           time.Time `db:"updated_at" json:"-"`
	CreatedAt           time.Time `db:"created_at" json:"created_at"`
}

User model

func (User) HasReferer

func (u User) HasReferer() bool

HasReferer indicates if the user is referred by another user

type WebsocketMessage

type WebsocketMessage struct {
	UsersOnline   int           `json:"users_online,omitempty"`
	LatestIncomes []interface{} `json:"latest_incomes,omitempty"`
	DeltaIncome   interface{}   `json:"delta_income,omitempty"`
}

WebsocketMessage model

type Withdrawal

type Withdrawal struct {
	ID            int64     `db:"id" json:"id"`
	UserID        int64     `db:"user_id" json:"user_id"`
	Address       string    `db:"address" json:"address"`
	Amount        int64     `db:"amount" json:"amount"`
	Status        int64     `db:"status" json:"status"`
	TransactionID string    `db:"transaction_id" json:"tx_id"`
	UpdatedAt     time.Time `db:"updated_at" json:"updated_at"`
	CreatedAt     time.Time `db:"created_at" json:"created_at"`
}

Withdrawal model

Jump to

Keyboard shortcuts

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