decred.org/dcrdex@v1.0.5/server/db/driver/pg/internal/markets.go (about)

     1  package internal
     2  
     3  const (
     4  	// CreateMarketsTable creates the DEX's "markets" table, which indicates
     5  	// which markets are currently recognized by the DEX, and their configured
     6  	// lot sizes. This tables should be created in the public schema. This
     7  	// information is stored in a table to facilitate the addition and removal
     8  	// of markets, plus market lot size changes, without having to assume that
     9  	// whatever is specified in a config file is accurately reflected by the DB
    10  	// tables.
    11  	CreateMarketsTable = `CREATE TABLE IF NOT EXISTS %s (
    12  		name TEXT PRIMARY KEY,
    13  		base INT8,
    14  		quote INT8,
    15  		lot_size INT8
    16  	)`
    17  
    18  	// SelectAllMarkets retrieves the active market information.
    19  	SelectAllMarkets = `SELECT name, base, quote, lot_size FROM %s;`
    20  
    21  	// InsertMarket inserts a new market in to the markets tables
    22  	InsertMarket = `INSERT INTO %s (name, base, quote, lot_size)
    23  		VALUES ($1, $2, $3, $4);`
    24  
    25  	// UpdateLotSize updates the market's lot size.
    26  	UpdateLotSize = `UPDATE %s SET lot_size = $2 WHERE name = $1;`
    27  )