id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
20,000 | decred/dcrdata | db/dcrpg/queries.go | RetrieveMissesForTicket | func RetrieveMissesForTicket(ctx context.Context, db *sql.DB, ticketHash string) (blockHashes []string, blockHeights []int64, err error) {
var rows *sql.Rows
rows, err = db.QueryContext(ctx, internal.SelectMissesForTicket, ticketHash)
if err != nil {
return nil, nil, err
}
defer closeRows(rows)
for rows.Next(... | go | func RetrieveMissesForTicket(ctx context.Context, db *sql.DB, ticketHash string) (blockHashes []string, blockHeights []int64, err error) {
var rows *sql.Rows
rows, err = db.QueryContext(ctx, internal.SelectMissesForTicket, ticketHash)
if err != nil {
return nil, nil, err
}
defer closeRows(rows)
for rows.Next(... | [
"func",
"RetrieveMissesForTicket",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"ticketHash",
"string",
")",
"(",
"blockHashes",
"[",
"]",
"string",
",",
"blockHeights",
"[",
"]",
"int64",
",",
"err",
"error",
")",
"{",
... | // RetrieveMissesForTicket gets all of the blocks in which the ticket was called
// to place a vote on the previous block. The previous block that would have
// been validated by the vote is not the block data that is returned. | [
"RetrieveMissesForTicket",
"gets",
"all",
"of",
"the",
"blocks",
"in",
"which",
"the",
"ticket",
"was",
"called",
"to",
"place",
"a",
"vote",
"on",
"the",
"previous",
"block",
".",
"The",
"previous",
"block",
"that",
"would",
"have",
"been",
"validated",
"by... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L685-L706 |
20,001 | decred/dcrdata | db/dcrpg/queries.go | RetrieveMissForTicket | func RetrieveMissForTicket(ctx context.Context, db *sql.DB, ticketHash string) (blockHash string, blockHeight int64, err error) {
err = db.QueryRowContext(ctx, internal.SelectMissesMainchainForTicket,
ticketHash).Scan(&blockHeight, &blockHash)
return
} | go | func RetrieveMissForTicket(ctx context.Context, db *sql.DB, ticketHash string) (blockHash string, blockHeight int64, err error) {
err = db.QueryRowContext(ctx, internal.SelectMissesMainchainForTicket,
ticketHash).Scan(&blockHeight, &blockHash)
return
} | [
"func",
"RetrieveMissForTicket",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"ticketHash",
"string",
")",
"(",
"blockHash",
"string",
",",
"blockHeight",
"int64",
",",
"err",
"error",
")",
"{",
"err",
"=",
"db",
".",
"... | // RetrieveMissForTicket gets the mainchain block in which the ticket was called
// to place a vote on the previous block. The previous block that would have
// been validated by the vote is not the block data that is returned. | [
"RetrieveMissForTicket",
"gets",
"the",
"mainchain",
"block",
"in",
"which",
"the",
"ticket",
"was",
"called",
"to",
"place",
"a",
"vote",
"on",
"the",
"previous",
"block",
".",
"The",
"previous",
"block",
"that",
"would",
"have",
"been",
"validated",
"by",
... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L711-L715 |
20,002 | decred/dcrdata | db/dcrpg/queries.go | retrieveAllAgendas | func retrieveAllAgendas(db *sql.DB) (map[string]dbtypes.MileStone, error) {
rows, err := db.Query(internal.SelectAllAgendas)
if err != nil {
return nil, err
}
currentMilestones := make(map[string]dbtypes.MileStone)
defer closeRows(rows)
for rows.Next() {
var name string
var m dbtypes.MileStone
err = row... | go | func retrieveAllAgendas(db *sql.DB) (map[string]dbtypes.MileStone, error) {
rows, err := db.Query(internal.SelectAllAgendas)
if err != nil {
return nil, err
}
currentMilestones := make(map[string]dbtypes.MileStone)
defer closeRows(rows)
for rows.Next() {
var name string
var m dbtypes.MileStone
err = row... | [
"func",
"retrieveAllAgendas",
"(",
"db",
"*",
"sql",
".",
"DB",
")",
"(",
"map",
"[",
"string",
"]",
"dbtypes",
".",
"MileStone",
",",
"error",
")",
"{",
"rows",
",",
"err",
":=",
"db",
".",
"Query",
"(",
"internal",
".",
"SelectAllAgendas",
")",
"\n... | // retrieveAllAgendas returns all the current agendas in the db. | [
"retrieveAllAgendas",
"returns",
"all",
"the",
"current",
"agendas",
"in",
"the",
"db",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L718-L740 |
20,003 | decred/dcrdata | db/dcrpg/queries.go | retrieveWindowBlocks | func retrieveWindowBlocks(ctx context.Context, db *sql.DB, windowSize int64, limit, offset uint64) ([]*dbtypes.BlocksGroupedInfo, error) {
rows, err := db.QueryContext(ctx, internal.SelectWindowsByLimit, windowSize, limit, offset)
if err != nil {
return nil, fmt.Errorf("retrieveWindowBlocks failed: error: %v", err)... | go | func retrieveWindowBlocks(ctx context.Context, db *sql.DB, windowSize int64, limit, offset uint64) ([]*dbtypes.BlocksGroupedInfo, error) {
rows, err := db.QueryContext(ctx, internal.SelectWindowsByLimit, windowSize, limit, offset)
if err != nil {
return nil, fmt.Errorf("retrieveWindowBlocks failed: error: %v", err)... | [
"func",
"retrieveWindowBlocks",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"windowSize",
"int64",
",",
"limit",
",",
"offset",
"uint64",
")",
"(",
"[",
"]",
"*",
"dbtypes",
".",
"BlocksGroupedInfo",
",",
"error",
")",
... | // retrieveWindowBlocks fetches chunks of windows using the limit and offset provided
// for a window size of chaincfg.Params.StakeDiffWindowSize. | [
"retrieveWindowBlocks",
"fetches",
"chunks",
"of",
"windows",
"using",
"the",
"limit",
"and",
"offset",
"provided",
"for",
"a",
"window",
"size",
"of",
"chaincfg",
".",
"Params",
".",
"StakeDiffWindowSize",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L804-L845 |
20,004 | decred/dcrdata | db/dcrpg/queries.go | retrieveTimeBasedBlockListing | func retrieveTimeBasedBlockListing(ctx context.Context, db *sql.DB, timeInterval string,
limit, offset uint64) ([]*dbtypes.BlocksGroupedInfo, error) {
rows, err := db.QueryContext(ctx, internal.SelectBlocksTimeListingByLimit, timeInterval,
limit, offset)
if err != nil {
return nil, fmt.Errorf("retrieveTimeBasedB... | go | func retrieveTimeBasedBlockListing(ctx context.Context, db *sql.DB, timeInterval string,
limit, offset uint64) ([]*dbtypes.BlocksGroupedInfo, error) {
rows, err := db.QueryContext(ctx, internal.SelectBlocksTimeListingByLimit, timeInterval,
limit, offset)
if err != nil {
return nil, fmt.Errorf("retrieveTimeBasedB... | [
"func",
"retrieveTimeBasedBlockListing",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"timeInterval",
"string",
",",
"limit",
",",
"offset",
"uint64",
")",
"(",
"[",
"]",
"*",
"dbtypes",
".",
"BlocksGroupedInfo",
",",
"erro... | // retrieveTimeBasedBlockListing fetches blocks in chunks based on their block
// time using the limit and offset provided. The time-based blocks groupings
// include but are not limited to day, week, month and year. | [
"retrieveTimeBasedBlockListing",
"fetches",
"blocks",
"in",
"chunks",
"based",
"on",
"their",
"block",
"time",
"using",
"the",
"limit",
"and",
"offset",
"provided",
".",
"The",
"time",
"-",
"based",
"blocks",
"groupings",
"include",
"but",
"are",
"not",
"limited... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L850-L888 |
20,005 | decred/dcrdata | db/dcrpg/queries.go | RetrieveUnspentTickets | func RetrieveUnspentTickets(ctx context.Context, db *sql.DB) (ids []uint64, hashes []string, err error) {
var rows *sql.Rows
rows, err = db.QueryContext(ctx, internal.SelectUnspentTickets)
if err != nil {
return ids, hashes, err
}
defer closeRows(rows)
for rows.Next() {
var id uint64
var hash string
err ... | go | func RetrieveUnspentTickets(ctx context.Context, db *sql.DB) (ids []uint64, hashes []string, err error) {
var rows *sql.Rows
rows, err = db.QueryContext(ctx, internal.SelectUnspentTickets)
if err != nil {
return ids, hashes, err
}
defer closeRows(rows)
for rows.Next() {
var id uint64
var hash string
err ... | [
"func",
"RetrieveUnspentTickets",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
")",
"(",
"ids",
"[",
"]",
"uint64",
",",
"hashes",
"[",
"]",
"string",
",",
"err",
"error",
")",
"{",
"var",
"rows",
"*",
"sql",
".",
"Rows"... | // RetrieveUnspentTickets gets all unspent tickets. | [
"RetrieveUnspentTickets",
"gets",
"all",
"unspent",
"tickets",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L891-L912 |
20,006 | decred/dcrdata | db/dcrpg/queries.go | RetrieveTicketStatusByHash | func RetrieveTicketStatusByHash(ctx context.Context, db *sql.DB, ticketHash string) (id uint64,
spendStatus dbtypes.TicketSpendType, poolStatus dbtypes.TicketPoolStatus, err error) {
err = db.QueryRowContext(ctx, internal.SelectTicketStatusByHash, ticketHash).
Scan(&id, &spendStatus, &poolStatus)
return
} | go | func RetrieveTicketStatusByHash(ctx context.Context, db *sql.DB, ticketHash string) (id uint64,
spendStatus dbtypes.TicketSpendType, poolStatus dbtypes.TicketPoolStatus, err error) {
err = db.QueryRowContext(ctx, internal.SelectTicketStatusByHash, ticketHash).
Scan(&id, &spendStatus, &poolStatus)
return
} | [
"func",
"RetrieveTicketStatusByHash",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"ticketHash",
"string",
")",
"(",
"id",
"uint64",
",",
"spendStatus",
"dbtypes",
".",
"TicketSpendType",
",",
"poolStatus",
"dbtypes",
".",
"T... | // RetrieveTicketStatusByHash gets the spend status and ticket pool status for
// the given ticket hash. | [
"RetrieveTicketStatusByHash",
"gets",
"the",
"spend",
"status",
"and",
"ticket",
"pool",
"status",
"for",
"the",
"given",
"ticket",
"hash",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L924-L929 |
20,007 | decred/dcrdata | db/dcrpg/queries.go | RetrieveTicketInfoByHash | func RetrieveTicketInfoByHash(ctx context.Context, db *sql.DB, ticketHash string) (spendStatus dbtypes.TicketSpendType,
poolStatus dbtypes.TicketPoolStatus, purchaseBlock, lotteryBlock *apitypes.TinyBlock, spendTxid string, err error) {
var dbid sql.NullInt64
var purchaseHash, spendHash string
var purchaseHeight, s... | go | func RetrieveTicketInfoByHash(ctx context.Context, db *sql.DB, ticketHash string) (spendStatus dbtypes.TicketSpendType,
poolStatus dbtypes.TicketPoolStatus, purchaseBlock, lotteryBlock *apitypes.TinyBlock, spendTxid string, err error) {
var dbid sql.NullInt64
var purchaseHash, spendHash string
var purchaseHeight, s... | [
"func",
"RetrieveTicketInfoByHash",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"ticketHash",
"string",
")",
"(",
"spendStatus",
"dbtypes",
".",
"TicketSpendType",
",",
"poolStatus",
"dbtypes",
".",
"TicketPoolStatus",
",",
"p... | // RetrieveTicketInfoByHash retrieves the ticket spend and pool statuses as well
// as the purchase and spending block info and spending txid. | [
"RetrieveTicketInfoByHash",
"retrieves",
"the",
"ticket",
"spend",
"and",
"pool",
"statuses",
"as",
"well",
"as",
"the",
"purchase",
"and",
"spending",
"block",
"info",
"and",
"spending",
"txid",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L933-L973 |
20,008 | decred/dcrdata | db/dcrpg/queries.go | SetPoolStatusForTicketsByHash | func SetPoolStatusForTicketsByHash(db *sql.DB, tickets []string,
poolStatuses []dbtypes.TicketPoolStatus) (int64, error) {
if len(tickets) == 0 {
return 0, nil
}
dbtx, err := db.Begin()
if err != nil {
return 0, fmt.Errorf(`unable to begin database transaction: %v`, err)
}
var stmt *sql.Stmt
stmt, err = db... | go | func SetPoolStatusForTicketsByHash(db *sql.DB, tickets []string,
poolStatuses []dbtypes.TicketPoolStatus) (int64, error) {
if len(tickets) == 0 {
return 0, nil
}
dbtx, err := db.Begin()
if err != nil {
return 0, fmt.Errorf(`unable to begin database transaction: %v`, err)
}
var stmt *sql.Stmt
stmt, err = db... | [
"func",
"SetPoolStatusForTicketsByHash",
"(",
"db",
"*",
"sql",
".",
"DB",
",",
"tickets",
"[",
"]",
"string",
",",
"poolStatuses",
"[",
"]",
"dbtypes",
".",
"TicketPoolStatus",
")",
"(",
"int64",
",",
"error",
")",
"{",
"if",
"len",
"(",
"tickets",
")",... | // SetPoolStatusForTicketsByHash sets the ticket pool status for the tickets
// specified by ticket purchase transaction hash. | [
"SetPoolStatusForTicketsByHash",
"sets",
"the",
"ticket",
"pool",
"status",
"for",
"the",
"tickets",
"specified",
"by",
"ticket",
"purchase",
"transaction",
"hash",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L1152-L1190 |
20,009 | decred/dcrdata | db/dcrpg/queries.go | setSpendingForTickets | func setSpendingForTickets(dbtx *sql.Tx, ticketDbIDs, spendDbIDs []uint64,
blockHeights []int64, spendTypes []dbtypes.TicketSpendType,
poolStatuses []dbtypes.TicketPoolStatus) error {
stmt, err := dbtx.Prepare(internal.SetTicketSpendingInfoForTicketDbID)
if err != nil {
return fmt.Errorf("tickets SELECT prepare f... | go | func setSpendingForTickets(dbtx *sql.Tx, ticketDbIDs, spendDbIDs []uint64,
blockHeights []int64, spendTypes []dbtypes.TicketSpendType,
poolStatuses []dbtypes.TicketPoolStatus) error {
stmt, err := dbtx.Prepare(internal.SetTicketSpendingInfoForTicketDbID)
if err != nil {
return fmt.Errorf("tickets SELECT prepare f... | [
"func",
"setSpendingForTickets",
"(",
"dbtx",
"*",
"sql",
".",
"Tx",
",",
"ticketDbIDs",
",",
"spendDbIDs",
"[",
"]",
"uint64",
",",
"blockHeights",
"[",
"]",
"int64",
",",
"spendTypes",
"[",
"]",
"dbtypes",
".",
"TicketSpendType",
",",
"poolStatuses",
"[",
... | // setSpendingForTickets is identical to SetSpendingForTickets except it takes a
// database transaction that was begun and will be committed by the caller. | [
"setSpendingForTickets",
"is",
"identical",
"to",
"SetSpendingForTickets",
"except",
"it",
"takes",
"a",
"database",
"transaction",
"that",
"was",
"begun",
"and",
"will",
"be",
"committed",
"by",
"the",
"caller",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L1234-L1257 |
20,010 | decred/dcrdata | db/dcrpg/queries.go | InsertAddressRowsDbTx | func InsertAddressRowsDbTx(dbTx *sql.Tx, dbAs []*dbtypes.AddressRow, dupCheck, updateExistingRecords bool) ([]uint64, error) {
// Prepare the addresses row insert statement.
stmt, err := dbTx.Prepare(internal.MakeAddressRowInsertStatement(dupCheck, updateExistingRecords))
if err != nil {
return nil, err
}
// In... | go | func InsertAddressRowsDbTx(dbTx *sql.Tx, dbAs []*dbtypes.AddressRow, dupCheck, updateExistingRecords bool) ([]uint64, error) {
// Prepare the addresses row insert statement.
stmt, err := dbTx.Prepare(internal.MakeAddressRowInsertStatement(dupCheck, updateExistingRecords))
if err != nil {
return nil, err
}
// In... | [
"func",
"InsertAddressRowsDbTx",
"(",
"dbTx",
"*",
"sql",
".",
"Tx",
",",
"dbAs",
"[",
"]",
"*",
"dbtypes",
".",
"AddressRow",
",",
"dupCheck",
",",
"updateExistingRecords",
"bool",
")",
"(",
"[",
"]",
"uint64",
",",
"error",
")",
"{",
"// Prepare the addr... | // InsertAddressRowsDbTx is like InsertAddressRows, except that it takes a
// sql.Tx. The caller is required to Commit or Rollback the transaction
// depending on the returned error value. | [
"InsertAddressRowsDbTx",
"is",
"like",
"InsertAddressRows",
"except",
"that",
"it",
"takes",
"a",
"sql",
".",
"Tx",
".",
"The",
"caller",
"is",
"required",
"to",
"Commit",
"or",
"Rollback",
"the",
"transaction",
"depending",
"on",
"the",
"returned",
"error",
"... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L1275-L1304 |
20,011 | decred/dcrdata | db/dcrpg/queries.go | retrieveAddressTxsCount | func retrieveAddressTxsCount(ctx context.Context, db *sql.DB, address, interval string) (count int64, err error) {
err = db.QueryRowContext(ctx, internal.MakeSelectAddressTimeGroupingCount(interval), address).Scan(&count)
return
} | go | func retrieveAddressTxsCount(ctx context.Context, db *sql.DB, address, interval string) (count int64, err error) {
err = db.QueryRowContext(ctx, internal.MakeSelectAddressTimeGroupingCount(interval), address).Scan(&count)
return
} | [
"func",
"retrieveAddressTxsCount",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"address",
",",
"interval",
"string",
")",
"(",
"count",
"int64",
",",
"err",
"error",
")",
"{",
"err",
"=",
"db",
".",
"QueryRowContext",
... | // retrieveAddressTxsCount return the number of record groups, where grouping is
// done by a specified time interval, for an address. | [
"retrieveAddressTxsCount",
"return",
"the",
"number",
"of",
"record",
"groups",
"where",
"grouping",
"is",
"done",
"by",
"a",
"specified",
"time",
"interval",
"for",
"an",
"address",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L1338-L1341 |
20,012 | decred/dcrdata | db/dcrpg/queries.go | RetrieveAddressBalance | func RetrieveAddressBalance(ctx context.Context, db *sql.DB, address string) (balance *dbtypes.AddressBalance, err error) {
// Never return nil *AddressBalance.
balance = &dbtypes.AddressBalance{Address: address}
// The sql.Tx does not have a timeout, as the individial queries will.
var dbtx *sql.Tx
dbtx, err = d... | go | func RetrieveAddressBalance(ctx context.Context, db *sql.DB, address string) (balance *dbtypes.AddressBalance, err error) {
// Never return nil *AddressBalance.
balance = &dbtypes.AddressBalance{Address: address}
// The sql.Tx does not have a timeout, as the individial queries will.
var dbtx *sql.Tx
dbtx, err = d... | [
"func",
"RetrieveAddressBalance",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"address",
"string",
")",
"(",
"balance",
"*",
"dbtypes",
".",
"AddressBalance",
",",
"err",
"error",
")",
"{",
"// Never return nil *AddressBalance... | // RetrieveAddressBalance gets the numbers of spent and unspent outpoints
// for the given address, the total amounts spent and unspent, the number of
// distinct spending transactions, and the fraction spent to and received from
// stake-related trasnsactions. | [
"RetrieveAddressBalance",
"gets",
"the",
"numbers",
"of",
"spent",
"and",
"unspent",
"outpoints",
"for",
"the",
"given",
"address",
"the",
"total",
"amounts",
"spent",
"and",
"unspent",
"the",
"number",
"of",
"distinct",
"spending",
"transactions",
"and",
"the",
... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L1347-L1419 |
20,013 | decred/dcrdata | db/dcrpg/queries.go | RetrieveAllMainchainAddressTxns | func RetrieveAllMainchainAddressTxns(ctx context.Context, db *sql.DB, address string) ([]*dbtypes.AddressRow, error) {
rows, err := db.QueryContext(ctx, internal.SelectAddressAllMainchainByAddress, address)
if err != nil {
return nil, err
}
defer closeRows(rows)
return scanAddressQueryRows(rows, creditDebitQuer... | go | func RetrieveAllMainchainAddressTxns(ctx context.Context, db *sql.DB, address string) ([]*dbtypes.AddressRow, error) {
rows, err := db.QueryContext(ctx, internal.SelectAddressAllMainchainByAddress, address)
if err != nil {
return nil, err
}
defer closeRows(rows)
return scanAddressQueryRows(rows, creditDebitQuer... | [
"func",
"RetrieveAllMainchainAddressTxns",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"address",
"string",
")",
"(",
"[",
"]",
"*",
"dbtypes",
".",
"AddressRow",
",",
"error",
")",
"{",
"rows",
",",
"err",
":=",
"db",... | // RetrieveAllMainchainAddressTxns retrieves all non-merged and valid_mainchain
// rows of the address table pertaining to the given address. | [
"RetrieveAllMainchainAddressTxns",
"retrieves",
"all",
"non",
"-",
"merged",
"and",
"valid_mainchain",
"rows",
"of",
"the",
"address",
"table",
"pertaining",
"to",
"the",
"given",
"address",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L1558-L1566 |
20,014 | decred/dcrdata | db/dcrpg/queries.go | RetrieveAllAddressMergedTxns | func RetrieveAllAddressMergedTxns(ctx context.Context, db *sql.DB, address string, onlyValidMainchain bool) ([]uint64, []*dbtypes.AddressRow, error) {
rows, err := db.QueryContext(ctx, internal.SelectAddressMergedViewAll, address)
if err != nil {
return nil, nil, err
}
defer closeRows(rows)
addr, err := scanAdd... | go | func RetrieveAllAddressMergedTxns(ctx context.Context, db *sql.DB, address string, onlyValidMainchain bool) ([]uint64, []*dbtypes.AddressRow, error) {
rows, err := db.QueryContext(ctx, internal.SelectAddressMergedViewAll, address)
if err != nil {
return nil, nil, err
}
defer closeRows(rows)
addr, err := scanAdd... | [
"func",
"RetrieveAllAddressMergedTxns",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"address",
"string",
",",
"onlyValidMainchain",
"bool",
")",
"(",
"[",
"]",
"uint64",
",",
"[",
"]",
"*",
"dbtypes",
".",
"AddressRow",
... | // RetrieveAllAddressMergedTxns retrieves all merged rows of the address table
// pertaining to the given address. Specify only valid_mainchain=true rows via
// the onlyValidMainchain argument. | [
"RetrieveAllAddressMergedTxns",
"retrieves",
"all",
"merged",
"rows",
"of",
"the",
"address",
"table",
"pertaining",
"to",
"the",
"given",
"address",
".",
"Specify",
"only",
"valid_mainchain",
"=",
"true",
"rows",
"via",
"the",
"onlyValidMainchain",
"argument",
"."
... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L1571-L1581 |
20,015 | decred/dcrdata | db/dcrpg/queries.go | RetrieveAddressMergedDebitTxns | func RetrieveAddressMergedDebitTxns(ctx context.Context, db *sql.DB, address string, N, offset int64) ([]*dbtypes.AddressRow, error) {
return retrieveAddressTxns(ctx, db, address, N, offset,
internal.SelectAddressMergedDebitView, mergedDebitQuery)
} | go | func RetrieveAddressMergedDebitTxns(ctx context.Context, db *sql.DB, address string, N, offset int64) ([]*dbtypes.AddressRow, error) {
return retrieveAddressTxns(ctx, db, address, N, offset,
internal.SelectAddressMergedDebitView, mergedDebitQuery)
} | [
"func",
"RetrieveAddressMergedDebitTxns",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"address",
"string",
",",
"N",
",",
"offset",
"int64",
")",
"(",
"[",
"]",
"*",
"dbtypes",
".",
"AddressRow",
",",
"error",
")",
"{"... | // Merged address transactions queries. | [
"Merged",
"address",
"transactions",
"queries",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L1602-L1605 |
20,016 | decred/dcrdata | db/dcrpg/queries.go | retrieveAddressTxns | func retrieveAddressTxns(ctx context.Context, db *sql.DB, address string, N, offset int64,
statement string, queryType int) ([]*dbtypes.AddressRow, error) {
rows, err := db.QueryContext(ctx, statement, address, N, offset)
if err != nil {
return nil, err
}
defer closeRows(rows)
switch queryType {
case mergedCr... | go | func retrieveAddressTxns(ctx context.Context, db *sql.DB, address string, N, offset int64,
statement string, queryType int) ([]*dbtypes.AddressRow, error) {
rows, err := db.QueryContext(ctx, statement, address, N, offset)
if err != nil {
return nil, err
}
defer closeRows(rows)
switch queryType {
case mergedCr... | [
"func",
"retrieveAddressTxns",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"address",
"string",
",",
"N",
",",
"offset",
"int64",
",",
"statement",
"string",
",",
"queryType",
"int",
")",
"(",
"[",
"]",
"*",
"dbtypes",... | // Address transaction query helpers. | [
"Address",
"transaction",
"query",
"helpers",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L1619-L1635 |
20,017 | decred/dcrdata | db/dcrpg/queries.go | retrieveAddressIoCsv | func retrieveAddressIoCsv(ctx context.Context, db *sql.DB, address string) (csvRows [][]string, err error) {
dbRows, err := db.QueryContext(ctx, internal.SelectAddressCsvView, address)
if err != nil {
return nil, err
}
defer closeRows(dbRows)
var txHash, matchingTxHash, strValidMainchain, strDirection string
v... | go | func retrieveAddressIoCsv(ctx context.Context, db *sql.DB, address string) (csvRows [][]string, err error) {
dbRows, err := db.QueryContext(ctx, internal.SelectAddressCsvView, address)
if err != nil {
return nil, err
}
defer closeRows(dbRows)
var txHash, matchingTxHash, strValidMainchain, strDirection string
v... | [
"func",
"retrieveAddressIoCsv",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"address",
"string",
")",
"(",
"csvRows",
"[",
"]",
"[",
"]",
"string",
",",
"err",
"error",
")",
"{",
"dbRows",
",",
"err",
":=",
"db",
"... | // retrieveAddressIoCsv grabs rows for an address and formats them as a 2-D
// array of strings for CSV-formatting. | [
"retrieveAddressIoCsv",
"grabs",
"rows",
"for",
"an",
"address",
"and",
"formats",
"them",
"as",
"a",
"2",
"-",
"D",
"array",
"of",
"strings",
"for",
"CSV",
"-",
"formatting",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L1639-L1687 |
20,018 | decred/dcrdata | db/dcrpg/queries.go | retrieveOldestTxBlockTime | func retrieveOldestTxBlockTime(ctx context.Context, db *sql.DB, addr string) (blockTime dbtypes.TimeDef, err error) {
err = db.QueryRowContext(ctx, internal.SelectAddressOldestTxBlockTime, addr).Scan(&blockTime)
return
} | go | func retrieveOldestTxBlockTime(ctx context.Context, db *sql.DB, addr string) (blockTime dbtypes.TimeDef, err error) {
err = db.QueryRowContext(ctx, internal.SelectAddressOldestTxBlockTime, addr).Scan(&blockTime)
return
} | [
"func",
"retrieveOldestTxBlockTime",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"addr",
"string",
")",
"(",
"blockTime",
"dbtypes",
".",
"TimeDef",
",",
"err",
"error",
")",
"{",
"err",
"=",
"db",
".",
"QueryRowContext"... | // retrieveOldestTxBlockTime helps choose the most appropriate address page
// graph grouping to load by default depending on when the first transaction to
// the specific address was made. | [
"retrieveOldestTxBlockTime",
"helps",
"choose",
"the",
"most",
"appropriate",
"address",
"page",
"graph",
"grouping",
"to",
"load",
"by",
"default",
"depending",
"on",
"when",
"the",
"first",
"transaction",
"to",
"the",
"specific",
"address",
"was",
"made",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L1803-L1806 |
20,019 | decred/dcrdata | db/dcrpg/queries.go | InsertVinsStmt | func InsertVinsStmt(stmt *sql.Stmt, dbVins dbtypes.VinTxPropertyARRAY, checked bool, doUpsert bool) ([]uint64, error) {
// TODO/Question: Should we skip inserting coinbase txns, which have same PrevTxHash?
ids := make([]uint64, 0, len(dbVins))
for _, vin := range dbVins {
var id uint64
err := stmt.QueryRow(vin.T... | go | func InsertVinsStmt(stmt *sql.Stmt, dbVins dbtypes.VinTxPropertyARRAY, checked bool, doUpsert bool) ([]uint64, error) {
// TODO/Question: Should we skip inserting coinbase txns, which have same PrevTxHash?
ids := make([]uint64, 0, len(dbVins))
for _, vin := range dbVins {
var id uint64
err := stmt.QueryRow(vin.T... | [
"func",
"InsertVinsStmt",
"(",
"stmt",
"*",
"sql",
".",
"Stmt",
",",
"dbVins",
"dbtypes",
".",
"VinTxPropertyARRAY",
",",
"checked",
"bool",
",",
"doUpsert",
"bool",
")",
"(",
"[",
"]",
"uint64",
",",
"error",
")",
"{",
"// TODO/Question: Should we skip insert... | // InsertVinsStmt is like InsertVins, except that it takes a sql.Stmt. The
// caller is required to Close the transaction. | [
"InsertVinsStmt",
"is",
"like",
"InsertVins",
"except",
"that",
"it",
"takes",
"a",
"sql",
".",
"Stmt",
".",
"The",
"caller",
"is",
"required",
"to",
"Close",
"the",
"transaction",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L1899-L1914 |
20,020 | decred/dcrdata | db/dcrpg/queries.go | InsertVinsDbTxn | func InsertVinsDbTxn(dbTx *sql.Tx, dbVins dbtypes.VinTxPropertyARRAY, checked bool, doUpsert bool) ([]uint64, error) {
stmt, err := dbTx.Prepare(internal.MakeVinInsertStatement(checked, doUpsert))
if err != nil {
return nil, err
}
// TODO/Question: Should we skip inserting coinbase txns, which have same PrevTxHa... | go | func InsertVinsDbTxn(dbTx *sql.Tx, dbVins dbtypes.VinTxPropertyARRAY, checked bool, doUpsert bool) ([]uint64, error) {
stmt, err := dbTx.Prepare(internal.MakeVinInsertStatement(checked, doUpsert))
if err != nil {
return nil, err
}
// TODO/Question: Should we skip inserting coinbase txns, which have same PrevTxHa... | [
"func",
"InsertVinsDbTxn",
"(",
"dbTx",
"*",
"sql",
".",
"Tx",
",",
"dbVins",
"dbtypes",
".",
"VinTxPropertyARRAY",
",",
"checked",
"bool",
",",
"doUpsert",
"bool",
")",
"(",
"[",
"]",
"uint64",
",",
"error",
")",
"{",
"stmt",
",",
"err",
":=",
"dbTx",... | // InsertVinsDbTxn is like InsertVins, except that it takes a sql.Tx. The caller
// is required to Commit or Rollback the transaction depending on the returned
// error value. | [
"InsertVinsDbTxn",
"is",
"like",
"InsertVins",
"except",
"that",
"it",
"takes",
"a",
"sql",
".",
"Tx",
".",
"The",
"caller",
"is",
"required",
"to",
"Commit",
"or",
"Rollback",
"the",
"transaction",
"depending",
"on",
"the",
"returned",
"error",
"value",
"."... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L1919-L1936 |
20,021 | decred/dcrdata | db/dcrpg/queries.go | InsertVins | func InsertVins(db *sql.DB, dbVins dbtypes.VinTxPropertyARRAY, checked bool, updateOnConflict ...bool) ([]uint64, error) {
dbtx, err := db.Begin()
if err != nil {
return nil, fmt.Errorf("unable to begin database transaction: %v", err)
}
doUpsert := true
if len(updateOnConflict) > 0 {
doUpsert = updateOnConfli... | go | func InsertVins(db *sql.DB, dbVins dbtypes.VinTxPropertyARRAY, checked bool, updateOnConflict ...bool) ([]uint64, error) {
dbtx, err := db.Begin()
if err != nil {
return nil, fmt.Errorf("unable to begin database transaction: %v", err)
}
doUpsert := true
if len(updateOnConflict) > 0 {
doUpsert = updateOnConfli... | [
"func",
"InsertVins",
"(",
"db",
"*",
"sql",
".",
"DB",
",",
"dbVins",
"dbtypes",
".",
"VinTxPropertyARRAY",
",",
"checked",
"bool",
",",
"updateOnConflict",
"...",
"bool",
")",
"(",
"[",
"]",
"uint64",
",",
"error",
")",
"{",
"dbtx",
",",
"err",
":=",... | // InsertVins is like InsertVin, except that it operates on a slice of vin data. | [
"InsertVins",
"is",
"like",
"InsertVin",
"except",
"that",
"it",
"operates",
"on",
"a",
"slice",
"of",
"vin",
"data",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L1939-L1957 |
20,022 | decred/dcrdata | db/dcrpg/queries.go | InsertVoutsStmt | func InsertVoutsStmt(stmt *sql.Stmt, dbVouts []*dbtypes.Vout, checked bool, doUpsert bool) ([]uint64, []dbtypes.AddressRow, error) {
addressRows := make([]dbtypes.AddressRow, 0, len(dbVouts)) // may grow with multisig
ids := make([]uint64, 0, len(dbVouts))
for _, vout := range dbVouts {
var id uint64
err := stmt... | go | func InsertVoutsStmt(stmt *sql.Stmt, dbVouts []*dbtypes.Vout, checked bool, doUpsert bool) ([]uint64, []dbtypes.AddressRow, error) {
addressRows := make([]dbtypes.AddressRow, 0, len(dbVouts)) // may grow with multisig
ids := make([]uint64, 0, len(dbVouts))
for _, vout := range dbVouts {
var id uint64
err := stmt... | [
"func",
"InsertVoutsStmt",
"(",
"stmt",
"*",
"sql",
".",
"Stmt",
",",
"dbVouts",
"[",
"]",
"*",
"dbtypes",
".",
"Vout",
",",
"checked",
"bool",
",",
"doUpsert",
"bool",
")",
"(",
"[",
"]",
"uint64",
",",
"[",
"]",
"dbtypes",
".",
"AddressRow",
",",
... | // InsertVoutsStmt is like InsertVouts, except that it takes a sql.Stmt. The
// caller is required to Close the statement. | [
"InsertVoutsStmt",
"is",
"like",
"InsertVouts",
"except",
"that",
"it",
"takes",
"a",
"sql",
".",
"Stmt",
".",
"The",
"caller",
"is",
"required",
"to",
"Close",
"the",
"statement",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L1985-L2017 |
20,023 | decred/dcrdata | db/dcrpg/queries.go | InsertVoutsDbTxn | func InsertVoutsDbTxn(dbTx *sql.Tx, dbVouts []*dbtypes.Vout, checked bool, doUpsert bool) ([]uint64, []dbtypes.AddressRow, error) {
stmt, err := dbTx.Prepare(internal.MakeVoutInsertStatement(checked, doUpsert))
if err != nil {
return nil, nil, err
}
ids, addressRows, err := InsertVoutsStmt(stmt, dbVouts, checked... | go | func InsertVoutsDbTxn(dbTx *sql.Tx, dbVouts []*dbtypes.Vout, checked bool, doUpsert bool) ([]uint64, []dbtypes.AddressRow, error) {
stmt, err := dbTx.Prepare(internal.MakeVoutInsertStatement(checked, doUpsert))
if err != nil {
return nil, nil, err
}
ids, addressRows, err := InsertVoutsStmt(stmt, dbVouts, checked... | [
"func",
"InsertVoutsDbTxn",
"(",
"dbTx",
"*",
"sql",
".",
"Tx",
",",
"dbVouts",
"[",
"]",
"*",
"dbtypes",
".",
"Vout",
",",
"checked",
"bool",
",",
"doUpsert",
"bool",
")",
"(",
"[",
"]",
"uint64",
",",
"[",
"]",
"dbtypes",
".",
"AddressRow",
",",
... | // InsertVoutsDbTxn is like InsertVouts, except that it takes a sql.Tx. The
// caller is required to Commit or Rollback the transaction depending on the
// returned error value. | [
"InsertVoutsDbTxn",
"is",
"like",
"InsertVouts",
"except",
"that",
"it",
"takes",
"a",
"sql",
".",
"Tx",
".",
"The",
"caller",
"is",
"required",
"to",
"Commit",
"or",
"Rollback",
"the",
"transaction",
"depending",
"on",
"the",
"returned",
"error",
"value",
"... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L2022-L2038 |
20,024 | decred/dcrdata | db/dcrpg/queries.go | InsertVouts | func InsertVouts(db *sql.DB, dbVouts []*dbtypes.Vout, checked bool, updateOnConflict ...bool) ([]uint64, []dbtypes.AddressRow, error) {
// All inserts in atomic DB transaction
dbTx, err := db.Begin()
if err != nil {
return nil, nil, fmt.Errorf("unable to begin database transaction: %v", err)
}
doUpsert := true
... | go | func InsertVouts(db *sql.DB, dbVouts []*dbtypes.Vout, checked bool, updateOnConflict ...bool) ([]uint64, []dbtypes.AddressRow, error) {
// All inserts in atomic DB transaction
dbTx, err := db.Begin()
if err != nil {
return nil, nil, fmt.Errorf("unable to begin database transaction: %v", err)
}
doUpsert := true
... | [
"func",
"InsertVouts",
"(",
"db",
"*",
"sql",
".",
"DB",
",",
"dbVouts",
"[",
"]",
"*",
"dbtypes",
".",
"Vout",
",",
"checked",
"bool",
",",
"updateOnConflict",
"...",
"bool",
")",
"(",
"[",
"]",
"uint64",
",",
"[",
"]",
"dbtypes",
".",
"AddressRow",... | // InsertVouts is like InsertVout, except that it operates on a slice of vout
// data. | [
"InsertVouts",
"is",
"like",
"InsertVout",
"except",
"that",
"it",
"operates",
"on",
"a",
"slice",
"of",
"vout",
"data",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L2042-L2061 |
20,025 | decred/dcrdata | db/dcrpg/queries.go | RetrieveFundingOutpointByTxIn | func RetrieveFundingOutpointByTxIn(ctx context.Context, db *sql.DB, txHash string,
vinIndex uint32) (id uint64, tx string, index uint32, tree int8, err error) {
err = db.QueryRowContext(ctx, internal.SelectFundingOutpointByTxIn, txHash, vinIndex).
Scan(&id, &tx, &index, &tree)
return
} | go | func RetrieveFundingOutpointByTxIn(ctx context.Context, db *sql.DB, txHash string,
vinIndex uint32) (id uint64, tx string, index uint32, tree int8, err error) {
err = db.QueryRowContext(ctx, internal.SelectFundingOutpointByTxIn, txHash, vinIndex).
Scan(&id, &tx, &index, &tree)
return
} | [
"func",
"RetrieveFundingOutpointByTxIn",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"txHash",
"string",
",",
"vinIndex",
"uint32",
")",
"(",
"id",
"uint64",
",",
"tx",
"string",
",",
"index",
"uint32",
",",
"tree",
"int... | // RetrieveFundingOutpointByTxIn gets the previous outpoint for a transaction
// input specified by transaction hash and input index. | [
"RetrieveFundingOutpointByTxIn",
"gets",
"the",
"previous",
"outpoint",
"for",
"a",
"transaction",
"input",
"specified",
"by",
"transaction",
"hash",
"and",
"input",
"index",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L2139-L2144 |
20,026 | decred/dcrdata | db/dcrpg/queries.go | RetrieveFundingOutpointByVinID | func RetrieveFundingOutpointByVinID(ctx context.Context, db *sql.DB, vinDbID uint64) (tx string, index uint32, tree int8, err error) {
err = db.QueryRowContext(ctx, internal.SelectFundingOutpointByVinID, vinDbID).
Scan(&tx, &index, &tree)
return
} | go | func RetrieveFundingOutpointByVinID(ctx context.Context, db *sql.DB, vinDbID uint64) (tx string, index uint32, tree int8, err error) {
err = db.QueryRowContext(ctx, internal.SelectFundingOutpointByVinID, vinDbID).
Scan(&tx, &index, &tree)
return
} | [
"func",
"RetrieveFundingOutpointByVinID",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"vinDbID",
"uint64",
")",
"(",
"tx",
"string",
",",
"index",
"uint32",
",",
"tree",
"int8",
",",
"err",
"error",
")",
"{",
"err",
"=... | // RetrieveFundingOutpointByVinID gets the previous outpoint for a transaction
// input specified by row ID in the vins table. | [
"RetrieveFundingOutpointByVinID",
"gets",
"the",
"previous",
"outpoint",
"for",
"a",
"transaction",
"input",
"specified",
"by",
"row",
"ID",
"in",
"the",
"vins",
"table",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L2148-L2152 |
20,027 | decred/dcrdata | db/dcrpg/queries.go | RetrieveFundingOutpointIndxByVinID | func RetrieveFundingOutpointIndxByVinID(ctx context.Context, db *sql.DB, vinDbID uint64) (idx uint32, err error) {
err = db.QueryRowContext(ctx, internal.SelectFundingOutpointIndxByVinID, vinDbID).Scan(&idx)
return
} | go | func RetrieveFundingOutpointIndxByVinID(ctx context.Context, db *sql.DB, vinDbID uint64) (idx uint32, err error) {
err = db.QueryRowContext(ctx, internal.SelectFundingOutpointIndxByVinID, vinDbID).Scan(&idx)
return
} | [
"func",
"RetrieveFundingOutpointIndxByVinID",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"vinDbID",
"uint64",
")",
"(",
"idx",
"uint32",
",",
"err",
"error",
")",
"{",
"err",
"=",
"db",
".",
"QueryRowContext",
"(",
"ctx... | // RetrieveFundingOutpointIndxByVinID gets the transaction output index of the
// previous outpoint for a transaction input specified by row ID in the vins
// table. | [
"RetrieveFundingOutpointIndxByVinID",
"gets",
"the",
"transaction",
"output",
"index",
"of",
"the",
"previous",
"outpoint",
"for",
"a",
"transaction",
"input",
"specified",
"by",
"row",
"ID",
"in",
"the",
"vins",
"table",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L2157-L2160 |
20,028 | decred/dcrdata | db/dcrpg/queries.go | RetrieveFundingTxByTxIn | func RetrieveFundingTxByTxIn(ctx context.Context, db *sql.DB, txHash string, vinIndex uint32) (id uint64, tx string, err error) {
err = db.QueryRowContext(ctx, internal.SelectFundingTxByTxIn, txHash, vinIndex).
Scan(&id, &tx)
return
} | go | func RetrieveFundingTxByTxIn(ctx context.Context, db *sql.DB, txHash string, vinIndex uint32) (id uint64, tx string, err error) {
err = db.QueryRowContext(ctx, internal.SelectFundingTxByTxIn, txHash, vinIndex).
Scan(&id, &tx)
return
} | [
"func",
"RetrieveFundingTxByTxIn",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"txHash",
"string",
",",
"vinIndex",
"uint32",
")",
"(",
"id",
"uint64",
",",
"tx",
"string",
",",
"err",
"error",
")",
"{",
"err",
"=",
... | // RetrieveFundingTxByTxIn gets the transaction hash of the previous outpoint
// for a transaction input specified by hash and input index. | [
"RetrieveFundingTxByTxIn",
"gets",
"the",
"transaction",
"hash",
"of",
"the",
"previous",
"outpoint",
"for",
"a",
"transaction",
"input",
"specified",
"by",
"hash",
"and",
"input",
"index",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L2164-L2168 |
20,029 | decred/dcrdata | db/dcrpg/queries.go | RetrieveFundingTxByVinDbID | func RetrieveFundingTxByVinDbID(ctx context.Context, db *sql.DB, vinDbID uint64) (tx string, err error) {
err = db.QueryRowContext(ctx, internal.SelectFundingTxByVinID, vinDbID).Scan(&tx)
return
} | go | func RetrieveFundingTxByVinDbID(ctx context.Context, db *sql.DB, vinDbID uint64) (tx string, err error) {
err = db.QueryRowContext(ctx, internal.SelectFundingTxByVinID, vinDbID).Scan(&tx)
return
} | [
"func",
"RetrieveFundingTxByVinDbID",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"vinDbID",
"uint64",
")",
"(",
"tx",
"string",
",",
"err",
"error",
")",
"{",
"err",
"=",
"db",
".",
"QueryRowContext",
"(",
"ctx",
",",... | // RetrieveFundingTxByVinDbID gets the transaction hash of the previous outpoint
// for a transaction input specified by row ID in the vins table. This function
// is used only in UpdateSpendingInfoInAllTickets, so it should not be subject
// to timeouts. | [
"RetrieveFundingTxByVinDbID",
"gets",
"the",
"transaction",
"hash",
"of",
"the",
"previous",
"outpoint",
"for",
"a",
"transaction",
"input",
"specified",
"by",
"row",
"ID",
"in",
"the",
"vins",
"table",
".",
"This",
"function",
"is",
"used",
"only",
"in",
"Upd... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L2174-L2177 |
20,030 | decred/dcrdata | db/dcrpg/queries.go | RetrieveSpendingTxByTxOut | func RetrieveSpendingTxByTxOut(ctx context.Context, db *sql.DB, txHash string,
voutIndex uint32) (id uint64, tx string, vin uint32, tree int8, err error) {
err = db.QueryRowContext(ctx, internal.SelectSpendingTxByPrevOut,
txHash, voutIndex).Scan(&id, &tx, &vin, &tree)
return
} | go | func RetrieveSpendingTxByTxOut(ctx context.Context, db *sql.DB, txHash string,
voutIndex uint32) (id uint64, tx string, vin uint32, tree int8, err error) {
err = db.QueryRowContext(ctx, internal.SelectSpendingTxByPrevOut,
txHash, voutIndex).Scan(&id, &tx, &vin, &tree)
return
} | [
"func",
"RetrieveSpendingTxByTxOut",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"txHash",
"string",
",",
"voutIndex",
"uint32",
")",
"(",
"id",
"uint64",
",",
"tx",
"string",
",",
"vin",
"uint32",
",",
"tree",
"int8",
... | // RetrieveSpendingTxByTxOut gets any spending transaction input info for a
// previous outpoint specified by funding transaction hash and vout number. This
// function is called by SpendingTransaction, an important part of the address
// page loading. | [
"RetrieveSpendingTxByTxOut",
"gets",
"any",
"spending",
"transaction",
"input",
"info",
"for",
"a",
"previous",
"outpoint",
"specified",
"by",
"funding",
"transaction",
"hash",
"and",
"vout",
"number",
".",
"This",
"function",
"is",
"called",
"by",
"SpendingTransact... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L2218-L2223 |
20,031 | decred/dcrdata | db/dcrpg/queries.go | RetrieveSpendingTxsByFundingTx | func RetrieveSpendingTxsByFundingTx(ctx context.Context, db *sql.DB, fundingTxID string) (dbIDs []uint64,
txns []string, vinInds []uint32, voutInds []uint32, err error) {
var rows *sql.Rows
rows, err = db.QueryContext(ctx, internal.SelectSpendingTxsByPrevTx, fundingTxID)
if err != nil {
return
}
defer closeRows... | go | func RetrieveSpendingTxsByFundingTx(ctx context.Context, db *sql.DB, fundingTxID string) (dbIDs []uint64,
txns []string, vinInds []uint32, voutInds []uint32, err error) {
var rows *sql.Rows
rows, err = db.QueryContext(ctx, internal.SelectSpendingTxsByPrevTx, fundingTxID)
if err != nil {
return
}
defer closeRows... | [
"func",
"RetrieveSpendingTxsByFundingTx",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"fundingTxID",
"string",
")",
"(",
"dbIDs",
"[",
"]",
"uint64",
",",
"txns",
"[",
"]",
"string",
",",
"vinInds",
"[",
"]",
"uint32",
... | // RetrieveSpendingTxsByFundingTx gets info on all spending transaction inputs
// for the given funding transaction specified by DB row ID. This function is
// called by SpendingTransactions, an important part of the transaction page
// loading, among other functions.. | [
"RetrieveSpendingTxsByFundingTx",
"gets",
"info",
"on",
"all",
"spending",
"transaction",
"inputs",
"for",
"the",
"given",
"funding",
"transaction",
"specified",
"by",
"DB",
"row",
"ID",
".",
"This",
"function",
"is",
"called",
"by",
"SpendingTransactions",
"an",
... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L2229-L2254 |
20,032 | decred/dcrdata | db/dcrpg/queries.go | RetrieveSpendingTxsByFundingTxWithBlockHeight | func RetrieveSpendingTxsByFundingTxWithBlockHeight(ctx context.Context, db *sql.DB, fundingTxID string) (aSpendByFunHash []*apitypes.SpendByFundingHash, err error) {
var rows *sql.Rows
rows, err = db.QueryContext(ctx, internal.SelectSpendingTxsByPrevTxWithBlockHeight, fundingTxID)
if err != nil {
return
}
defer ... | go | func RetrieveSpendingTxsByFundingTxWithBlockHeight(ctx context.Context, db *sql.DB, fundingTxID string) (aSpendByFunHash []*apitypes.SpendByFundingHash, err error) {
var rows *sql.Rows
rows, err = db.QueryContext(ctx, internal.SelectSpendingTxsByPrevTxWithBlockHeight, fundingTxID)
if err != nil {
return
}
defer ... | [
"func",
"RetrieveSpendingTxsByFundingTxWithBlockHeight",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"fundingTxID",
"string",
")",
"(",
"aSpendByFunHash",
"[",
"]",
"*",
"apitypes",
".",
"SpendByFundingHash",
",",
"err",
"error"... | // RetrieveSpendingTxsByFundingTxWithBlockHeight will retrieve all transactions,
// indexes and block heights funded by a specific transaction. This function is
// used by the DCR to Insight transaction converter. | [
"RetrieveSpendingTxsByFundingTxWithBlockHeight",
"will",
"retrieve",
"all",
"transactions",
"indexes",
"and",
"block",
"heights",
"funded",
"by",
"a",
"specific",
"transaction",
".",
"This",
"function",
"is",
"used",
"by",
"the",
"DCR",
"to",
"Insight",
"transaction",... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L2259-L2278 |
20,033 | decred/dcrdata | db/dcrpg/queries.go | RetrieveVinByID | func RetrieveVinByID(ctx context.Context, db *sql.DB, vinDbID uint64) (prevOutHash string, prevOutVoutInd uint32,
prevOutTree int8, txHash string, txVinInd uint32, txTree int8, valueIn int64, err error) {
var blockTime dbtypes.TimeDef
var isValid, isMainchain bool
var txType uint32
err = db.QueryRowContext(ctx, in... | go | func RetrieveVinByID(ctx context.Context, db *sql.DB, vinDbID uint64) (prevOutHash string, prevOutVoutInd uint32,
prevOutTree int8, txHash string, txVinInd uint32, txTree int8, valueIn int64, err error) {
var blockTime dbtypes.TimeDef
var isValid, isMainchain bool
var txType uint32
err = db.QueryRowContext(ctx, in... | [
"func",
"RetrieveVinByID",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"vinDbID",
"uint64",
")",
"(",
"prevOutHash",
"string",
",",
"prevOutVoutInd",
"uint32",
",",
"prevOutTree",
"int8",
",",
"txHash",
"string",
",",
"txV... | // RetrieveVinByID gets from the vins table for the provided row ID. | [
"RetrieveVinByID",
"gets",
"from",
"the",
"vins",
"table",
"for",
"the",
"provided",
"row",
"ID",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L2281-L2290 |
20,034 | decred/dcrdata | db/dcrpg/queries.go | RetrieveVinsByIDs | func RetrieveVinsByIDs(ctx context.Context, db *sql.DB, vinDbIDs []uint64) ([]dbtypes.VinTxProperty, error) {
vins := make([]dbtypes.VinTxProperty, len(vinDbIDs))
for i, id := range vinDbIDs {
vin := &vins[i]
err := db.QueryRowContext(ctx, internal.SelectAllVinInfoByID, id).Scan(&vin.TxID,
&vin.TxIndex, &vin.T... | go | func RetrieveVinsByIDs(ctx context.Context, db *sql.DB, vinDbIDs []uint64) ([]dbtypes.VinTxProperty, error) {
vins := make([]dbtypes.VinTxProperty, len(vinDbIDs))
for i, id := range vinDbIDs {
vin := &vins[i]
err := db.QueryRowContext(ctx, internal.SelectAllVinInfoByID, id).Scan(&vin.TxID,
&vin.TxIndex, &vin.T... | [
"func",
"RetrieveVinsByIDs",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"vinDbIDs",
"[",
"]",
"uint64",
")",
"(",
"[",
"]",
"dbtypes",
".",
"VinTxProperty",
",",
"error",
")",
"{",
"vins",
":=",
"make",
"(",
"[",
... | // RetrieveVinsByIDs retrieves vin details for the rows of the vins table
// specified by the provided row IDs. This function is an important part of the
// transaction page. | [
"RetrieveVinsByIDs",
"retrieves",
"vin",
"details",
"for",
"the",
"rows",
"of",
"the",
"vins",
"table",
"specified",
"by",
"the",
"provided",
"row",
"IDs",
".",
"This",
"function",
"is",
"an",
"important",
"part",
"of",
"the",
"transaction",
"page",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L2295-L2308 |
20,035 | decred/dcrdata | db/dcrpg/queries.go | RetrieveVoutsByIDs | func RetrieveVoutsByIDs(ctx context.Context, db *sql.DB, voutDbIDs []uint64) ([]dbtypes.Vout, error) {
vouts := make([]dbtypes.Vout, len(voutDbIDs))
for i, id := range voutDbIDs {
vout := &vouts[i]
var id0 uint64
var reqSigs uint32
var scriptType, addresses string
err := db.QueryRowContext(ctx, internal.Sel... | go | func RetrieveVoutsByIDs(ctx context.Context, db *sql.DB, voutDbIDs []uint64) ([]dbtypes.Vout, error) {
vouts := make([]dbtypes.Vout, len(voutDbIDs))
for i, id := range voutDbIDs {
vout := &vouts[i]
var id0 uint64
var reqSigs uint32
var scriptType, addresses string
err := db.QueryRowContext(ctx, internal.Sel... | [
"func",
"RetrieveVoutsByIDs",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"voutDbIDs",
"[",
"]",
"uint64",
")",
"(",
"[",
"]",
"dbtypes",
".",
"Vout",
",",
"error",
")",
"{",
"vouts",
":=",
"make",
"(",
"[",
"]",
... | // RetrieveVoutsByIDs retrieves vout details for the rows of the vouts table
// specified by the provided row IDs. This function is an important part of the
// transaction page. | [
"RetrieveVoutsByIDs",
"retrieves",
"vout",
"details",
"for",
"the",
"rows",
"of",
"the",
"vouts",
"table",
"specified",
"by",
"the",
"provided",
"row",
"IDs",
".",
"This",
"function",
"is",
"an",
"important",
"part",
"of",
"the",
"transaction",
"page",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L2313-L2340 |
20,036 | decred/dcrdata | db/dcrpg/queries.go | SetSpendingForVinDbIDs | func SetSpendingForVinDbIDs(db *sql.DB, vinDbIDs []uint64) ([]int64, int64, error) {
// Get funding details for vin and set them in the address table.
dbtx, err := db.Begin()
if err != nil {
return nil, 0, fmt.Errorf(`unable to begin database transaction: %v`, err)
}
var vinGetStmt *sql.Stmt
vinGetStmt, err = ... | go | func SetSpendingForVinDbIDs(db *sql.DB, vinDbIDs []uint64) ([]int64, int64, error) {
// Get funding details for vin and set them in the address table.
dbtx, err := db.Begin()
if err != nil {
return nil, 0, fmt.Errorf(`unable to begin database transaction: %v`, err)
}
var vinGetStmt *sql.Stmt
vinGetStmt, err = ... | [
"func",
"SetSpendingForVinDbIDs",
"(",
"db",
"*",
"sql",
".",
"DB",
",",
"vinDbIDs",
"[",
"]",
"uint64",
")",
"(",
"[",
"]",
"int64",
",",
"int64",
",",
"error",
")",
"{",
"// Get funding details for vin and set them in the address table.",
"dbtx",
",",
"err",
... | // SetSpendingForVinDbIDs updates rows of the addresses table with spending
// information from the rows of the vins table specified by vinDbIDs. This does
// not insert the spending transaction into the addresses table. | [
"SetSpendingForVinDbIDs",
"updates",
"rows",
"of",
"the",
"addresses",
"table",
"with",
"spending",
"information",
"from",
"the",
"rows",
"of",
"the",
"vins",
"table",
"specified",
"by",
"vinDbIDs",
".",
"This",
"does",
"not",
"insert",
"the",
"spending",
"trans... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L2386-L2443 |
20,037 | decred/dcrdata | db/dcrpg/queries.go | SetSpendingForVinDbID | func SetSpendingForVinDbID(db *sql.DB, vinDbID uint64) (int64, error) {
// Get funding details for the vin and set them in the address table.
dbtx, err := db.Begin()
if err != nil {
return 0, fmt.Errorf(`unable to begin database transaction: %v`, err)
}
// Get the funding tx outpoint from the vins table.
var p... | go | func SetSpendingForVinDbID(db *sql.DB, vinDbID uint64) (int64, error) {
// Get funding details for the vin and set them in the address table.
dbtx, err := db.Begin()
if err != nil {
return 0, fmt.Errorf(`unable to begin database transaction: %v`, err)
}
// Get the funding tx outpoint from the vins table.
var p... | [
"func",
"SetSpendingForVinDbID",
"(",
"db",
"*",
"sql",
".",
"DB",
",",
"vinDbID",
"uint64",
")",
"(",
"int64",
",",
"error",
")",
"{",
"// Get funding details for the vin and set them in the address table.",
"dbtx",
",",
"err",
":=",
"db",
".",
"Begin",
"(",
")... | // SetSpendingForVinDbID updates rows of the addresses table with spending
// information from the row of the vins table specified by vinDbID. This does
// not insert the spending transaction into the addresses table. | [
"SetSpendingForVinDbID",
"updates",
"rows",
"of",
"the",
"addresses",
"table",
"with",
"spending",
"information",
"from",
"the",
"row",
"of",
"the",
"vins",
"table",
"specified",
"by",
"vinDbID",
".",
"This",
"does",
"not",
"insert",
"the",
"spending",
"transact... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L2448-L2480 |
20,038 | decred/dcrdata | db/dcrpg/queries.go | SetSpendingForFundingOP | func SetSpendingForFundingOP(db SqlExecutor, fundingTxHash string, fundingTxVoutIndex uint32,
spendingTxHash string, _ /*spendingTxVinIndex*/ uint32) (int64, error) {
// Update the matchingTxHash for the funding tx output. matchingTxHash here
// is the hash of the funding tx.
res, err := db.Exec(internal.SetAddress... | go | func SetSpendingForFundingOP(db SqlExecutor, fundingTxHash string, fundingTxVoutIndex uint32,
spendingTxHash string, _ /*spendingTxVinIndex*/ uint32) (int64, error) {
// Update the matchingTxHash for the funding tx output. matchingTxHash here
// is the hash of the funding tx.
res, err := db.Exec(internal.SetAddress... | [
"func",
"SetSpendingForFundingOP",
"(",
"db",
"SqlExecutor",
",",
"fundingTxHash",
"string",
",",
"fundingTxVoutIndex",
"uint32",
",",
"spendingTxHash",
"string",
",",
"_",
"/*spendingTxVinIndex*/",
"uint32",
")",
"(",
"int64",
",",
"error",
")",
"{",
"// Update the... | // SetSpendingForFundingOP updates funding rows of the addresses table with the
// provided spending transaction output info. | [
"SetSpendingForFundingOP",
"updates",
"funding",
"rows",
"of",
"the",
"addresses",
"table",
"with",
"the",
"provided",
"spending",
"transaction",
"output",
"info",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L2484-L2495 |
20,039 | decred/dcrdata | db/dcrpg/queries.go | InsertSpendingAddressRow | func InsertSpendingAddressRow(db *sql.DB, fundingTxHash string,
fundingTxVoutIndex uint32, fundingTxTree int8, spendingTxHash string,
spendingTxVinIndex uint32, vinDbID uint64, utxoData *dbtypes.UTXOData,
checked, updateExisting, isValidMainchain bool,
txType int16, updateFundingRow bool, spendingTXBlockTime dbtype... | go | func InsertSpendingAddressRow(db *sql.DB, fundingTxHash string,
fundingTxVoutIndex uint32, fundingTxTree int8, spendingTxHash string,
spendingTxVinIndex uint32, vinDbID uint64, utxoData *dbtypes.UTXOData,
checked, updateExisting, isValidMainchain bool,
txType int16, updateFundingRow bool, spendingTXBlockTime dbtype... | [
"func",
"InsertSpendingAddressRow",
"(",
"db",
"*",
"sql",
".",
"DB",
",",
"fundingTxHash",
"string",
",",
"fundingTxVoutIndex",
"uint32",
",",
"fundingTxTree",
"int8",
",",
"spendingTxHash",
"string",
",",
"spendingTxVinIndex",
"uint32",
",",
"vinDbID",
"uint64",
... | // InsertSpendingAddressRow inserts a new spending tx row, and updates any
// corresponding funding tx row. | [
"InsertSpendingAddressRow",
"inserts",
"a",
"new",
"spending",
"tx",
"row",
"and",
"updates",
"any",
"corresponding",
"funding",
"tx",
"row",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L2512-L2532 |
20,040 | decred/dcrdata | db/dcrpg/queries.go | insertSpendingAddressRow | func insertSpendingAddressRow(tx *sql.Tx, fundingTxHash string, fundingTxVoutIndex uint32,
fundingTxTree int8, spendingTxHash string, spendingTxVinIndex uint32, vinDbID uint64,
utxoData *dbtypes.UTXOData, checked, updateExisting, validMainchain bool, txType int16,
updateFundingRow bool, blockT ...dbtypes.TimeDef) (i... | go | func insertSpendingAddressRow(tx *sql.Tx, fundingTxHash string, fundingTxVoutIndex uint32,
fundingTxTree int8, spendingTxHash string, spendingTxVinIndex uint32, vinDbID uint64,
utxoData *dbtypes.UTXOData, checked, updateExisting, validMainchain bool, txType int16,
updateFundingRow bool, blockT ...dbtypes.TimeDef) (i... | [
"func",
"insertSpendingAddressRow",
"(",
"tx",
"*",
"sql",
".",
"Tx",
",",
"fundingTxHash",
"string",
",",
"fundingTxVoutIndex",
"uint32",
",",
"fundingTxTree",
"int8",
",",
"spendingTxHash",
"string",
",",
"spendingTxVinIndex",
"uint32",
",",
"vinDbID",
"uint64",
... | // insertSpendingAddressRow inserts a new row in the addresses table for a new
// transaction input, and updates the spending information for the addresses
// table row corresponding to the previous outpoint. | [
"insertSpendingAddressRow",
"inserts",
"a",
"new",
"row",
"in",
"the",
"addresses",
"table",
"for",
"a",
"new",
"transaction",
"input",
"and",
"updates",
"the",
"spending",
"information",
"for",
"the",
"addresses",
"table",
"row",
"corresponding",
"to",
"the",
"... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L2537-L2602 |
20,041 | decred/dcrdata | db/dcrpg/queries.go | retrieveTotalAgendaVotesCount | func retrieveTotalAgendaVotesCount(ctx context.Context, db *sql.DB, agendaID string,
votingStartHeight, votingDoneHeight int64) (yes, abstain, no uint32, err error) {
var total uint32
err = db.QueryRowContext(ctx, internal.SelectAgendaVoteTotals, dbtypes.Yes,
dbtypes.Abstain, dbtypes.No, agendaID, votingStartHeig... | go | func retrieveTotalAgendaVotesCount(ctx context.Context, db *sql.DB, agendaID string,
votingStartHeight, votingDoneHeight int64) (yes, abstain, no uint32, err error) {
var total uint32
err = db.QueryRowContext(ctx, internal.SelectAgendaVoteTotals, dbtypes.Yes,
dbtypes.Abstain, dbtypes.No, agendaID, votingStartHeig... | [
"func",
"retrieveTotalAgendaVotesCount",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"agendaID",
"string",
",",
"votingStartHeight",
",",
"votingDoneHeight",
"int64",
")",
"(",
"yes",
",",
"abstain",
",",
"no",
"uint32",
","... | // retrieveTotalAgendaVotesCount returns the Cumulative vote choices count for
// the provided agenda id. votingDoneHeight references the height at which the
// agenda ID voting is considered complete. | [
"retrieveTotalAgendaVotesCount",
"returns",
"the",
"Cumulative",
"vote",
"choices",
"count",
"for",
"the",
"provided",
"agenda",
"id",
".",
"votingDoneHeight",
"references",
"the",
"height",
"at",
"which",
"the",
"agenda",
"ID",
"voting",
"is",
"considered",
"comple... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L2671-L2680 |
20,042 | decred/dcrdata | db/dcrpg/queries.go | RetrieveDbTxByHash | func RetrieveDbTxByHash(ctx context.Context, db *sql.DB, txHash string) (id uint64, dbTx *dbtypes.Tx, err error) {
dbTx = new(dbtypes.Tx)
vinDbIDs := dbtypes.UInt64Array(dbTx.VinDbIds)
voutDbIDs := dbtypes.UInt64Array(dbTx.VoutDbIds)
err = db.QueryRowContext(ctx, internal.SelectFullTxByHash, txHash).Scan(&id,
&db... | go | func RetrieveDbTxByHash(ctx context.Context, db *sql.DB, txHash string) (id uint64, dbTx *dbtypes.Tx, err error) {
dbTx = new(dbtypes.Tx)
vinDbIDs := dbtypes.UInt64Array(dbTx.VinDbIds)
voutDbIDs := dbtypes.UInt64Array(dbTx.VoutDbIds)
err = db.QueryRowContext(ctx, internal.SelectFullTxByHash, txHash).Scan(&id,
&db... | [
"func",
"RetrieveDbTxByHash",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"txHash",
"string",
")",
"(",
"id",
"uint64",
",",
"dbTx",
"*",
"dbtypes",
".",
"Tx",
",",
"err",
"error",
")",
"{",
"dbTx",
"=",
"new",
"("... | // RetrieveDbTxByHash retrieves a row of the transactions table corresponding to
// the given transaction hash. Transactions in valid and mainchain blocks are
// chosen first. This function is used by FillAddressTransactions, an important
// component of the addresses page. | [
"RetrieveDbTxByHash",
"retrieves",
"a",
"row",
"of",
"the",
"transactions",
"table",
"corresponding",
"to",
"the",
"given",
"transaction",
"hash",
".",
"Transactions",
"in",
"valid",
"and",
"mainchain",
"blocks",
"are",
"chosen",
"first",
".",
"This",
"function",
... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L2783-L2796 |
20,043 | decred/dcrdata | db/dcrpg/queries.go | RetrieveFullTxByHash | func RetrieveFullTxByHash(ctx context.Context, db *sql.DB, txHash string) (id uint64,
blockHash string, blockHeight int64, blockTime, timeVal dbtypes.TimeDef,
txType int16, version int32, tree int8, blockInd uint32,
lockTime, expiry int32, size uint32, spent, sent, fees int64,
numVin int32, vinDbIDs []int64, numVou... | go | func RetrieveFullTxByHash(ctx context.Context, db *sql.DB, txHash string) (id uint64,
blockHash string, blockHeight int64, blockTime, timeVal dbtypes.TimeDef,
txType int16, version int32, tree int8, blockInd uint32,
lockTime, expiry int32, size uint32, spent, sent, fees int64,
numVin int32, vinDbIDs []int64, numVou... | [
"func",
"RetrieveFullTxByHash",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"txHash",
"string",
")",
"(",
"id",
"uint64",
",",
"blockHash",
"string",
",",
"blockHeight",
"int64",
",",
"blockTime",
",",
"timeVal",
"dbtypes"... | // RetrieveFullTxByHash gets all data from the transactions table for the
// transaction specified by its hash. Transactions in valid and mainchain blocks
// are chosen first. See also RetrieveDbTxByHash. | [
"RetrieveFullTxByHash",
"gets",
"all",
"data",
"from",
"the",
"transactions",
"table",
"for",
"the",
"transaction",
"specified",
"by",
"its",
"hash",
".",
"Transactions",
"in",
"valid",
"and",
"mainchain",
"blocks",
"are",
"chosen",
"first",
".",
"See",
"also",
... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L2801-L2814 |
20,044 | decred/dcrdata | db/dcrpg/queries.go | RetrieveTxnsVinsByBlock | func RetrieveTxnsVinsByBlock(ctx context.Context, db *sql.DB, blockHash string) (vinDbIDs []dbtypes.UInt64Array,
areValid []bool, areMainchain []bool, err error) {
var rows *sql.Rows
rows, err = db.QueryContext(ctx, internal.SelectTxnsVinsByBlock, blockHash)
if err != nil {
return
}
defer closeRows(rows)
for ... | go | func RetrieveTxnsVinsByBlock(ctx context.Context, db *sql.DB, blockHash string) (vinDbIDs []dbtypes.UInt64Array,
areValid []bool, areMainchain []bool, err error) {
var rows *sql.Rows
rows, err = db.QueryContext(ctx, internal.SelectTxnsVinsByBlock, blockHash)
if err != nil {
return
}
defer closeRows(rows)
for ... | [
"func",
"RetrieveTxnsVinsByBlock",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"blockHash",
"string",
")",
"(",
"vinDbIDs",
"[",
"]",
"dbtypes",
".",
"UInt64Array",
",",
"areValid",
"[",
"]",
"bool",
",",
"areMainchain",
... | // RetrieveTxnsVinsByBlock retrieves for all the transactions in the specified
// block the vin_db_ids arrays, is_valid, and is_mainchain. This function is
// used by handleVinsTableMainchainupgrade, so it should not be subject to
// timeouts. | [
"RetrieveTxnsVinsByBlock",
"retrieves",
"for",
"all",
"the",
"transactions",
"in",
"the",
"specified",
"block",
"the",
"vin_db_ids",
"arrays",
"is_valid",
"and",
"is_mainchain",
".",
"This",
"function",
"is",
"used",
"by",
"handleVinsTableMainchainupgrade",
"so",
"it"... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L2857-L2879 |
20,045 | decred/dcrdata | db/dcrpg/queries.go | RetrieveTxnsVinsVoutsByBlock | func RetrieveTxnsVinsVoutsByBlock(ctx context.Context, db *sql.DB, blockHash string, onlyRegular bool) (vinDbIDs, voutDbIDs []dbtypes.UInt64Array,
areMainchain []bool, err error) {
stmt := internal.SelectTxnsVinsVoutsByBlock
if onlyRegular {
stmt = internal.SelectRegularTxnsVinsVoutsByBlock
}
var rows *sql.Rows... | go | func RetrieveTxnsVinsVoutsByBlock(ctx context.Context, db *sql.DB, blockHash string, onlyRegular bool) (vinDbIDs, voutDbIDs []dbtypes.UInt64Array,
areMainchain []bool, err error) {
stmt := internal.SelectTxnsVinsVoutsByBlock
if onlyRegular {
stmt = internal.SelectRegularTxnsVinsVoutsByBlock
}
var rows *sql.Rows... | [
"func",
"RetrieveTxnsVinsVoutsByBlock",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"blockHash",
"string",
",",
"onlyRegular",
"bool",
")",
"(",
"vinDbIDs",
",",
"voutDbIDs",
"[",
"]",
"dbtypes",
".",
"UInt64Array",
",",
"... | // RetrieveTxnsVinsVoutsByBlock retrieves for all the transactions in the
// specified block the vin_db_ids and vout_db_ids arrays. This function is used
// only by UpdateLastAddressesValid and other setting functions, where it should
// not be subject to a timeout. | [
"RetrieveTxnsVinsVoutsByBlock",
"retrieves",
"for",
"all",
"the",
"transactions",
"in",
"the",
"specified",
"block",
"the",
"vin_db_ids",
"and",
"vout_db_ids",
"arrays",
".",
"This",
"function",
"is",
"used",
"only",
"by",
"UpdateLastAddressesValid",
"and",
"other",
... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L2885-L2912 |
20,046 | decred/dcrdata | db/dcrpg/queries.go | RetrieveTxsByBlockHash | func RetrieveTxsByBlockHash(ctx context.Context, db *sql.DB, blockHash string) (ids []uint64, txs []string,
blockInds []uint32, trees []int8, blockTimes []dbtypes.TimeDef, err error) {
var rows *sql.Rows
rows, err = db.QueryContext(ctx, internal.SelectTxsByBlockHash, blockHash)
if err != nil {
return
}
defer cl... | go | func RetrieveTxsByBlockHash(ctx context.Context, db *sql.DB, blockHash string) (ids []uint64, txs []string,
blockInds []uint32, trees []int8, blockTimes []dbtypes.TimeDef, err error) {
var rows *sql.Rows
rows, err = db.QueryContext(ctx, internal.SelectTxsByBlockHash, blockHash)
if err != nil {
return
}
defer cl... | [
"func",
"RetrieveTxsByBlockHash",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"blockHash",
"string",
")",
"(",
"ids",
"[",
"]",
"uint64",
",",
"txs",
"[",
"]",
"string",
",",
"blockInds",
"[",
"]",
"uint32",
",",
"tr... | // RetrieveTxsByBlockHash retrieves all transactions in a given block. This is
// used by update functions, so care should be taken to not timeout in these
// cases. | [
"RetrieveTxsByBlockHash",
"retrieves",
"all",
"transactions",
"in",
"a",
"given",
"block",
".",
"This",
"is",
"used",
"by",
"update",
"functions",
"so",
"care",
"should",
"be",
"taken",
"to",
"not",
"timeout",
"in",
"these",
"cases",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L2928-L2956 |
20,047 | decred/dcrdata | db/dcrpg/queries.go | appendChartBlocks | func appendChartBlocks(charts *cache.ChartData, rows *sql.Rows) error {
defer closeRows(rows)
// In order to store chainwork values as uint64, they are represented
// as exahash (10^18) for work, and terahash/s (10^12) for hashrate.
bigExa := big.NewInt(int64(1e18))
badRows := 0
// badRow is used to log chainwor... | go | func appendChartBlocks(charts *cache.ChartData, rows *sql.Rows) error {
defer closeRows(rows)
// In order to store chainwork values as uint64, they are represented
// as exahash (10^18) for work, and terahash/s (10^12) for hashrate.
bigExa := big.NewInt(int64(1e18))
badRows := 0
// badRow is used to log chainwor... | [
"func",
"appendChartBlocks",
"(",
"charts",
"*",
"cache",
".",
"ChartData",
",",
"rows",
"*",
"sql",
".",
"Rows",
")",
"error",
"{",
"defer",
"closeRows",
"(",
"rows",
")",
"\n\n",
"// In order to store chainwork values as uint64, they are represented",
"// as exahash... | // Append the results from retrieveChartBlocks to the provided ChartData.
// This is the Appender half of a pair that make up a cache.ChartUpdater. | [
"Append",
"the",
"results",
"from",
"retrieveChartBlocks",
"to",
"the",
"provided",
"ChartData",
".",
"This",
"is",
"the",
"Appender",
"half",
"of",
"a",
"pair",
"that",
"make",
"up",
"a",
"cache",
".",
"ChartUpdater",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L3001-L3057 |
20,048 | decred/dcrdata | db/dcrpg/queries.go | appendWindowStats | func appendWindowStats(charts *cache.ChartData, rows *sql.Rows) error {
defer closeRows(rows)
windows := charts.Windows
for rows.Next() {
var timestamp time.Time
var price uint64
var difficulty float64
if err := rows.Scan(&price, ×tamp, &difficulty); err != nil {
return err
}
windows.TicketPrice ... | go | func appendWindowStats(charts *cache.ChartData, rows *sql.Rows) error {
defer closeRows(rows)
windows := charts.Windows
for rows.Next() {
var timestamp time.Time
var price uint64
var difficulty float64
if err := rows.Scan(&price, ×tamp, &difficulty); err != nil {
return err
}
windows.TicketPrice ... | [
"func",
"appendWindowStats",
"(",
"charts",
"*",
"cache",
".",
"ChartData",
",",
"rows",
"*",
"sql",
".",
"Rows",
")",
"error",
"{",
"defer",
"closeRows",
"(",
"rows",
")",
"\n",
"windows",
":=",
"charts",
".",
"Windows",
"\n",
"for",
"rows",
".",
"Nex... | // Appends the results from retrieveWindowStats to the provided ChartData.
// This is the Appender half of a pair that make up a cache.ChartUpdater. | [
"Appends",
"the",
"results",
"from",
"retrieveWindowStats",
"to",
"the",
"provided",
"ChartData",
".",
"This",
"is",
"the",
"Appender",
"half",
"of",
"a",
"pair",
"that",
"make",
"up",
"a",
"cache",
".",
"ChartUpdater",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L3076-L3092 |
20,049 | decred/dcrdata | db/dcrpg/queries.go | retrieveCoinSupply | func retrieveCoinSupply(ctx context.Context, db *sql.DB, charts *cache.ChartData) (*sql.Rows, error) {
rows, err := db.QueryContext(ctx, internal.SelectCoinSupply, charts.NewAtomsTip())
if err != nil {
return nil, err
}
return rows, nil
} | go | func retrieveCoinSupply(ctx context.Context, db *sql.DB, charts *cache.ChartData) (*sql.Rows, error) {
rows, err := db.QueryContext(ctx, internal.SelectCoinSupply, charts.NewAtomsTip())
if err != nil {
return nil, err
}
return rows, nil
} | [
"func",
"retrieveCoinSupply",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"charts",
"*",
"cache",
".",
"ChartData",
")",
"(",
"*",
"sql",
".",
"Rows",
",",
"error",
")",
"{",
"rows",
",",
"err",
":=",
"db",
".",
... | // retrieveCoinSupply fetches the coin supply data from the vins table. | [
"retrieveCoinSupply",
"fetches",
"the",
"coin",
"supply",
"data",
"from",
"the",
"vins",
"table",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L3095-L3101 |
20,050 | decred/dcrdata | db/dcrpg/queries.go | appendCoinSupply | func appendCoinSupply(charts *cache.ChartData, rows *sql.Rows) error {
defer closeRows(rows)
blocks := charts.Blocks
for rows.Next() {
var value int64
var timestamp time.Time
if err := rows.Scan(×tamp, &value); err != nil {
return err
}
blocks.NewAtoms = append(blocks.NewAtoms, uint64(value))
}
... | go | func appendCoinSupply(charts *cache.ChartData, rows *sql.Rows) error {
defer closeRows(rows)
blocks := charts.Blocks
for rows.Next() {
var value int64
var timestamp time.Time
if err := rows.Scan(×tamp, &value); err != nil {
return err
}
blocks.NewAtoms = append(blocks.NewAtoms, uint64(value))
}
... | [
"func",
"appendCoinSupply",
"(",
"charts",
"*",
"cache",
".",
"ChartData",
",",
"rows",
"*",
"sql",
".",
"Rows",
")",
"error",
"{",
"defer",
"closeRows",
"(",
"rows",
")",
"\n",
"blocks",
":=",
"charts",
".",
"Blocks",
"\n",
"for",
"rows",
".",
"Next",... | // Append the results from retrieveCoinSupply to the provided ChartData.
// This is the Appender half of a pair that make up a cache.ChartUpdater. | [
"Append",
"the",
"results",
"from",
"retrieveCoinSupply",
"to",
"the",
"provided",
"ChartData",
".",
"This",
"is",
"the",
"Appender",
"half",
"of",
"a",
"pair",
"that",
"make",
"up",
"a",
"cache",
".",
"ChartUpdater",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L3105-L3122 |
20,051 | decred/dcrdata | db/dcrpg/queries.go | retrievePowerlessTickets | func retrievePowerlessTickets(ctx context.Context, db *sql.DB) (*apitypes.PowerlessTickets, error) {
rows, err := db.QueryContext(ctx, internal.SelectTicketSpendTypeByBlock, -1)
if err != nil {
return nil, err
}
defer closeRows(rows)
unspentType := int16(dbtypes.TicketUnspent)
revokedType := int16(dbtypes.Tick... | go | func retrievePowerlessTickets(ctx context.Context, db *sql.DB) (*apitypes.PowerlessTickets, error) {
rows, err := db.QueryContext(ctx, internal.SelectTicketSpendTypeByBlock, -1)
if err != nil {
return nil, err
}
defer closeRows(rows)
unspentType := int16(dbtypes.TicketUnspent)
revokedType := int16(dbtypes.Tick... | [
"func",
"retrievePowerlessTickets",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
")",
"(",
"*",
"apitypes",
".",
"PowerlessTickets",
",",
"error",
")",
"{",
"rows",
",",
"err",
":=",
"db",
".",
"QueryContext",
"(",
"ctx",
",... | // retrievePowerlessTickets fetches missed or expired tickets sorted by
// revocation status. | [
"retrievePowerlessTickets",
"fetches",
"missed",
"or",
"expired",
"tickets",
"sorted",
"by",
"revocation",
"status",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L3126-L3160 |
20,052 | decred/dcrdata | db/dcrpg/queries.go | retrieveTxPerDay | func retrieveTxPerDay(ctx context.Context, db *sql.DB, timeArr []dbtypes.TimeDef,
txCountArr []uint64) ([]dbtypes.TimeDef, []uint64, error) {
var since time.Time
if c := len(timeArr); c > 0 {
since = timeArr[c-1].T
// delete the last entry to avoid duplicates
timeArr = timeArr[:c-1]
txCountArr = txCountArr... | go | func retrieveTxPerDay(ctx context.Context, db *sql.DB, timeArr []dbtypes.TimeDef,
txCountArr []uint64) ([]dbtypes.TimeDef, []uint64, error) {
var since time.Time
if c := len(timeArr); c > 0 {
since = timeArr[c-1].T
// delete the last entry to avoid duplicates
timeArr = timeArr[:c-1]
txCountArr = txCountArr... | [
"func",
"retrieveTxPerDay",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"timeArr",
"[",
"]",
"dbtypes",
".",
"TimeDef",
",",
"txCountArr",
"[",
"]",
"uint64",
")",
"(",
"[",
"]",
"dbtypes",
".",
"TimeDef",
",",
"[",
... | // retrieveTxPerDay fetches data for tx-per-day chart from the blocks table. | [
"retrieveTxPerDay",
"fetches",
"data",
"for",
"tx",
"-",
"per",
"-",
"day",
"chart",
"from",
"the",
"blocks",
"table",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L3163-L3193 |
20,053 | decred/dcrdata | db/dcrpg/queries.go | retrieveTicketByOutputCount | func retrieveTicketByOutputCount(ctx context.Context, db *sql.DB, interval int64,
dataType outputCountType, heightArr, soloArr, pooledArr []uint64) ([]uint64,
[]uint64, []uint64, error) {
var since uint64
if c := len(heightArr); c > 0 {
since = heightArr[c-1]
// drop the last entry to avoid duplication.
if ... | go | func retrieveTicketByOutputCount(ctx context.Context, db *sql.DB, interval int64,
dataType outputCountType, heightArr, soloArr, pooledArr []uint64) ([]uint64,
[]uint64, []uint64, error) {
var since uint64
if c := len(heightArr); c > 0 {
since = heightArr[c-1]
// drop the last entry to avoid duplication.
if ... | [
"func",
"retrieveTicketByOutputCount",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"interval",
"int64",
",",
"dataType",
"outputCountType",
",",
"heightArr",
",",
"soloArr",
",",
"pooledArr",
"[",
"]",
"uint64",
")",
"(",
... | // retrieveTicketByOutputCount fetches the data for ticket-by-outputs-windows
// chart if outputCountType outputCountByTicketPoolWindow is passed and
// ticket-by-outputs-blocks if outputCountType outputCountByAllBlocks is passed. | [
"retrieveTicketByOutputCount",
"fetches",
"the",
"data",
"for",
"ticket",
"-",
"by",
"-",
"outputs",
"-",
"windows",
"chart",
"if",
"outputCountType",
"outputCountByTicketPoolWindow",
"is",
"passed",
"and",
"ticket",
"-",
"by",
"-",
"outputs",
"-",
"blocks",
"if",... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L3198-L3250 |
20,054 | decred/dcrdata | db/dcrpg/queries.go | InsertProposalVote | func InsertProposalVote(db *sql.DB, proposalRowID uint64, ticket, choice string,
checked bool) (uint64, error) {
var id uint64
err := db.QueryRow(internal.InsertProposalVotesRow, proposalRowID, ticket, choice).Scan(&id)
return id, err
} | go | func InsertProposalVote(db *sql.DB, proposalRowID uint64, ticket, choice string,
checked bool) (uint64, error) {
var id uint64
err := db.QueryRow(internal.InsertProposalVotesRow, proposalRowID, ticket, choice).Scan(&id)
return id, err
} | [
"func",
"InsertProposalVote",
"(",
"db",
"*",
"sql",
".",
"DB",
",",
"proposalRowID",
"uint64",
",",
"ticket",
",",
"choice",
"string",
",",
"checked",
"bool",
")",
"(",
"uint64",
",",
"error",
")",
"{",
"var",
"id",
"uint64",
"\n",
"err",
":=",
"db",
... | // InsertProposalVote add the proposal votes entries to the proposal_votes table. | [
"InsertProposalVote",
"add",
"the",
"proposal",
"votes",
"entries",
"to",
"the",
"proposal_votes",
"table",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L3264-L3269 |
20,055 | decred/dcrdata | db/dcrpg/queries.go | retrieveLastCommitTime | func retrieveLastCommitTime(db *sql.DB) (timestamp time.Time, err error) {
err = db.QueryRow(internal.SelectProposalsLastCommitTime).Scan(×tamp)
return
} | go | func retrieveLastCommitTime(db *sql.DB) (timestamp time.Time, err error) {
err = db.QueryRow(internal.SelectProposalsLastCommitTime).Scan(×tamp)
return
} | [
"func",
"retrieveLastCommitTime",
"(",
"db",
"*",
"sql",
".",
"DB",
")",
"(",
"timestamp",
"time",
".",
"Time",
",",
"err",
"error",
")",
"{",
"err",
"=",
"db",
".",
"QueryRow",
"(",
"internal",
".",
"SelectProposalsLastCommitTime",
")",
".",
"Scan",
"("... | // retrieveLastCommitTime returns the last commit timestamp whole proposal votes
// data was fetched and updated in both proposals and proposal_votes table. | [
"retrieveLastCommitTime",
"returns",
"the",
"last",
"commit",
"timestamp",
"whole",
"proposal",
"votes",
"data",
"was",
"fetched",
"and",
"updated",
"in",
"both",
"proposals",
"and",
"proposal_votes",
"table",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L3273-L3276 |
20,056 | decred/dcrdata | db/dcrpg/queries.go | retrieveProposalVotesData | func retrieveProposalVotesData(ctx context.Context, db *sql.DB,
proposalToken string) (*dbtypes.ProposalChartsData, error) {
rows, err := db.QueryContext(ctx, internal.SelectProposalVotesChartData, proposalToken)
if err != nil {
return nil, err
}
defer closeRows(rows)
data := new(dbtypes.ProposalChartsData)
... | go | func retrieveProposalVotesData(ctx context.Context, db *sql.DB,
proposalToken string) (*dbtypes.ProposalChartsData, error) {
rows, err := db.QueryContext(ctx, internal.SelectProposalVotesChartData, proposalToken)
if err != nil {
return nil, err
}
defer closeRows(rows)
data := new(dbtypes.ProposalChartsData)
... | [
"func",
"retrieveProposalVotesData",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"proposalToken",
"string",
")",
"(",
"*",
"dbtypes",
".",
"ProposalChartsData",
",",
"error",
")",
"{",
"rows",
",",
"err",
":=",
"db",
"."... | // retrieveProposalVotesData returns the votes datat associated with the
// provided proposal token. | [
"retrieveProposalVotesData",
"returns",
"the",
"votes",
"datat",
"associated",
"with",
"the",
"provided",
"proposal",
"token",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L3280-L3304 |
20,057 | decred/dcrdata | db/dcrpg/queries.go | InsertBlockPrevNext | func InsertBlockPrevNext(db *sql.DB, blockDbID uint64,
hash, prev, next string) error {
rows, err := db.Query(internal.InsertBlockPrevNext, blockDbID, prev, hash, next)
if err == nil {
return rows.Close()
}
return err
} | go | func InsertBlockPrevNext(db *sql.DB, blockDbID uint64,
hash, prev, next string) error {
rows, err := db.Query(internal.InsertBlockPrevNext, blockDbID, prev, hash, next)
if err == nil {
return rows.Close()
}
return err
} | [
"func",
"InsertBlockPrevNext",
"(",
"db",
"*",
"sql",
".",
"DB",
",",
"blockDbID",
"uint64",
",",
"hash",
",",
"prev",
",",
"next",
"string",
")",
"error",
"{",
"rows",
",",
"err",
":=",
"db",
".",
"Query",
"(",
"internal",
".",
"InsertBlockPrevNext",
... | // InsertBlockPrevNext inserts a new row of the block_chain table. | [
"InsertBlockPrevNext",
"inserts",
"a",
"new",
"row",
"of",
"the",
"block_chain",
"table",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L3322-L3329 |
20,058 | decred/dcrdata | db/dcrpg/queries.go | RetrieveBlockVoteCount | func RetrieveBlockVoteCount(ctx context.Context, db *sql.DB, hash string) (numVotes int16, err error) {
err = db.QueryRowContext(ctx, internal.SelectBlockVoteCount, hash).Scan(&numVotes)
return
} | go | func RetrieveBlockVoteCount(ctx context.Context, db *sql.DB, hash string) (numVotes int16, err error) {
err = db.QueryRowContext(ctx, internal.SelectBlockVoteCount, hash).Scan(&numVotes)
return
} | [
"func",
"RetrieveBlockVoteCount",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"hash",
"string",
")",
"(",
"numVotes",
"int16",
",",
"err",
"error",
")",
"{",
"err",
"=",
"db",
".",
"QueryRowContext",
"(",
"ctx",
",",
... | // RetrieveBlockVoteCount gets the number of votes mined in a block. | [
"RetrieveBlockVoteCount",
"gets",
"the",
"number",
"of",
"votes",
"mined",
"in",
"a",
"block",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L3380-L3383 |
20,059 | decred/dcrdata | db/dcrpg/queries.go | RetrieveBlocksHashesAll | func RetrieveBlocksHashesAll(ctx context.Context, db *sql.DB) ([]string, error) {
var hashes []string
rows, err := db.QueryContext(ctx, internal.SelectBlocksHashes)
if err != nil {
return hashes, err
}
defer closeRows(rows)
for rows.Next() {
var hash string
err = rows.Scan(&hash)
if err != nil {
break... | go | func RetrieveBlocksHashesAll(ctx context.Context, db *sql.DB) ([]string, error) {
var hashes []string
rows, err := db.QueryContext(ctx, internal.SelectBlocksHashes)
if err != nil {
return hashes, err
}
defer closeRows(rows)
for rows.Next() {
var hash string
err = rows.Scan(&hash)
if err != nil {
break... | [
"func",
"RetrieveBlocksHashesAll",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"var",
"hashes",
"[",
"]",
"string",
"\n",
"rows",
",",
"err",
":=",
"db",
".",
"Query... | // RetrieveBlocksHashesAll retrieve the hash of every block in the blocks table,
// ordered by their row ID. | [
"RetrieveBlocksHashesAll",
"retrieve",
"the",
"hash",
"of",
"every",
"block",
"in",
"the",
"blocks",
"table",
"ordered",
"by",
"their",
"row",
"ID",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L3387-L3405 |
20,060 | decred/dcrdata | db/dcrpg/queries.go | RetrieveSideChainBlocks | func RetrieveSideChainBlocks(ctx context.Context, db *sql.DB) (blocks []*dbtypes.BlockStatus, err error) {
var rows *sql.Rows
rows, err = db.QueryContext(ctx, internal.SelectSideChainBlocks)
if err != nil {
return
}
defer closeRows(rows)
for rows.Next() {
var bs dbtypes.BlockStatus
err = rows.Scan(&bs.IsVa... | go | func RetrieveSideChainBlocks(ctx context.Context, db *sql.DB) (blocks []*dbtypes.BlockStatus, err error) {
var rows *sql.Rows
rows, err = db.QueryContext(ctx, internal.SelectSideChainBlocks)
if err != nil {
return
}
defer closeRows(rows)
for rows.Next() {
var bs dbtypes.BlockStatus
err = rows.Scan(&bs.IsVa... | [
"func",
"RetrieveSideChainBlocks",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
")",
"(",
"blocks",
"[",
"]",
"*",
"dbtypes",
".",
"BlockStatus",
",",
"err",
"error",
")",
"{",
"var",
"rows",
"*",
"sql",
".",
"Rows",
"\n",... | // RetrieveSideChainBlocks retrieves the block chain status for all known side
// chain blocks. | [
"RetrieveSideChainBlocks",
"retrieves",
"the",
"block",
"chain",
"status",
"for",
"all",
"known",
"side",
"chain",
"blocks",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L3417-L3435 |
20,061 | decred/dcrdata | db/dcrpg/queries.go | RetrieveBlockStatus | func RetrieveBlockStatus(ctx context.Context, db *sql.DB, hash string) (bs dbtypes.BlockStatus, err error) {
err = db.QueryRowContext(ctx, internal.SelectBlockStatus, hash).Scan(&bs.IsValid,
&bs.IsMainchain, &bs.Height, &bs.PrevHash, &bs.Hash, &bs.NextHash)
return
} | go | func RetrieveBlockStatus(ctx context.Context, db *sql.DB, hash string) (bs dbtypes.BlockStatus, err error) {
err = db.QueryRowContext(ctx, internal.SelectBlockStatus, hash).Scan(&bs.IsValid,
&bs.IsMainchain, &bs.Height, &bs.PrevHash, &bs.Hash, &bs.NextHash)
return
} | [
"func",
"RetrieveBlockStatus",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"hash",
"string",
")",
"(",
"bs",
"dbtypes",
".",
"BlockStatus",
",",
"err",
"error",
")",
"{",
"err",
"=",
"db",
".",
"QueryRowContext",
"(",
... | // RetrieveBlockStatus retrieves the block chain status for the block with the
// specified hash. | [
"RetrieveBlockStatus",
"retrieves",
"the",
"block",
"chain",
"status",
"for",
"the",
"block",
"with",
"the",
"specified",
"hash",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L3484-L3488 |
20,062 | decred/dcrdata | db/dcrpg/queries.go | RetrieveBlockFlags | func RetrieveBlockFlags(ctx context.Context, db *sql.DB, hash string) (isValid bool, isMainchain bool, err error) {
err = db.QueryRowContext(ctx, internal.SelectBlockFlags, hash).Scan(&isValid, &isMainchain)
return
} | go | func RetrieveBlockFlags(ctx context.Context, db *sql.DB, hash string) (isValid bool, isMainchain bool, err error) {
err = db.QueryRowContext(ctx, internal.SelectBlockFlags, hash).Scan(&isValid, &isMainchain)
return
} | [
"func",
"RetrieveBlockFlags",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"hash",
"string",
")",
"(",
"isValid",
"bool",
",",
"isMainchain",
"bool",
",",
"err",
"error",
")",
"{",
"err",
"=",
"db",
".",
"QueryRowContex... | // RetrieveBlockFlags retrieves the block's is_valid and is_mainchain flags. | [
"RetrieveBlockFlags",
"retrieves",
"the",
"block",
"s",
"is_valid",
"and",
"is_mainchain",
"flags",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L3491-L3494 |
20,063 | decred/dcrdata | db/dcrpg/queries.go | RetrieveBlockSummaryByTimeRange | func RetrieveBlockSummaryByTimeRange(ctx context.Context, db *sql.DB, minTime, maxTime int64, limit int) ([]dbtypes.BlockDataBasic, error) {
var blocks []dbtypes.BlockDataBasic
var stmt *sql.Stmt
var rows *sql.Rows
var err error
// int64 -> time.Time is required to query TIMESTAMPTZ columns.
minT := time.Unix(mi... | go | func RetrieveBlockSummaryByTimeRange(ctx context.Context, db *sql.DB, minTime, maxTime int64, limit int) ([]dbtypes.BlockDataBasic, error) {
var blocks []dbtypes.BlockDataBasic
var stmt *sql.Stmt
var rows *sql.Rows
var err error
// int64 -> time.Time is required to query TIMESTAMPTZ columns.
minT := time.Unix(mi... | [
"func",
"RetrieveBlockSummaryByTimeRange",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"minTime",
",",
"maxTime",
"int64",
",",
"limit",
"int",
")",
"(",
"[",
"]",
"dbtypes",
".",
"BlockDataBasic",
",",
"error",
")",
"{"... | // RetrieveBlockSummaryByTimeRange retrieves the slice of block summaries for
// the given time range. The limit specifies the number of most recent block
// summaries to return. A limit of 0 indicates all blocks in the time range
// should be included. | [
"RetrieveBlockSummaryByTimeRange",
"retrieves",
"the",
"slice",
"of",
"block",
"summaries",
"for",
"the",
"given",
"time",
"range",
".",
"The",
"limit",
"specifies",
"the",
"number",
"of",
"most",
"recent",
"block",
"summaries",
"to",
"return",
".",
"A",
"limit"... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L3500-L3546 |
20,064 | decred/dcrdata | db/dcrpg/queries.go | RetrievePreviousHashByBlockHash | func RetrievePreviousHashByBlockHash(ctx context.Context, db *sql.DB, hash string) (previousHash string, err error) {
err = db.QueryRowContext(ctx, internal.SelectBlocksPreviousHash, hash).Scan(&previousHash)
return
} | go | func RetrievePreviousHashByBlockHash(ctx context.Context, db *sql.DB, hash string) (previousHash string, err error) {
err = db.QueryRowContext(ctx, internal.SelectBlocksPreviousHash, hash).Scan(&previousHash)
return
} | [
"func",
"RetrievePreviousHashByBlockHash",
"(",
"ctx",
"context",
".",
"Context",
",",
"db",
"*",
"sql",
".",
"DB",
",",
"hash",
"string",
")",
"(",
"previousHash",
"string",
",",
"err",
"error",
")",
"{",
"err",
"=",
"db",
".",
"QueryRowContext",
"(",
"... | // RetrievePreviousHashByBlockHash retrieves the previous block hash for the
// given block from the blocks table. | [
"RetrievePreviousHashByBlockHash",
"retrieves",
"the",
"previous",
"block",
"hash",
"for",
"the",
"given",
"block",
"from",
"the",
"blocks",
"table",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L3550-L3553 |
20,065 | decred/dcrdata | db/dcrpg/queries.go | SetMainchainByBlockHash | func SetMainchainByBlockHash(db *sql.DB, hash string, isMainchain bool) (previousHash string, err error) {
err = db.QueryRow(internal.UpdateBlockMainchain, hash, isMainchain).Scan(&previousHash)
return
} | go | func SetMainchainByBlockHash(db *sql.DB, hash string, isMainchain bool) (previousHash string, err error) {
err = db.QueryRow(internal.UpdateBlockMainchain, hash, isMainchain).Scan(&previousHash)
return
} | [
"func",
"SetMainchainByBlockHash",
"(",
"db",
"*",
"sql",
".",
"DB",
",",
"hash",
"string",
",",
"isMainchain",
"bool",
")",
"(",
"previousHash",
"string",
",",
"err",
"error",
")",
"{",
"err",
"=",
"db",
".",
"QueryRow",
"(",
"internal",
".",
"UpdateBlo... | // SetMainchainByBlockHash is used to set the is_mainchain flag for the given
// block. This is required to handle a reoganization. | [
"SetMainchainByBlockHash",
"is",
"used",
"to",
"set",
"the",
"is_mainchain",
"flag",
"for",
"the",
"given",
"block",
".",
"This",
"is",
"required",
"to",
"handle",
"a",
"reoganization",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L3557-L3560 |
20,066 | decred/dcrdata | db/dcrpg/queries.go | UpdateVotesMainchain | func UpdateVotesMainchain(db *sql.DB, blockHash string, isMainchain bool) (int64, error) {
numRows, err := sqlExec(db, internal.UpdateVotesMainchainByBlock,
"failed to update votes is_mainchain: ", isMainchain, blockHash)
if err != nil {
return 0, err
}
return numRows, nil
} | go | func UpdateVotesMainchain(db *sql.DB, blockHash string, isMainchain bool) (int64, error) {
numRows, err := sqlExec(db, internal.UpdateVotesMainchainByBlock,
"failed to update votes is_mainchain: ", isMainchain, blockHash)
if err != nil {
return 0, err
}
return numRows, nil
} | [
"func",
"UpdateVotesMainchain",
"(",
"db",
"*",
"sql",
".",
"DB",
",",
"blockHash",
"string",
",",
"isMainchain",
"bool",
")",
"(",
"int64",
",",
"error",
")",
"{",
"numRows",
",",
"err",
":=",
"sqlExec",
"(",
"db",
",",
"internal",
".",
"UpdateVotesMain... | // UpdateVotesMainchain sets the is_mainchain column for the votes in the
// specified block. | [
"UpdateVotesMainchain",
"sets",
"the",
"is_mainchain",
"column",
"for",
"the",
"votes",
"in",
"the",
"specified",
"block",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L3616-L3623 |
20,067 | decred/dcrdata | db/dcrpg/queries.go | UpdateTicketsMainchain | func UpdateTicketsMainchain(db *sql.DB, blockHash string, isMainchain bool) (int64, error) {
numRows, err := sqlExec(db, internal.UpdateTicketsMainchainByBlock,
"failed to update tickets is_mainchain: ", isMainchain, blockHash)
if err != nil {
return 0, err
}
return numRows, nil
} | go | func UpdateTicketsMainchain(db *sql.DB, blockHash string, isMainchain bool) (int64, error) {
numRows, err := sqlExec(db, internal.UpdateTicketsMainchainByBlock,
"failed to update tickets is_mainchain: ", isMainchain, blockHash)
if err != nil {
return 0, err
}
return numRows, nil
} | [
"func",
"UpdateTicketsMainchain",
"(",
"db",
"*",
"sql",
".",
"DB",
",",
"blockHash",
"string",
",",
"isMainchain",
"bool",
")",
"(",
"int64",
",",
"error",
")",
"{",
"numRows",
",",
"err",
":=",
"sqlExec",
"(",
"db",
",",
"internal",
".",
"UpdateTickets... | // UpdateTicketsMainchain sets the is_mainchain column for the tickets in the
// specified block. | [
"UpdateTicketsMainchain",
"sets",
"the",
"is_mainchain",
"column",
"for",
"the",
"tickets",
"in",
"the",
"specified",
"block",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L3627-L3634 |
20,068 | decred/dcrdata | db/dcrpg/queries.go | UpdateLastBlockValid | func UpdateLastBlockValid(db *sql.DB, blockDbID uint64, isValid bool) error {
numRows, err := sqlExec(db, internal.UpdateLastBlockValid,
"failed to update last block validity: ", blockDbID, isValid)
if err != nil {
return err
}
if numRows != 1 {
return fmt.Errorf("UpdateLastBlockValid failed to update exactly... | go | func UpdateLastBlockValid(db *sql.DB, blockDbID uint64, isValid bool) error {
numRows, err := sqlExec(db, internal.UpdateLastBlockValid,
"failed to update last block validity: ", blockDbID, isValid)
if err != nil {
return err
}
if numRows != 1 {
return fmt.Errorf("UpdateLastBlockValid failed to update exactly... | [
"func",
"UpdateLastBlockValid",
"(",
"db",
"*",
"sql",
".",
"DB",
",",
"blockDbID",
"uint64",
",",
"isValid",
"bool",
")",
"error",
"{",
"numRows",
",",
"err",
":=",
"sqlExec",
"(",
"db",
",",
"internal",
".",
"UpdateLastBlockValid",
",",
"\"",
"\"",
","... | // UpdateLastBlockValid updates the is_valid column of the block specified by
// the row id for the blocks table. | [
"UpdateLastBlockValid",
"updates",
"the",
"is_valid",
"column",
"of",
"the",
"block",
"specified",
"by",
"the",
"row",
"id",
"for",
"the",
"blocks",
"table",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L3670-L3681 |
20,069 | decred/dcrdata | db/dcrpg/queries.go | UpdateLastVins | func UpdateLastVins(db *sql.DB, blockHash string, isValid, isMainchain bool) error {
// Retrieve the hash for every transaction in this block. A context with no
// deadline or cancellation function is used since this UpdateLastVins needs
// to complete to ensure DB integrity.
_, txs, _, trees, timestamps, err := Re... | go | func UpdateLastVins(db *sql.DB, blockHash string, isValid, isMainchain bool) error {
// Retrieve the hash for every transaction in this block. A context with no
// deadline or cancellation function is used since this UpdateLastVins needs
// to complete to ensure DB integrity.
_, txs, _, trees, timestamps, err := Re... | [
"func",
"UpdateLastVins",
"(",
"db",
"*",
"sql",
".",
"DB",
",",
"blockHash",
"string",
",",
"isValid",
",",
"isMainchain",
"bool",
")",
"error",
"{",
"// Retrieve the hash for every transaction in this block. A context with no",
"// deadline or cancellation function is used ... | // UpdateLastVins updates the is_valid and is_mainchain columns in the vins
// table for all of the transactions in the block specified by the given block
// hash. | [
"UpdateLastVins",
"updates",
"the",
"is_valid",
"and",
"is_mainchain",
"columns",
"in",
"the",
"vins",
"table",
"for",
"all",
"of",
"the",
"transactions",
"in",
"the",
"block",
"specified",
"by",
"the",
"given",
"block",
"hash",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L3686-L3709 |
20,070 | decred/dcrdata | db/dcrpg/queries.go | UpdateBlockNext | func UpdateBlockNext(db SqlExecutor, blockDbID uint64, next string) error {
res, err := db.Exec(internal.UpdateBlockNext, blockDbID, next)
if err != nil {
return err
}
numRows, err := res.RowsAffected()
if err != nil {
return err
}
if numRows != 1 {
return fmt.Errorf("%s (%d)", notOneRowErrMsg, numRows)
}... | go | func UpdateBlockNext(db SqlExecutor, blockDbID uint64, next string) error {
res, err := db.Exec(internal.UpdateBlockNext, blockDbID, next)
if err != nil {
return err
}
numRows, err := res.RowsAffected()
if err != nil {
return err
}
if numRows != 1 {
return fmt.Errorf("%s (%d)", notOneRowErrMsg, numRows)
}... | [
"func",
"UpdateBlockNext",
"(",
"db",
"SqlExecutor",
",",
"blockDbID",
"uint64",
",",
"next",
"string",
")",
"error",
"{",
"res",
",",
"err",
":=",
"db",
".",
"Exec",
"(",
"internal",
".",
"UpdateBlockNext",
",",
"blockDbID",
",",
"next",
")",
"\n",
"if"... | // UpdateBlockNext sets the next block's hash for the specified row of the
// block_chain table specified by DB row ID. | [
"UpdateBlockNext",
"sets",
"the",
"next",
"block",
"s",
"hash",
"for",
"the",
"specified",
"row",
"of",
"the",
"block_chain",
"table",
"specified",
"by",
"DB",
"row",
"ID",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L3739-L3752 |
20,071 | decred/dcrdata | db/dcrpg/queries.go | UpdateBlockNextByHash | func UpdateBlockNextByHash(db SqlExecutor, this, next string) error {
res, err := db.Exec(internal.UpdateBlockNextByHash, this, next)
if err != nil {
return err
}
numRows, err := res.RowsAffected()
if err != nil {
return err
}
if numRows != 1 {
return fmt.Errorf("%s (%d)", notOneRowErrMsg, numRows)
}
ret... | go | func UpdateBlockNextByHash(db SqlExecutor, this, next string) error {
res, err := db.Exec(internal.UpdateBlockNextByHash, this, next)
if err != nil {
return err
}
numRows, err := res.RowsAffected()
if err != nil {
return err
}
if numRows != 1 {
return fmt.Errorf("%s (%d)", notOneRowErrMsg, numRows)
}
ret... | [
"func",
"UpdateBlockNextByHash",
"(",
"db",
"SqlExecutor",
",",
"this",
",",
"next",
"string",
")",
"error",
"{",
"res",
",",
"err",
":=",
"db",
".",
"Exec",
"(",
"internal",
".",
"UpdateBlockNextByHash",
",",
"this",
",",
"next",
")",
"\n",
"if",
"err",... | // UpdateBlockNextByHash sets the next block's hash for the block in the
// block_chain table specified by hash. | [
"UpdateBlockNextByHash",
"sets",
"the",
"next",
"block",
"s",
"hash",
"for",
"the",
"block",
"in",
"the",
"block_chain",
"table",
"specified",
"by",
"hash",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L3756-L3769 |
20,072 | decred/dcrdata | db/dcrpg/queries.go | UpdateBlockNextByNextHash | func UpdateBlockNextByNextHash(db SqlExecutor, currentNext, newNext string) error {
res, err := db.Exec(internal.UpdateBlockNextByNextHash, currentNext, newNext)
if err != nil {
return err
}
numRows, err := res.RowsAffected()
if err != nil {
return err
}
if numRows != 1 {
return fmt.Errorf("%s (%d)", notOn... | go | func UpdateBlockNextByNextHash(db SqlExecutor, currentNext, newNext string) error {
res, err := db.Exec(internal.UpdateBlockNextByNextHash, currentNext, newNext)
if err != nil {
return err
}
numRows, err := res.RowsAffected()
if err != nil {
return err
}
if numRows != 1 {
return fmt.Errorf("%s (%d)", notOn... | [
"func",
"UpdateBlockNextByNextHash",
"(",
"db",
"SqlExecutor",
",",
"currentNext",
",",
"newNext",
"string",
")",
"error",
"{",
"res",
",",
"err",
":=",
"db",
".",
"Exec",
"(",
"internal",
".",
"UpdateBlockNextByNextHash",
",",
"currentNext",
",",
"newNext",
"... | // UpdateBlockNextByNextHash sets the next block's hash for the block in the
// block_chain table with a current next_hash specified by hash. | [
"UpdateBlockNextByNextHash",
"sets",
"the",
"next",
"block",
"s",
"hash",
"for",
"the",
"block",
"in",
"the",
"block_chain",
"table",
"with",
"a",
"current",
"next_hash",
"specified",
"by",
"hash",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/db/dcrpg/queries.go#L3773-L3786 |
20,073 | decred/dcrdata | exchanges/bot.go | copyStates | func copyStates(m map[string]*ExchangeState) map[string]*ExchangeState {
c := make(map[string]*ExchangeState)
for k, v := range m {
c[k] = v
}
return c
} | go | func copyStates(m map[string]*ExchangeState) map[string]*ExchangeState {
c := make(map[string]*ExchangeState)
for k, v := range m {
c[k] = v
}
return c
} | [
"func",
"copyStates",
"(",
"m",
"map",
"[",
"string",
"]",
"*",
"ExchangeState",
")",
"map",
"[",
"string",
"]",
"*",
"ExchangeState",
"{",
"c",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"ExchangeState",
")",
"\n",
"for",
"k",
",",
"v",
":... | // Copy an ExchangeState map. | [
"Copy",
"an",
"ExchangeState",
"map",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/exchanges/bot.go#L107-L113 |
20,074 | decred/dcrdata | exchanges/bot.go | copy | func (state ExchangeBotState) copy() *ExchangeBotState {
state.DcrBtc = copyStates(state.DcrBtc)
state.FiatIndices = copyStates(state.FiatIndices)
return &state
} | go | func (state ExchangeBotState) copy() *ExchangeBotState {
state.DcrBtc = copyStates(state.DcrBtc)
state.FiatIndices = copyStates(state.FiatIndices)
return &state
} | [
"func",
"(",
"state",
"ExchangeBotState",
")",
"copy",
"(",
")",
"*",
"ExchangeBotState",
"{",
"state",
".",
"DcrBtc",
"=",
"copyStates",
"(",
"state",
".",
"DcrBtc",
")",
"\n",
"state",
".",
"FiatIndices",
"=",
"copyStates",
"(",
"state",
".",
"FiatIndice... | // Creates a pointer to a copy of the ExchangeBotState. | [
"Creates",
"a",
"pointer",
"to",
"a",
"copy",
"of",
"the",
"ExchangeBotState",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/exchanges/bot.go#L116-L120 |
20,075 | decred/dcrdata | exchanges/bot.go | VolumeOrderedExchanges | func (state *ExchangeBotState) VolumeOrderedExchanges() []*tokenedExchange {
xcList := make([]*tokenedExchange, 0, len(state.DcrBtc))
for token, state := range state.DcrBtc {
xcList = append(xcList, &tokenedExchange{
Token: token,
State: state,
})
}
sort.Slice(xcList, func(i, j int) bool {
return xcList... | go | func (state *ExchangeBotState) VolumeOrderedExchanges() []*tokenedExchange {
xcList := make([]*tokenedExchange, 0, len(state.DcrBtc))
for token, state := range state.DcrBtc {
xcList = append(xcList, &tokenedExchange{
Token: token,
State: state,
})
}
sort.Slice(xcList, func(i, j int) bool {
return xcList... | [
"func",
"(",
"state",
"*",
"ExchangeBotState",
")",
"VolumeOrderedExchanges",
"(",
")",
"[",
"]",
"*",
"tokenedExchange",
"{",
"xcList",
":=",
"make",
"(",
"[",
"]",
"*",
"tokenedExchange",
",",
"0",
",",
"len",
"(",
"state",
".",
"DcrBtc",
")",
")",
"... | // VolumeOrderedExchanges returns a list of tokenedExchange sorted by volume,
// highest volume first. | [
"VolumeOrderedExchanges",
"returns",
"a",
"list",
"of",
"tokenedExchange",
"sorted",
"by",
"volume",
"highest",
"volume",
"first",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/exchanges/bot.go#L137-L149 |
20,076 | decred/dcrdata | exchanges/bot.go | NewUpdateChannels | func NewUpdateChannels() *UpdateChannels {
return &UpdateChannels{
Exchange: make(chan *ExchangeUpdate, 16),
Index: make(chan *IndexUpdate, 16),
Quit: make(chan struct{}),
}
} | go | func NewUpdateChannels() *UpdateChannels {
return &UpdateChannels{
Exchange: make(chan *ExchangeUpdate, 16),
Index: make(chan *IndexUpdate, 16),
Quit: make(chan struct{}),
}
} | [
"func",
"NewUpdateChannels",
"(",
")",
"*",
"UpdateChannels",
"{",
"return",
"&",
"UpdateChannels",
"{",
"Exchange",
":",
"make",
"(",
"chan",
"*",
"ExchangeUpdate",
",",
"16",
")",
",",
"Index",
":",
"make",
"(",
"chan",
"*",
"IndexUpdate",
",",
"16",
"... | // NewUpdateChannels creates a new initialized set of UpdateChannels. | [
"NewUpdateChannels",
"creates",
"a",
"new",
"initialized",
"set",
"of",
"UpdateChannels",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/exchanges/bot.go#L176-L182 |
20,077 | decred/dcrdata | exchanges/bot.go | connectMasterBot | func (bot *ExchangeBot) connectMasterBot(ctx context.Context, delay time.Duration) (dcrrates.DCRRates_SubscribeExchangesClient, error) {
if bot.masterConnection != nil {
bot.masterConnection.Close()
}
if delay > 0 {
expiration := time.NewTimer(delay)
select {
case <-expiration.C:
case <-ctx.Done():
retu... | go | func (bot *ExchangeBot) connectMasterBot(ctx context.Context, delay time.Duration) (dcrrates.DCRRates_SubscribeExchangesClient, error) {
if bot.masterConnection != nil {
bot.masterConnection.Close()
}
if delay > 0 {
expiration := time.NewTimer(delay)
select {
case <-expiration.C:
case <-ctx.Done():
retu... | [
"func",
"(",
"bot",
"*",
"ExchangeBot",
")",
"connectMasterBot",
"(",
"ctx",
"context",
".",
"Context",
",",
"delay",
"time",
".",
"Duration",
")",
"(",
"dcrrates",
".",
"DCRRates_SubscribeExchangesClient",
",",
"error",
")",
"{",
"if",
"bot",
".",
"masterCo... | // Attempt DCRRates connection after delay. | [
"Attempt",
"DCRRates",
"connection",
"after",
"delay",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/exchanges/bot.go#L462-L489 |
20,078 | decred/dcrdata | exchanges/bot.go | subscribedExchanges | func (bot *ExchangeBot) subscribedExchanges() []string {
xcList := make([]string, len(bot.Exchanges))
for token := range bot.Exchanges {
xcList = append(xcList, token)
}
return xcList
} | go | func (bot *ExchangeBot) subscribedExchanges() []string {
xcList := make([]string, len(bot.Exchanges))
for token := range bot.Exchanges {
xcList = append(xcList, token)
}
return xcList
} | [
"func",
"(",
"bot",
"*",
"ExchangeBot",
")",
"subscribedExchanges",
"(",
")",
"[",
"]",
"string",
"{",
"xcList",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"bot",
".",
"Exchanges",
")",
")",
"\n",
"for",
"token",
":=",
"range",
"bot",
... | // A list of exchanges which the ExchangeBot is monitoring. | [
"A",
"list",
"of",
"exchanges",
"which",
"the",
"ExchangeBot",
"is",
"monitoring",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/exchanges/bot.go#L492-L498 |
20,079 | decred/dcrdata | exchanges/bot.go | UpdateChannels | func (bot *ExchangeBot) UpdateChannels() *UpdateChannels {
update := make(chan *ExchangeUpdate, 16)
index := make(chan *IndexUpdate, 16)
quit := make(chan struct{})
bot.mtx.Lock()
defer bot.mtx.Unlock()
bot.updateChans = append(bot.updateChans, update)
bot.indexChans = append(bot.indexChans, index)
bot.quitChan... | go | func (bot *ExchangeBot) UpdateChannels() *UpdateChannels {
update := make(chan *ExchangeUpdate, 16)
index := make(chan *IndexUpdate, 16)
quit := make(chan struct{})
bot.mtx.Lock()
defer bot.mtx.Unlock()
bot.updateChans = append(bot.updateChans, update)
bot.indexChans = append(bot.indexChans, index)
bot.quitChan... | [
"func",
"(",
"bot",
"*",
"ExchangeBot",
")",
"UpdateChannels",
"(",
")",
"*",
"UpdateChannels",
"{",
"update",
":=",
"make",
"(",
"chan",
"*",
"ExchangeUpdate",
",",
"16",
")",
"\n",
"index",
":=",
"make",
"(",
"chan",
"*",
"IndexUpdate",
",",
"16",
")... | // UpdateChannels creates an UpdateChannels, which holds a channel to receive
// exchange updates and a channel which is closed when the start loop exits. | [
"UpdateChannels",
"creates",
"an",
"UpdateChannels",
"which",
"holds",
"a",
"channel",
"to",
"receive",
"exchange",
"updates",
"and",
"a",
"channel",
"which",
"is",
"closed",
"when",
"the",
"start",
"loop",
"exits",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/exchanges/bot.go#L502-L516 |
20,080 | decred/dcrdata | exchanges/bot.go | ConvertedState | func (bot *ExchangeBot) ConvertedState(code string) (*ExchangeBotState, error) {
bot.mtx.RLock()
defer bot.mtx.RUnlock()
fiatIndices := make(map[string]*ExchangeState)
for token, indices := range bot.indexMap {
for symbol, price := range indices {
if symbol == code {
fiatIndices[token] = &ExchangeState{Pri... | go | func (bot *ExchangeBot) ConvertedState(code string) (*ExchangeBotState, error) {
bot.mtx.RLock()
defer bot.mtx.RUnlock()
fiatIndices := make(map[string]*ExchangeState)
for token, indices := range bot.indexMap {
for symbol, price := range indices {
if symbol == code {
fiatIndices[token] = &ExchangeState{Pri... | [
"func",
"(",
"bot",
"*",
"ExchangeBot",
")",
"ConvertedState",
"(",
"code",
"string",
")",
"(",
"*",
"ExchangeBotState",
",",
"error",
")",
"{",
"bot",
".",
"mtx",
".",
"RLock",
"(",
")",
"\n",
"defer",
"bot",
".",
"mtx",
".",
"RUnlock",
"(",
")",
... | // ConvertedState returns an ExchangeBotState with a base of the provided
// currency code, if available. | [
"ConvertedState",
"returns",
"an",
"ExchangeBotState",
"with",
"a",
"base",
"of",
"the",
"provided",
"currency",
"code",
"if",
"available",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/exchanges/bot.go#L548-L576 |
20,081 | decred/dcrdata | exchanges/bot.go | StateBytes | func (bot *ExchangeBot) StateBytes() []byte {
bot.mtx.RLock()
defer bot.mtx.RUnlock()
return bot.currentStateBytes
} | go | func (bot *ExchangeBot) StateBytes() []byte {
bot.mtx.RLock()
defer bot.mtx.RUnlock()
return bot.currentStateBytes
} | [
"func",
"(",
"bot",
"*",
"ExchangeBot",
")",
"StateBytes",
"(",
")",
"[",
"]",
"byte",
"{",
"bot",
".",
"mtx",
".",
"RLock",
"(",
")",
"\n",
"defer",
"bot",
".",
"mtx",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"bot",
".",
"currentStateBytes",
"\n"... | // StateBytes is a JSON-encoded byte array of the currentState. | [
"StateBytes",
"is",
"a",
"JSON",
"-",
"encoded",
"byte",
"array",
"of",
"the",
"currentState",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/exchanges/bot.go#L579-L583 |
20,082 | decred/dcrdata | exchanges/bot.go | ConvertedStateBytes | func (bot *ExchangeBot) ConvertedStateBytes(symbol string) ([]byte, error) {
state, err := bot.ConvertedState(symbol)
if err != nil {
return nil, err
}
return bot.jsonify(state)
} | go | func (bot *ExchangeBot) ConvertedStateBytes(symbol string) ([]byte, error) {
state, err := bot.ConvertedState(symbol)
if err != nil {
return nil, err
}
return bot.jsonify(state)
} | [
"func",
"(",
"bot",
"*",
"ExchangeBot",
")",
"ConvertedStateBytes",
"(",
"symbol",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"state",
",",
"err",
":=",
"bot",
".",
"ConvertedState",
"(",
"symbol",
")",
"\n",
"if",
"err",
"!=",
"ni... | // ConvertedStateBytes gives a JSON-encoded byte array of the currentState
// with a base of the provided currency code, if available. | [
"ConvertedStateBytes",
"gives",
"a",
"JSON",
"-",
"encoded",
"byte",
"array",
"of",
"the",
"currentState",
"with",
"a",
"base",
"of",
"the",
"provided",
"currency",
"code",
"if",
"available",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/exchanges/bot.go#L594-L600 |
20,083 | decred/dcrdata | exchanges/bot.go | AvailableIndices | func (bot *ExchangeBot) AvailableIndices() []string {
bot.mtx.RLock()
defer bot.mtx.RUnlock()
var indices sort.StringSlice
add := func(index string) {
for _, symbol := range indices {
if symbol == index {
return
}
}
indices = append(indices, index)
}
for _, fiatIndices := range bot.indexMap {
fo... | go | func (bot *ExchangeBot) AvailableIndices() []string {
bot.mtx.RLock()
defer bot.mtx.RUnlock()
var indices sort.StringSlice
add := func(index string) {
for _, symbol := range indices {
if symbol == index {
return
}
}
indices = append(indices, index)
}
for _, fiatIndices := range bot.indexMap {
fo... | [
"func",
"(",
"bot",
"*",
"ExchangeBot",
")",
"AvailableIndices",
"(",
")",
"[",
"]",
"string",
"{",
"bot",
".",
"mtx",
".",
"RLock",
"(",
")",
"\n",
"defer",
"bot",
".",
"mtx",
".",
"RUnlock",
"(",
")",
"\n",
"var",
"indices",
"sort",
".",
"StringS... | // AvailableIndices creates a fresh slice of all available index currency codes. | [
"AvailableIndices",
"creates",
"a",
"fresh",
"slice",
"of",
"all",
"available",
"index",
"currency",
"codes",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/exchanges/bot.go#L603-L622 |
20,084 | decred/dcrdata | exchanges/bot.go | Indices | func (bot *ExchangeBot) Indices(token string) FiatIndices {
bot.mtx.RLock()
defer bot.mtx.RUnlock()
indices := make(FiatIndices)
for code, price := range bot.indexMap[token] {
indices[code] = price
}
return indices
} | go | func (bot *ExchangeBot) Indices(token string) FiatIndices {
bot.mtx.RLock()
defer bot.mtx.RUnlock()
indices := make(FiatIndices)
for code, price := range bot.indexMap[token] {
indices[code] = price
}
return indices
} | [
"func",
"(",
"bot",
"*",
"ExchangeBot",
")",
"Indices",
"(",
"token",
"string",
")",
"FiatIndices",
"{",
"bot",
".",
"mtx",
".",
"RLock",
"(",
")",
"\n",
"defer",
"bot",
".",
"mtx",
".",
"RUnlock",
"(",
")",
"\n",
"indices",
":=",
"make",
"(",
"Fia... | // Indices is the fiat indices for a given BTC index exchange. | [
"Indices",
"is",
"the",
"fiat",
"indices",
"for",
"a",
"given",
"BTC",
"index",
"exchange",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/exchanges/bot.go#L625-L633 |
20,085 | decred/dcrdata | exchanges/bot.go | processState | func (bot *ExchangeBot) processState(states map[string]*ExchangeState, volumeAveraged bool) (float64, float64) {
var priceAccumulator, volSum float64
var deletions []string
oldestValid := time.Now().Add(-bot.RequestExpiry)
for token, state := range states {
if bot.Exchanges[token].LastUpdate().Before(oldestValid)... | go | func (bot *ExchangeBot) processState(states map[string]*ExchangeState, volumeAveraged bool) (float64, float64) {
var priceAccumulator, volSum float64
var deletions []string
oldestValid := time.Now().Add(-bot.RequestExpiry)
for token, state := range states {
if bot.Exchanges[token].LastUpdate().Before(oldestValid)... | [
"func",
"(",
"bot",
"*",
"ExchangeBot",
")",
"processState",
"(",
"states",
"map",
"[",
"string",
"]",
"*",
"ExchangeState",
",",
"volumeAveraged",
"bool",
")",
"(",
"float64",
",",
"float64",
")",
"{",
"var",
"priceAccumulator",
",",
"volSum",
"float64",
... | // processState is a helper function to process a slice of ExchangeState into
// a price, and optionally a volume sum, and perform some cleanup along the way.
// If volumeAveraged is false, all exchanges are given equal weight in the avg. | [
"processState",
"is",
"a",
"helper",
"function",
"to",
"process",
"a",
"slice",
"of",
"ExchangeState",
"into",
"a",
"price",
"and",
"optionally",
"a",
"volume",
"sum",
"and",
"perform",
"some",
"cleanup",
"along",
"the",
"way",
".",
"If",
"volumeAveraged",
"... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/exchanges/bot.go#L655-L678 |
20,086 | decred/dcrdata | exchanges/bot.go | updateExchange | func (bot *ExchangeBot) updateExchange(update *ExchangeUpdate) error {
bot.mtx.Lock()
defer bot.mtx.Unlock()
if update.State.Candlesticks != nil {
for bin := range update.State.Candlesticks {
bot.incrementChart(genCacheID(update.Token, string(bin)))
}
}
if update.State.Depth != nil {
bot.incrementChart(ge... | go | func (bot *ExchangeBot) updateExchange(update *ExchangeUpdate) error {
bot.mtx.Lock()
defer bot.mtx.Unlock()
if update.State.Candlesticks != nil {
for bin := range update.State.Candlesticks {
bot.incrementChart(genCacheID(update.Token, string(bin)))
}
}
if update.State.Depth != nil {
bot.incrementChart(ge... | [
"func",
"(",
"bot",
"*",
"ExchangeBot",
")",
"updateExchange",
"(",
"update",
"*",
"ExchangeUpdate",
")",
"error",
"{",
"bot",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"bot",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n",
"if",
"update",
".",
... | // updateExchange processes an update from a Decred-BTC Exchange. | [
"updateExchange",
"processes",
"an",
"update",
"from",
"a",
"Decred",
"-",
"BTC",
"Exchange",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/exchanges/bot.go#L681-L694 |
20,087 | decred/dcrdata | exchanges/bot.go | updateIndices | func (bot *ExchangeBot) updateIndices(update *IndexUpdate) error {
bot.mtx.Lock()
defer bot.mtx.Unlock()
bot.indexMap[update.Token] = update.Indices
price, hasCode := update.Indices[bot.config.BtcIndex]
if hasCode {
bot.currentState.FiatIndices[update.Token] = &ExchangeState{
Price: price,
Stamp: time.Now(... | go | func (bot *ExchangeBot) updateIndices(update *IndexUpdate) error {
bot.mtx.Lock()
defer bot.mtx.Unlock()
bot.indexMap[update.Token] = update.Indices
price, hasCode := update.Indices[bot.config.BtcIndex]
if hasCode {
bot.currentState.FiatIndices[update.Token] = &ExchangeState{
Price: price,
Stamp: time.Now(... | [
"func",
"(",
"bot",
"*",
"ExchangeBot",
")",
"updateIndices",
"(",
"update",
"*",
"IndexUpdate",
")",
"error",
"{",
"bot",
".",
"mtx",
".",
"Lock",
"(",
")",
"\n",
"defer",
"bot",
".",
"mtx",
".",
"Unlock",
"(",
")",
"\n",
"bot",
".",
"indexMap",
"... | // updateIndices processes an update from an Bitcoin index source, essentially
// a map pairing currency codes to bitcoin prices. | [
"updateIndices",
"processes",
"an",
"update",
"from",
"an",
"Bitcoin",
"index",
"source",
"essentially",
"a",
"map",
"pairing",
"currency",
"codes",
"to",
"bitcoin",
"prices",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/exchanges/bot.go#L698-L712 |
20,088 | decred/dcrdata | exchanges/bot.go | nextTick | func (bot *ExchangeBot) nextTick() *time.Timer {
tNow := time.Now()
tOldest := tNow
for _, xc := range bot.Exchanges {
t := xc.LastTry()
if t.Before(tOldest) {
tOldest = t
}
}
tSince := tNow.Sub(tOldest)
tilNext := bot.DataExpiry - tSince
if tilNext < bot.minTick {
tilNext = bot.minTick
}
return tim... | go | func (bot *ExchangeBot) nextTick() *time.Timer {
tNow := time.Now()
tOldest := tNow
for _, xc := range bot.Exchanges {
t := xc.LastTry()
if t.Before(tOldest) {
tOldest = t
}
}
tSince := tNow.Sub(tOldest)
tilNext := bot.DataExpiry - tSince
if tilNext < bot.minTick {
tilNext = bot.minTick
}
return tim... | [
"func",
"(",
"bot",
"*",
"ExchangeBot",
")",
"nextTick",
"(",
")",
"*",
"time",
".",
"Timer",
"{",
"tNow",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"tOldest",
":=",
"tNow",
"\n",
"for",
"_",
",",
"xc",
":=",
"range",
"bot",
".",
"Exchanges",
"{"... | // nextTick checks the exchanges' last update and fail times, and calculates
// when the next Cycle should run. | [
"nextTick",
"checks",
"the",
"exchanges",
"last",
"update",
"and",
"fail",
"times",
"and",
"calculates",
"when",
"the",
"next",
"Cycle",
"should",
"run",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/exchanges/bot.go#L756-L771 |
20,089 | decred/dcrdata | exchanges/bot.go | Cycle | func (bot *ExchangeBot) Cycle() {
tNow := time.Now()
for _, xc := range bot.Exchanges {
if tNow.Sub(xc.LastTry()) > bot.DataExpiry {
go xc.Refresh()
}
}
} | go | func (bot *ExchangeBot) Cycle() {
tNow := time.Now()
for _, xc := range bot.Exchanges {
if tNow.Sub(xc.LastTry()) > bot.DataExpiry {
go xc.Refresh()
}
}
} | [
"func",
"(",
"bot",
"*",
"ExchangeBot",
")",
"Cycle",
"(",
")",
"{",
"tNow",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"for",
"_",
",",
"xc",
":=",
"range",
"bot",
".",
"Exchanges",
"{",
"if",
"tNow",
".",
"Sub",
"(",
"xc",
".",
"LastTry",
"(",... | // Cycle refreshes all expired exchanges. | [
"Cycle",
"refreshes",
"all",
"expired",
"exchanges",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/exchanges/bot.go#L774-L781 |
20,090 | decred/dcrdata | exchanges/bot.go | TwoDecimals | func (c *Conversion) TwoDecimals() string {
if c.Value == 0.0 {
return "0.00"
} else if c.Value < 1.0 && c.Value > -1.0 {
return fmt.Sprintf("%3g", c.Value)
}
return fmt.Sprintf("%.2f", c.Value)
} | go | func (c *Conversion) TwoDecimals() string {
if c.Value == 0.0 {
return "0.00"
} else if c.Value < 1.0 && c.Value > -1.0 {
return fmt.Sprintf("%3g", c.Value)
}
return fmt.Sprintf("%.2f", c.Value)
} | [
"func",
"(",
"c",
"*",
"Conversion",
")",
"TwoDecimals",
"(",
")",
"string",
"{",
"if",
"c",
".",
"Value",
"==",
"0.0",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"else",
"if",
"c",
".",
"Value",
"<",
"1.0",
"&&",
"c",
".",
"Value",
">",
"-",
"1.0",... | // TwoDecimals is a string representation of the value with two digits after
// the decimal point, but will show more to achieve at least three significant
// digits. | [
"TwoDecimals",
"is",
"a",
"string",
"representation",
"of",
"the",
"value",
"with",
"two",
"digits",
"after",
"the",
"decimal",
"point",
"but",
"will",
"show",
"more",
"to",
"achieve",
"at",
"least",
"three",
"significant",
"digits",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/exchanges/bot.go#L799-L806 |
20,091 | decred/dcrdata | exchanges/bot.go | Conversion | func (bot *ExchangeBot) Conversion(dcrVal float64) *Conversion {
if bot == nil {
return nil
}
xcState := bot.State()
if xcState != nil {
return &Conversion{
Value: xcState.Price * dcrVal,
Index: xcState.BtcIndex,
}
}
return nil
} | go | func (bot *ExchangeBot) Conversion(dcrVal float64) *Conversion {
if bot == nil {
return nil
}
xcState := bot.State()
if xcState != nil {
return &Conversion{
Value: xcState.Price * dcrVal,
Index: xcState.BtcIndex,
}
}
return nil
} | [
"func",
"(",
"bot",
"*",
"ExchangeBot",
")",
"Conversion",
"(",
"dcrVal",
"float64",
")",
"*",
"Conversion",
"{",
"if",
"bot",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"xcState",
":=",
"bot",
".",
"State",
"(",
")",
"\n",
"if",
"xcState",
... | // Conversion attempts to multiply the supplied float with the default index.
// Nil pointer will be returned if there is no valid exchangeState. | [
"Conversion",
"attempts",
"to",
"multiply",
"the",
"supplied",
"float",
"with",
"the",
"default",
"index",
".",
"Nil",
"pointer",
"will",
"be",
"returned",
"if",
"there",
"is",
"no",
"valid",
"exchangeState",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/exchanges/bot.go#L810-L822 |
20,092 | decred/dcrdata | exchanges/bot.go | QuickSticks | func (bot *ExchangeBot) QuickSticks(token string, rawBin string) ([]byte, error) {
chartID := genCacheID(token, rawBin)
bin := candlestickKey(rawBin)
data, bestVersion, isGood := bot.fetchFromCache(chartID)
if isGood {
return data, nil
}
// No hit on cache. Re-encode.
bot.mtx.Lock()
defer bot.mtx.Unlock()
... | go | func (bot *ExchangeBot) QuickSticks(token string, rawBin string) ([]byte, error) {
chartID := genCacheID(token, rawBin)
bin := candlestickKey(rawBin)
data, bestVersion, isGood := bot.fetchFromCache(chartID)
if isGood {
return data, nil
}
// No hit on cache. Re-encode.
bot.mtx.Lock()
defer bot.mtx.Unlock()
... | [
"func",
"(",
"bot",
"*",
"ExchangeBot",
")",
"QuickSticks",
"(",
"token",
"string",
",",
"rawBin",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"chartID",
":=",
"genCacheID",
"(",
"token",
",",
"rawBin",
")",
"\n",
"bin",
":=",
"cand... | // QuickSticks returns the up-to-date candlestick data for the specified
// exchange and bin width, pulling from the cache if appropriate. | [
"QuickSticks",
"returns",
"the",
"up",
"-",
"to",
"-",
"date",
"candlestick",
"data",
"for",
"the",
"specified",
"exchange",
"and",
"bin",
"width",
"pulling",
"from",
"the",
"cache",
"if",
"appropriate",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/exchanges/bot.go#L841-L890 |
20,093 | decred/dcrdata | exchanges/bot.go | QuickDepth | func (bot *ExchangeBot) QuickDepth(token string) ([]byte, error) {
chartID := genCacheID(token, "depth")
data, bestVersion, isGood := bot.fetchFromCache(chartID)
if isGood {
return data, nil
}
// No hit on cache. Re-encode.
bot.mtx.Lock()
defer bot.mtx.Unlock()
state, found := bot.currentState.DcrBtc[token]... | go | func (bot *ExchangeBot) QuickDepth(token string) ([]byte, error) {
chartID := genCacheID(token, "depth")
data, bestVersion, isGood := bot.fetchFromCache(chartID)
if isGood {
return data, nil
}
// No hit on cache. Re-encode.
bot.mtx.Lock()
defer bot.mtx.Unlock()
state, found := bot.currentState.DcrBtc[token]... | [
"func",
"(",
"bot",
"*",
"ExchangeBot",
")",
"QuickDepth",
"(",
"token",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"chartID",
":=",
"genCacheID",
"(",
"token",
",",
"\"",
"\"",
")",
"\n",
"data",
",",
"bestVersion",
",",
"isGood",... | // QuickDepth returns the up-to-date depth chart data for the specified
// exchange, pulling from the cache if appropriate. | [
"QuickDepth",
"returns",
"the",
"up",
"-",
"to",
"-",
"date",
"depth",
"chart",
"data",
"for",
"the",
"specified",
"exchange",
"pulling",
"from",
"the",
"cache",
"if",
"appropriate",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/exchanges/bot.go#L894-L931 |
20,094 | decred/dcrdata | middleware/apimiddleware.go | writeHTMLBadRequest | func writeHTMLBadRequest(w http.ResponseWriter, str string) {
w.Header().Set("Content-Type", "text/html; charset=utf-8")
w.WriteHeader(http.StatusBadRequest)
io.WriteString(w, str)
} | go | func writeHTMLBadRequest(w http.ResponseWriter, str string) {
w.Header().Set("Content-Type", "text/html; charset=utf-8")
w.WriteHeader(http.StatusBadRequest)
io.WriteString(w, str)
} | [
"func",
"writeHTMLBadRequest",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"str",
"string",
")",
"{",
"w",
".",
"Header",
"(",
")",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"w",
".",
"WriteHeader",
"(",
"http",
".",
"StatusBadReques... | // writeHTMLBadRequest is used for the Insight API error response for a BAD REQUEST.
// This means the request was malformed in some way or the request HASH,
// ADDRESS, BLOCK was not valid. | [
"writeHTMLBadRequest",
"is",
"used",
"for",
"the",
"Insight",
"API",
"error",
"response",
"for",
"a",
"BAD",
"REQUEST",
".",
"This",
"means",
"the",
"request",
"was",
"malformed",
"in",
"some",
"way",
"or",
"the",
"request",
"HASH",
"ADDRESS",
"BLOCK",
"was"... | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/middleware/apimiddleware.go#L70-L74 |
20,095 | decred/dcrdata | middleware/apimiddleware.go | GetBlockStepCtx | func GetBlockStepCtx(r *http.Request) int {
step, ok := r.Context().Value(ctxBlockStep).(int)
if !ok {
apiLog.Error("block step is not set or is not an int")
return -1
}
return step
} | go | func GetBlockStepCtx(r *http.Request) int {
step, ok := r.Context().Value(ctxBlockStep).(int)
if !ok {
apiLog.Error("block step is not set or is not an int")
return -1
}
return step
} | [
"func",
"GetBlockStepCtx",
"(",
"r",
"*",
"http",
".",
"Request",
")",
"int",
"{",
"step",
",",
"ok",
":=",
"r",
".",
"Context",
"(",
")",
".",
"Value",
"(",
"ctxBlockStep",
")",
".",
"(",
"int",
")",
"\n",
"if",
"!",
"ok",
"{",
"apiLog",
".",
... | // GetBlockStepCtx retrieves the ctxBlockStep data from the request context. If
// not set, the return value is -1. | [
"GetBlockStepCtx",
"retrieves",
"the",
"ctxBlockStep",
"data",
"from",
"the",
"request",
"context",
".",
"If",
"not",
"set",
"the",
"return",
"value",
"is",
"-",
"1",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/middleware/apimiddleware.go#L88-L95 |
20,096 | decred/dcrdata | middleware/apimiddleware.go | GetBlockIndex0Ctx | func GetBlockIndex0Ctx(r *http.Request) int {
idx, ok := r.Context().Value(ctxBlockIndex0).(int)
if !ok {
apiLog.Error("block index0 is not set or is not an int")
return -1
}
return idx
} | go | func GetBlockIndex0Ctx(r *http.Request) int {
idx, ok := r.Context().Value(ctxBlockIndex0).(int)
if !ok {
apiLog.Error("block index0 is not set or is not an int")
return -1
}
return idx
} | [
"func",
"GetBlockIndex0Ctx",
"(",
"r",
"*",
"http",
".",
"Request",
")",
"int",
"{",
"idx",
",",
"ok",
":=",
"r",
".",
"Context",
"(",
")",
".",
"Value",
"(",
"ctxBlockIndex0",
")",
".",
"(",
"int",
")",
"\n",
"if",
"!",
"ok",
"{",
"apiLog",
".",... | // GetBlockIndex0Ctx retrieves the ctxBlockIndex0 data from the request context.
// If not set, the return value is -1. | [
"GetBlockIndex0Ctx",
"retrieves",
"the",
"ctxBlockIndex0",
"data",
"from",
"the",
"request",
"context",
".",
"If",
"not",
"set",
"the",
"return",
"value",
"is",
"-",
"1",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/middleware/apimiddleware.go#L99-L106 |
20,097 | decred/dcrdata | middleware/apimiddleware.go | GetTxIOIndexCtx | func GetTxIOIndexCtx(r *http.Request) int {
index, ok := r.Context().Value(ctxTxInOutIndex).(int)
if !ok {
apiLog.Warn("txinoutindex is not set or is not an int")
return -1
}
return index
} | go | func GetTxIOIndexCtx(r *http.Request) int {
index, ok := r.Context().Value(ctxTxInOutIndex).(int)
if !ok {
apiLog.Warn("txinoutindex is not set or is not an int")
return -1
}
return index
} | [
"func",
"GetTxIOIndexCtx",
"(",
"r",
"*",
"http",
".",
"Request",
")",
"int",
"{",
"index",
",",
"ok",
":=",
"r",
".",
"Context",
"(",
")",
".",
"Value",
"(",
"ctxTxInOutIndex",
")",
".",
"(",
"int",
")",
"\n",
"if",
"!",
"ok",
"{",
"apiLog",
"."... | // GetTxIOIndexCtx retrieves the ctxTxInOutIndex data from the request context.
// If not set, the return value is -1. | [
"GetTxIOIndexCtx",
"retrieves",
"the",
"ctxTxInOutIndex",
"data",
"from",
"the",
"request",
"context",
".",
"If",
"not",
"set",
"the",
"return",
"value",
"is",
"-",
"1",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/middleware/apimiddleware.go#L110-L117 |
20,098 | decred/dcrdata | middleware/apimiddleware.go | GetNCtx | func GetNCtx(r *http.Request) int {
N, ok := r.Context().Value(ctxN).(int)
if !ok {
apiLog.Trace("N is not set or is not an int")
return -1
}
return N
} | go | func GetNCtx(r *http.Request) int {
N, ok := r.Context().Value(ctxN).(int)
if !ok {
apiLog.Trace("N is not set or is not an int")
return -1
}
return N
} | [
"func",
"GetNCtx",
"(",
"r",
"*",
"http",
".",
"Request",
")",
"int",
"{",
"N",
",",
"ok",
":=",
"r",
".",
"Context",
"(",
")",
".",
"Value",
"(",
"ctxN",
")",
".",
"(",
"int",
")",
"\n",
"if",
"!",
"ok",
"{",
"apiLog",
".",
"Trace",
"(",
"... | // GetNCtx retrieves the ctxN data from the request context. If not set, the
// return value is -1. | [
"GetNCtx",
"retrieves",
"the",
"ctxN",
"data",
"from",
"the",
"request",
"context",
".",
"If",
"not",
"set",
"the",
"return",
"value",
"is",
"-",
"1",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/middleware/apimiddleware.go#L121-L128 |
20,099 | decred/dcrdata | middleware/apimiddleware.go | GetMCtx | func GetMCtx(r *http.Request) int {
M, ok := r.Context().Value(ctxM).(int)
if !ok {
apiLog.Trace("M is not set or is not an int")
return -1
}
return M
} | go | func GetMCtx(r *http.Request) int {
M, ok := r.Context().Value(ctxM).(int)
if !ok {
apiLog.Trace("M is not set or is not an int")
return -1
}
return M
} | [
"func",
"GetMCtx",
"(",
"r",
"*",
"http",
".",
"Request",
")",
"int",
"{",
"M",
",",
"ok",
":=",
"r",
".",
"Context",
"(",
")",
".",
"Value",
"(",
"ctxM",
")",
".",
"(",
"int",
")",
"\n",
"if",
"!",
"ok",
"{",
"apiLog",
".",
"Trace",
"(",
"... | // GetMCtx retrieves the ctxM data from the request context. If not set, the
// return value is -1. | [
"GetMCtx",
"retrieves",
"the",
"ctxM",
"data",
"from",
"the",
"request",
"context",
".",
"If",
"not",
"set",
"the",
"return",
"value",
"is",
"-",
"1",
"."
] | 02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6 | https://github.com/decred/dcrdata/blob/02d6f8e648f7e2c5cf78ea92fb17b1d4aa4a99f6/middleware/apimiddleware.go#L132-L139 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.