Documentation ¶
Index ¶
- type Database
- func (d *Database) AutoMigrate() error
- func (d *Database) Close() error
- func (db *Database) GetPair(pair string) (*Pair, error)
- func (db *Database) GetPairByToken(token0, token1 string) (*Pair, error)
- func (db *Database) GetPairs(uniswap bool) ([]*Pair, error)
- func (db *Database) IsLiquid(pair string) error
- func (db *Database) NewPair(token0, token1, contract string, uniswap bool) error
- func (db *Database) SetBaseApproved(pair string) error
- func (db *Database) SetLiquid(pair string) error
- type Opts
- type Pair
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database provides a database wrapper for unipan
func (*Database) AutoMigrate ¶
AutoMigrate is used to automatically migrate datbase tables
func (*Database) GetPairByToken ¶
GetPairByToken returns the given pair information searching by token addrs
func (*Database) SetBaseApproved ¶
SetBaseApproved marks the base token as having been approved
type Opts ¶
type Opts struct { Type string Host string Port string User string Password string DBName string DBPath string SSLModeDisable bool }
Opts is used to configure database connections
func OptsFromConfig ¶
OptsFromConfig returns database options from a config file
type Pair ¶
type Pair struct { gorm.Model Token0 string `gorm:"column:token0"` Token1 string `gorm:"column:token1"` // address of the pair contract, we should never have duplciates Contract string `gorm:"unique"` // indicates if the contract is liquid (ie, has had liquidity deposited) Liquid bool // if true pair is on uniswap // if false pair is on pancakeswap Uniswap bool // BaseApproved indicates that the base token (weth or wbnb) has been approved BaseApproved bool `gorm:"column:base_approved"` }
Pair tracks a given
Click to show internal directories.
Click to hide internal directories.