params

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TransactionSortTimestampAsc TransactionSort = iota
	TransactionSortTimestampDesc

	TransactionSortDefault = TransactionSortTimestampAsc

	TransactionSortTimestampAscStr  = "timestamp-asc"
	TransactionSortTimestampDescStr = "timestamp-desc"
)
View Source
const (
	KeyID               = "id"
	KeyChainID          = "chainID"
	KeyAddress          = "address"
	KeyToAddress        = "toAddress"
	KeyFromAddress      = "fromAddress"
	KeyBlockStart       = "blockStart"
	KeyBlockEnd         = "blockEnd"
	KeyHash             = "hash"
	KeyAlias            = "alias"
	KeyAssetID          = "assetID"
	KeySearchQuery      = "query"
	KeySortBy           = "sort"
	KeyLimit            = "limit"
	KeyOffset           = "offset"
	KeySpent            = "spent"
	KeyStartTime        = "startTime"
	KeyEndTime          = "endTime"
	KeyIntervalSize     = "intervalSize"
	KeyDisableCount     = "disableCount"
	KeyDisableGenesis   = "disableGenesis"
	KeyOutputOutputType = "outputOutputType"
	KeyOutputGroupID    = "outputGroupId"

	PaginationMaxLimit      = 5000
	PaginationDefaultOffset = 0

	VersionDefault = 0
)

Variables

View Source
var (
	IntervalMinute = 1 * time.Minute
	IntervalHour   = 60 * time.Minute
	IntervalDay    = 1440 * time.Minute
	IntervalWeek   = 7 * IntervalDay
	IntervalMonth  = 30 * IntervalDay
	IntervalYear   = 365 * IntervalDay
	IntervalAll    = time.Duration(0)
	IntervalNames  = map[string]time.Duration{
		"minute": IntervalMinute,
		"hour":   IntervalHour,
		"day":    IntervalDay,
		"week":   IntervalWeek,
		"month":  IntervalMonth,
		"year":   IntervalYear,
		"all":    IntervalAll,
	}

	ErrUndefinedSort = errors.New("undefined sort")

	TransactionRoundDuration = time.Second
)

Functions

func AddressFromString

func AddressFromString(addrStr string) (ids.ShortID, error)

func CacheKey

func CacheKey(name string, val interface{}) string

func ForValueChainID added in v1.1.2

func ForValueChainID(chainID *ids.ID, chainIDs []string) []string

func GetQueryAddress

func GetQueryAddress(q url.Values, key string) (*ids.ShortID, error)

func GetQueryBool added in v1.1.0

func GetQueryBool(q url.Values, key string, defaultVal bool) (val bool, err error)

func GetQueryID

func GetQueryID(q url.Values, key string) (*ids.ID, error)

func GetQueryInt

func GetQueryInt(q url.Values, key string, defaultVal int) (val int, err error)

func GetQueryInterval

func GetQueryInterval(q url.Values, key string) (time.Duration, error)

func GetQueryString

func GetQueryString(q url.Values, key string, defaultVal string) string

func GetQueryTime

func GetQueryTime(q url.Values, key string) (bool, time.Time, error)

Types

type AddressChainsParams added in v1.1.1

type AddressChainsParams struct {
	ListParams ListParams
	Addresses  []ids.ShortID
}

func (*AddressChainsParams) Apply added in v1.1.1

func (p *AddressChainsParams) Apply(b *dbr.SelectBuilder) *dbr.SelectBuilder

func (*AddressChainsParams) CacheKey added in v1.1.1

func (p *AddressChainsParams) CacheKey() []string

func (*AddressChainsParams) ForValues added in v1.1.1

func (p *AddressChainsParams) ForValues(v uint8, q url.Values) error

type AggregateParams added in v1.1.0

type AggregateParams struct {
	ListParams ListParams

	ChainIDs     []string
	AssetID      *ids.ID
	IntervalSize time.Duration
}

func (*AggregateParams) Apply added in v1.1.0

func (p *AggregateParams) Apply(b *dbr.SelectBuilder) *dbr.SelectBuilder

func (*AggregateParams) CacheKey added in v1.1.0

func (p *AggregateParams) CacheKey() []string

func (*AggregateParams) ForValues added in v1.1.0

func (p *AggregateParams) ForValues(version uint8, q url.Values) (err error)

type BlockSort added in v1.1.0

type BlockSort string

type ListAddressesParams added in v1.1.0

type ListAddressesParams struct {
	ListParams ListParams
	ChainIDs   []string
	Address    *ids.ShortID
}

func (*ListAddressesParams) Apply added in v1.1.0

func (p *ListAddressesParams) Apply(b *dbr.SelectBuilder, accumulateReader bool) *dbr.SelectBuilder

func (*ListAddressesParams) CacheKey added in v1.1.0

func (p *ListAddressesParams) CacheKey() []string

func (*ListAddressesParams) ForValues added in v1.1.0

func (p *ListAddressesParams) ForValues(v uint8, q url.Values) error

type ListAssetsParams added in v1.1.0

type ListAssetsParams struct {
	ListParams  ListParams
	Alias       string
	PathParamID string
}

func (*ListAssetsParams) Apply added in v1.1.0

func (p *ListAssetsParams) Apply(b *dbr.SelectBuilder) *dbr.SelectBuilder

func (*ListAssetsParams) CacheKey added in v1.1.0

func (p *ListAssetsParams) CacheKey() []string

func (*ListAssetsParams) ForValues added in v1.1.2

