models

package
v0.0.0-...-a888265 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB

Functions

func Close

func Close() error

func Connect

func Connect()

Types

type Relayer

type Relayer struct {
	gorm.Model
	Name      string          `json:"name"`
	Url       string          `json:"url"`
	Slug      string          `gorm:"unique_index" json:"slug"`
	Address   string          `gorm:"unique_index" json:"address"`
	Volume24h decimal.Decimal `gorm:"column:volume_24h;type:decimal(32,18)" json:"volume24h"`
	// GORM ignore
	Trades24h  uint64 `gorm:"-" json:"trades24h"`
	Traders24h uint64 `gorm:"-" json:"traders24h"`
}

func (Relayer) TableName

func (Relayer) TableName() string

type Token

type Token struct {
	gorm.Model
	Name           string          `json:"name"`
	Symbol         string          `json:"symbol"`
	Decimals       uint            `json:"decimals"`
	Address        string          `gorm:"unique_index" json:"address"`
	TotalSupply    string          `gorm:"column:total_supply" json:"totalSupply"`
	HoldersCount   uint64          `gorm:"column:holders_count" json:"holdersCount"`
	PriceUSD       decimal.Decimal `gorm:"column:price_usd;type:decimal(32,18)" json:"priceUSD"`
	PriceUpdatedAt time.Time       `gorm:"column:price_updated_at" json:"priceUpdatedAt"`

	Volume24h       decimal.Decimal `gorm:"column:volume_24h;type:decimal(32,18)" json:"volume24h"`
	Volume7d        decimal.Decimal `gorm:"column:volume_7d;type:decimal(32,18)" json:"volume7d"`
	Volume1m        decimal.Decimal `gorm:"column:volume_1m;type:decimal(32,18)" json:"volume1m"`
	VolumeAll       decimal.Decimal `gorm:"column:volume_all;type:decimal(32,18)" json:"volumeAll"`
	Volume24hChange float32         `gorm:"column:volume_24h_change" json:"volume24hChange"`
	Volume7dChange  float32         `gorm:"column:volume_7d_change" json:"volume7dChange"`
	Volume1mChange  float32         `gorm:"column:volume_1m_change" json:"volume1mChange"`

	// GORM ignore
	Trades24h        uint64          `gorm:"-" json:"trades24h"`
	Trades24hChange  float32         `gorm:"-" json:"trades24hChange"`
	Traders24h       uint64          `gorm:"-" json:"traders24h"`
	Traders24hChange float32         `gorm:"-" json:"traders24hChange"`
	Amount24h        decimal.Decimal `gorm:"-" json:"amount24h"`
}

func (Token) TableName

func (Token) TableName() string

type Trade

type Trade struct {
	gorm.Model
	UUID               string          `gorm:"column:uuid;unique_index;not null" json:"uuid"`
	BlockNumber        uint64          `gorm:"column:block_number;index;unique_index:idx_block_number_log_index" json:"blockNumber"`
	BlockHash          string          `gorm:"column:block_hash" json:"blockHash"`
	TransactionHash    string          `gorm:"column:transaction_hash" json:"transactionHash"`
	LogIndex           uint            `gorm:"column:log_index;unique_index:idx_block_number_log_index" json:"logIndex"`
	Date               time.Time       `gorm:"column:date;index" json:"date"`
	QuoteTokenPriceUSD decimal.Decimal `gorm:"column:quote_token_price_usd;type:decimal(32,18)" json:"quoteTokenPriceUSD"`
	VolumeUSD          decimal.Decimal `gorm:"column:volume_usd;type:decimal(32,18)" json:"volumeUSD"`
	BaseTokenAddress   string          `gorm:"column:base_token_address;index" json:"baseTokenAddress"`
	QuoteTokenAddress  string          `gorm:"column:quote_token_address;index" json:"quoteTokenAddress"`
	RelayerAddress     string          `gorm:"column:relayer_address;index" json:"relayerAddress"`
	MakerAddress       string          `gorm:"column:maker_address" json:"makerAddress"`
	TakerAddress       string          `gorm:"column:taker_address" json:"takerAddress"`
	BuyerAddress       string          `gorm:"column:buyer_address" json:"buyerAddress"`
	BaseTokenAmount    decimal.Decimal `gorm:"column:base_token_amount;type:decimal(32,18)" json:"baseTokenAmount"`
	QuoteTokenAmount   decimal.Decimal `gorm:"column:quote_token_amount;type:decimal(32,18)" json:"quoteTokenAmount"`
	MakerFee           decimal.Decimal `gorm:"column:maker_fee;type:decimal(32,18)" json:"makerFee"`
	TakerFee           decimal.Decimal `gorm:"column:taker_fee;type:decimal(32,18)" json:"takerFee"`
	MakerGasFee        decimal.Decimal `gorm:"column:maker_gas_fee;type:decimal(32,18)" json:"makerGasFee"`
	MakerRebate        decimal.Decimal `gorm:"column:maker_rebate;type:decimal(32,18)" json:"makerRebate"`
	TakerGasFee        decimal.Decimal `gorm:"column:taker_gas_fee;type:decimal(32,18)" json:"takerGasFee"`
	BaseToken          Token           `gorm:"foreignkey:base_token_address;association_foreignkey:address" json:"baseToken"`
	QuoteToken         Token           `gorm:"foreignkey:quote_token_address;association_foreignkey:address" json:"quoteToken"`
	Relayer            Relayer         `gorm:"foreignkey:relayer_address;association_foreignkey:address" json:"relayer"`
	ProtocolVersion    string          `gorm:"column:protocol_version;default:'1';index" json:"protocolVersion"`
}

func (*Trade) BeforeCreate

func (m *Trade) BeforeCreate(scope *gorm.Scope) (err error)

func (Trade) TableName

func (Trade) TableName() string

Jump to

Keyboard shortcuts

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