params

package
v1.2.1-0...-f94cca8 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2021 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TransactionSortDefault       TransactionSort = TransactionSortTimestampAsc
	TransactionSortTimestampAsc                  = "timestamp-asc"
	TransactionSortTimestampDesc                 = "timestamp-desc"
)
View Source
const (
	KeyID               = "id"
	KeyChainID          = "chainID"
	KeyAddress          = "address"
	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"
	KeyVersion          = "version"
	KeyEnableAggregate  = "enableAggregate"
	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

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

func GetQueryAddress

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

func GetQueryBool

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

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

func (*AddressChainsParams) Apply

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

func (*AddressChainsParams) CacheKey

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

func (*AddressChainsParams) ForValues

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

type AggregateParams

type AggregateParams struct {
	ListParams ListParams

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

func (*AggregateParams) Apply

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

func (*AggregateParams) CacheKey

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

func (*AggregateParams) ForValues

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

type BlockSort

type BlockSort string

type ListAddressesParams

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

func (*ListAddressesParams) Apply

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

func (*ListAddressesParams) CacheKey

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

func (*ListAddressesParams) ForValues

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

type ListAssetsParams

type ListAssetsParams struct {
	ListParams      ListParams
	Alias           string
	EnableAggregate []string
	PathParamID     string
}

func (*ListAssetsParams) Apply

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

func (*ListAssetsParams) CacheKey

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

func (*ListAssetsParams) ForValues

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

type ListBlocksParams

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

func (*ListBlocksParams) Apply

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

func (*ListBlocksParams) CacheKey

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

func (*ListBlocksParams) ForValues

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

type ListCTransactionsParams

type ListCTransactionsParams struct {
	ListParams ListParams
	CAddresses []string
	Hashes     []string
	Sort       TransactionSort
}

func (*ListCTransactionsParams) Apply

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

func (*ListCTransactionsParams) CacheKey

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

func (*ListCTransactionsParams) ForValues

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

type ListOutputsParams

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

func (*ListOutputsParams) Apply

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

func (*ListOutputsParams) CacheKey

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

func (*ListOutputsParams) ForValues

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

type ListParams

type ListParams struct {
	Values    url.Values
	ID        *ids.ID
	Query     string
	StartTime time.Time
	EndTime   time.Time

	Limit               int
	Offset              int
	DisableCounting     bool
	StartTimeProvided   bool
	EndTimeProvided     bool
	ObserveTimeProvided bool
}

Global params

func (ListParams) Apply

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

func (ListParams) ApplyPk

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)

type ListTransactionsParams

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

	OutputOutputTypes []uint64
	OutputGroupIDs    []uint64

	DisableGenesis bool
	Sort           TransactionSort
}

func (*ListTransactionsParams) Apply

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

func (*ListTransactionsParams) CacheKey

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

func (*ListTransactionsParams) ForValues

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

type Param

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

type SearchParams

type SearchParams struct {
	ListParams ListParams
}

func (*SearchParams) CacheKey

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

func (*SearchParams) ForValues

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

type TransactionSort

type TransactionSort string

Sorting

type TxDataParam

type TxDataParam struct {
	ListParams ListParams
	ID         string
}

func (*TxDataParam) CacheKey

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

func (*TxDataParam) ForValues

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

type TxfeeAggregateParams

type TxfeeAggregateParams struct {
	ListParams ListParams

	IntervalSize time.Duration

	ChainIDs []string
}

func (*TxfeeAggregateParams) Apply

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

func (*TxfeeAggregateParams) CacheKey

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

func (*TxfeeAggregateParams) ForValues

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