mirror of
https://github.com/GrassrootsEconomics/cic-dw.git
synced 2024-11-14 03:46:46 +01:00
Mohammed Sohail
37538c68ff
- see docs for pagination api usage - added control for syncer/api goroutines
19 lines
802 B
SQL
19 lines
802 B
SQL
-- name: all-known-tokens
|
|
-- Looks up all known tokens from the transactions records
|
|
SELECT DISTINCT tokens.token_symbol, tokens.token_address FROM transactions
|
|
INNER JOIN tokens on transactions.token_address = tokens.token_address
|
|
WHERE transactions.sender_address = $1
|
|
OR transactions.recipient_address = $1;
|
|
|
|
-- Bidirectional cursor pagianators
|
|
-- name: list-tokens-fwd
|
|
SELECT tokens.id, tokens.token_address, tokens.token_name, tokens.token_symbol FROM tokens
|
|
WHERE tokens.id > $1 ORDER BY tokens.id ASC LIMIT $2;
|
|
|
|
-- name: list-tokens-bkwd
|
|
SELECT tokens.id, tokens.token_address, tokens.token_name, tokens.token_symbol FROM tokens
|
|
WHERE tokens.id < $1 ORDER BY tokens.id ASC LIMIT $2;
|
|
|
|
-- name: tokens-count
|
|
-- Return total record count from individual i= tables/views
|
|
SELECT COUNT(*) FROM tokens; |