func (p *ListAssetsParams) ForValues(v uint8, q url.Values) error

type ListBlocksParams added in v1.1.0

type ListBlocksParams struct {
	ListParams ListParams
	Types      []models.BlockType
	Sort       BlockSort
}

func (*ListBlocksParams) Apply added in v1.1.2

func (p *ListBlocksParams) Apply(b *dbr.SelectBuilder) *dbr.SelectBuilder

func (*ListBlocksParams) CacheKey added in v1.1.2

func (p *ListBlocksParams) CacheKey() []string

func (*ListBlocksParams) ForValues added in v1.1.2

func (p *ListBlocksParams) ForValues(v uint8, q url.Values) error

type ListCTransactionsParams added in v1.2.3

type ListCTransactionsParams struct {
	ListParams     ListParams
	CAddresses     []string
	CAddressesTo   []string
	CAddressesFrom []string
	Hashes         []string
	Sort           TransactionSort
	BlockStart     *big.Int
	BlockEnd       *big.Int
}

func (*ListCTransactionsParams) Apply added in v1.2.3

func (p *ListCTransactionsParams) Apply(b *dbr.SelectBuilder) *dbr.SelectBuilder

func (*ListCTransactionsParams) CacheKey added in v1.2.3

func (p *ListCTransactionsParams) CacheKey() []string

func (*ListCTransactionsParams) ForValues added in v1.2.3

func (p *ListCTransactionsParams) ForValues(v uint8, q url.Values) error

type ListOutputsParams added in v1.1.0

type ListOutputsParams struct {
	ListParams ListParams
	ChainIDs   []string
	Addresses  []ids.ShortID
	Spent      *bool
}

func (*ListOutputsParams) Apply added in v1.1.0

func (p *ListOutputsParams) Apply(b *dbr.SelectBuilder) *dbr.SelectBuilder

func (*ListOutputsParams) CacheKey added in v1.1.0

func (p *ListOutputsParams) CacheKey() []string

func (*ListOutputsParams) ForValues added in v1.1.0

func (p *ListOutputsParams) ForValues(v uint8, q url.Values) error

type ListParams

type ListParams struct {
	Values url.Values
	ID     *ids.ID
	Query  string

	Limit           int
	Offset          int
	DisableCounting bool

	StartTimeProvided bool
	EndTimeProvided   bool

	StartTime time.Time
	EndTime   time.Time
}

Global params

func (ListParams) Apply

func (p ListParams) Apply(listTable string, b *dbr.SelectBuilder) *dbr.SelectBuilder

func (ListParams) ApplyPk added in v1.1.3

func (p ListParams) ApplyPk(listTable string, b *dbr.SelectBuilder, primaryKey string, pk bool) *dbr.SelectBuilder

func (*ListParams) CacheKey

func (p *ListParams) CacheKey() []string

func (*ListParams) ForValues

func (p *ListParams) ForValues(version uint8, q url.Values) (err error)

func (*ListParams) ForValuesAllowOffset added in v1.4.5

func (p *ListParams) ForValuesAllowOffset(version uint8, q url.Values) (err error)

type ListTransactionsParams added in v1.1.0

type ListTransactionsParams struct {
	ListParams ListParams
	ChainIDs   []string
	Addresses  []ids.ShortID
	AssetID    *ids.ID

	OutputOutputTypes []uint64
	OutputGroupIDs    []uint64

	DisableGenesis bool
	Sort           TransactionSort
}

func (*ListTransactionsParams) Apply added in v1.1.0

func (p *ListTransactionsParams) Apply(b *dbr.SelectBuilder) *dbr.SelectBuilder

func (*ListTransactionsParams) CacheKey added in v1.1.0

func (p *ListTransactionsParams) CacheKey() []string

func (*ListTransactionsParams) ForValues added in v1.1.0

func (p *ListTransactionsParams) ForValues(v uint8, q url.Values) error

type Param

type Param interface {
	ForValues(uint8, url.Values) error
	CacheKey() []string
}

type SearchParams added in v1.1.0

type SearchParams struct {
	ListParams ListParams
}

func (*SearchParams) CacheKey added in v1.1.0

func (p *SearchParams) CacheKey() []string

func (*SearchParams) ForValues added in v1.1.0

func (p *SearchParams) ForValues(v uint8, q url.Values) error

type TransactionSort added in v1.1.0

type TransactionSort uint8

Sorting

func (TransactionSort) String added in v1.4.5

func (t TransactionSort) String() string

type TxDataParam added in v1.2.0

type TxDataParam struct {
	ListParams ListParams
	ID         string
}

func (*TxDataParam) CacheKey added in v1.2.0

func (p *TxDataParam) CacheKey() []string

func (*TxDataParam) ForValues added in v1.2.0

func (p *TxDataParam) ForValues(v uint8, q url.Values) error

type TxfeeAggregateParams added in v1.1.2

type TxfeeAggregateParams struct {
	ListParams ListParams

	IntervalSize time.Duration

	ChainIDs []string
}

func (*TxfeeAggregateParams) Apply added in v1.1.2

func (p *TxfeeAggregateParams) Apply(b *dbr.SelectBuilder) *dbr.SelectBuilder

func (*TxfeeAggregateParams) CacheKey added in v1.1.2

func (p *TxfeeAggregateParams) CacheKey() []string

func (*TxfeeAggregateParams) ForValues added in v1.1.2

func (p *TxfeeAggregateParams) ForValues(version uint8, q url.Values) (err error)

Jump to

Keyboard shortcuts

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