entity

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NotificationStatusPending = iota
	NotificationStatusDone
	NotificationStatusFail
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AzbitPriceResponse

type AzbitPriceResponse struct {
	Timestamp                int     `json:"timestamp"`
	CurrencyPairCode         string  `json:"currencyPairCode"`
	Price                    float64 `json:"price"`
	Price24HAgo              float64 `json:"price24hAgo"`
	PriceChangePercentage24H float64 `json:"priceChangePercentage24h"`
	Volume24H                float64 `json:"volume24h"`
	BidPrice                 float64 `json:"bidPrice"`
	AskPrice                 float64 `json:"askPrice"`
	Low24H                   float64 `json:"low24h"`
	High24H                  float64 `json:"high24h"`
}

type CrowdfundCampaign added in v0.0.3

type CrowdfundCampaign struct {
	DBModel

	CreatorID uint      // TODO: define foreign key here
	Title     string    `gorm:"type:char(128);not null"`
	Desc      string    `gorm:"type:text;not null"`
	Packages  []Package `gorm:"serializer:json"`
}

type CrowdfundPurchase added in v0.0.3

type CrowdfundPurchase struct {
	DBModel

	UserID    uint
	InvoiceID string
	TxHash    string `gorm:"type:char(64);default:null"`
	Recipient string `gorm:"type:char(42)"`
}

func (*CrowdfundPurchase) IsClaimed added in v0.0.3

func (p *CrowdfundPurchase) IsClaimed() bool

type DBModel

type DBModel struct {
	ID        uint         `gorm:"primarykey"`
	CreatedAt time.Time    `gorm:"not null"`
	UpdatedAt time.Time    `gorm:"not null"`
	DeletedAt sql.NullTime `gorm:"default:null"`
}

type Notification

type Notification struct {
	DBModel

	Type      notification.NotificationType `gorm:"type:tinyint"`
	Recipient string                        `gorm:"size:255"`
	Data      VoucherNotificationData       `gorm:"serializer:json"`
	Status    NotificationStatus            `gorm:"type:tinyint"`
}

type NotificationStatus

type NotificationStatus int

type Package added in v0.0.3

type Package struct {
	Name      string `json:"name"`
	USDAmount int    `json:"usd_amount"`
	PACAmount int    `json:"pac_amount"`
}

type PhoenixFaucet

type PhoenixFaucet struct {
	DBModel

	UserID  uint          `gorm:"type:bigint"`
	Address string        `gorm:"type:char(43)"`
	Amount  amount.Amount `gorm:"column:amount"`
	TxHash  string        `gorm:"type:char(64);unique;not null"`
}

func (*PhoenixFaucet) ElapsedTime

func (f *PhoenixFaucet) ElapsedTime() time.Duration

func (*PhoenixFaucet) TableName

func (*PhoenixFaucet) TableName() string

type PlatformID

type PlatformID int
const (
	PlatformIDCLI      PlatformID = 1
	PlatformIDDiscord  PlatformID = 2
	PlatformIDWeb      PlatformID = 3
	PlatformIDReserved PlatformID = 4
	PlatformIDTelegram PlatformID = 5
)

func AllAppIDs

func AllAppIDs() []PlatformID

func (PlatformID) String

func (appID PlatformID) String() string

type Price

type Price struct {
	XeggexPacToUSDT XeggexPriceResponse
	AzbitPacToUSDT  AzbitPriceResponse
}

type Role

type Role int
const (
	Admin     Role = 0
	Moderator Role = 1
	BasicUser Role = 2
)

type User

type User struct {
	DBModel

	PlatformID     PlatformID `gorm:"type:tinyint;uniqueIndex:idx_platform_user"`
	PlatformUserID string     `gorm:"type:char(64);uniqueIndex:idx_platform_user"`
	Role           Role       `gorm:"type:tinyint"`
}

type Voucher

type Voucher struct {
	DBModel

	Creator     uint
	Code        string        `gorm:"type:char(8);unique"`
	Amount      amount.Amount `gorm:"column:amount"`
	Desc        string
	Email       string
	Recipient   string
	ValidMonths uint8
	TxHash      string `gorm:"type:char(64);default:null"`
	ClaimedBy   uint
}

func (*Voucher) IsClaimed

func (v *Voucher) IsClaimed() bool

func (Voucher) TableName

func (Voucher) TableName() string

type VoucherNotificationData

type VoucherNotificationData struct {
	Code      string  `json:"code"`
	Amount    float64 `json:"amount"`
	Recipient string  `json:"recipient"`
}

type XeggexPriceResponse

type XeggexPriceResponse struct {
	LastPrice      string  `json:"lastPrice"`
	YesterdayPrice string  `json:"yesterdayPrice"`
	HighPrice      string  `json:"highPrice"`
	LowPrice       string  `json:"lowPrice"`
	Volume         string  `json:"volume"`
	Decimal        int     `json:"priceDecimals"`
	BestAsk        string  `json:"bestAsk"`
	BestBid        string  `json:"bestBid"`
	SpreadPercent  string  `json:"spreadPercent"`
	ChangePercent  string  `json:"changePercent"`
	MarketCap      float64 `json:"marketcapNumber"`
}

type ZealyUser

type ZealyUser struct {
	DBModel

	Amount    amount.Amount `gorm:"column:amount"`
	DiscordID string        `gorm:"column:discord_id"`
	TxHash    string        `gorm:"type:char(64);default:null"`
}

func (*ZealyUser) IsClaimed

func (z *ZealyUser) IsClaimed() bool

Jump to

Keyboard shortcuts

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