domain

package
v0.0.0-...-c2d312f Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const MaxMonitorEpoch int = 5

Max promo epoch.

View Source
const Promo string = "^[a-z0-9-_.]{3,12}$"

Regular expression for promo code.

Variables

View Source
var Epochs map[int]*Monitor = map[int]*Monitor{
	1: {Id: 1, Reward: 1000, UsageLimit: 500},
	2: {Id: 2, Reward: 900, UsageLimit: 2000},
	3: {Id: 3, Reward: 800, UsageLimit: 2500},
	4: {Id: 4, Reward: 700, UsageLimit: 10000},
	5: {Id: 5, Reward: 600, UsageLimit: 10000},
}

Promo monitor epochs.

Functions

This section is empty.

Types

type Code

type Code int

Error status code.

const (
	CodeInternal Code = iota
	CodeNotFound
	CodeAlreadyExists
	CodeInvalidArgument
)

Error status codes.

type Error

type Error struct {
	Code    Code
	Message string
}

Error structure.

func (*Error) Error

func (e *Error) Error() string

Getting error message.

type Monitor

type Monitor struct {
	// Promo epoch id.
	Id int `bson:"_id"`
	// Promo reward.
	Reward int `bson:"reward"`
	// Promo usage limit.
	UsageLimit int `bson:"usageLimit"`
	// Promo epoch started in.
	StartedIn time.Time `bson:"startedIn,omitempty"`
	// Updated at promo monitor.
	UpdatedAt time.Time `bson:"updatedAt,omitempty"`
}

Promo monitor structure.

type User

type User struct {
	// User discord id.
	Id string `bson:"_id"`
	// User own promo code.
	Promo string `bson:"promo,omitempty"`
	// User used promo code.
	Used string `bson:"used,omitempty"`
	// User token balance.
	Balance int `bson:"balance,omitempty"`
}

User structure.

func (User) Validate

func (u User) Validate() error

Validating a user.

Jump to

Keyboard shortcuts

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