Documentation
¶
Index ¶
- func DisableLog()
- func StreamSeries(ctx *server.Context) (interface{}, int)
- func UseLogger(logger logpkg.Logger)
- type BalanceModel
- type BalanceSeries
- func (s *BalanceSeries) Add(m SeriesModel)
- func (s *BalanceSeries) BuildQuery(ctx *server.Context, args *SeriesRequest) pack.Query
- func (s *BalanceSeries) Clone() SeriesBucket
- func (s *BalanceSeries) Init(params *rpc.Params, columns []string, verbose bool)
- func (s *BalanceSeries) Interpolate(m SeriesBucket, ts time.Time) SeriesBucket
- func (s *BalanceSeries) IsEmpty() bool
- func (s *BalanceSeries) MarshalCSV() ([]string, error)
- func (s *BalanceSeries) MarshalJSON() ([]byte, error)
- func (s *BalanceSeries) MarshalJSONBrief() ([]byte, error)
- func (s *BalanceSeries) MarshalJSONVerbose() ([]byte, error)
- func (s *BalanceSeries) Null(ts time.Time) SeriesBucket
- func (s *BalanceSeries) Reset()
- func (s *BalanceSeries) SetTime(ts time.Time) SeriesBucket
- func (s *BalanceSeries) Time() time.Time
- func (s *BalanceSeries) Zero(ts time.Time) SeriesBucket
- type BlockSeries
- func (s *BlockSeries) Add(m SeriesModel)
- func (s *BlockSeries) BuildQuery(ctx *server.Context, args *SeriesRequest) pack.Query
- func (s *BlockSeries) Clone() SeriesBucket
- func (s *BlockSeries) Init(params *rpc.Params, columns []string, verbose bool)
- func (s *BlockSeries) Interpolate(m SeriesBucket, ts time.Time) SeriesBucket
- func (s *BlockSeries) IsEmpty() bool
- func (b *BlockSeries) MarshalCSV() ([]string, error)
- func (s *BlockSeries) MarshalJSON() ([]byte, error)
- func (b *BlockSeries) MarshalJSONBrief() ([]byte, error)
- func (b *BlockSeries) MarshalJSONVerbose() ([]byte, error)
- func (s *BlockSeries) Null(ts time.Time) SeriesBucket
- func (s *BlockSeries) Reset()
- func (s *BlockSeries) SetTime(ts time.Time) SeriesBucket
- func (s *BlockSeries) Time() time.Time
- func (s *BlockSeries) Zero(ts time.Time) SeriesBucket
- type ChainSeries
- func (s *ChainSeries) Add(m SeriesModel)
- func (s *ChainSeries) BuildQuery(ctx *server.Context, args *SeriesRequest) pack.Query
- func (s *ChainSeries) Clone() SeriesBucket
- func (s *ChainSeries) Init(params *rpc.Params, columns []string, verbose bool)
- func (s *ChainSeries) Interpolate(m SeriesBucket, ts time.Time) SeriesBucket
- func (s *ChainSeries) IsEmpty() bool
- func (c *ChainSeries) MarshalCSV() ([]string, error)
- func (c *ChainSeries) MarshalJSON() ([]byte, error)
- func (c *ChainSeries) MarshalJSONBrief() ([]byte, error)
- func (c *ChainSeries) MarshalJSONVerbose() ([]byte, error)
- func (s *ChainSeries) Null(ts time.Time) SeriesBucket
- func (s *ChainSeries) Reset()
- func (s *ChainSeries) SetTime(ts time.Time) SeriesBucket
- func (s *ChainSeries) Time() time.Time
- func (s *ChainSeries) Zero(ts time.Time) SeriesBucket
- type Collapse
- func (c Collapse) Base() time.Duration
- func (c Collapse) Duration() time.Duration
- func (c Collapse) MarshalText() ([]byte, error)
- func (c Collapse) Next(t time.Time, n int) time.Time
- func (c Collapse) Steps(from, to time.Time, limit uint) []time.Time
- func (c Collapse) String() string
- func (c Collapse) Truncate(t time.Time) time.Time
- func (c *Collapse) UnmarshalText(data []byte) error
- type FillMode
- type FlowSeries
- func (s *FlowSeries) Add(m SeriesModel)
- func (s *FlowSeries) BuildQuery(ctx *server.Context, args *SeriesRequest) pack.Query
- func (s *FlowSeries) Clone() SeriesBucket
- func (s *FlowSeries) Init(params *rpc.Params, columns []string, verbose bool)
- func (s *FlowSeries) Interpolate(m SeriesBucket, ts time.Time) SeriesBucket
- func (s *FlowSeries) IsEmpty() bool
- func (f *FlowSeries) MarshalCSV() ([]string, error)
- func (f *FlowSeries) MarshalJSON() ([]byte, error)
- func (f *FlowSeries) MarshalJSONBrief() ([]byte, error)
- func (f *FlowSeries) MarshalJSONVerbose() ([]byte, error)
- func (s *FlowSeries) Null(ts time.Time) SeriesBucket
- func (s *FlowSeries) Reset()
- func (s *FlowSeries) SetTime(ts time.Time) SeriesBucket
- func (s *FlowSeries) Time() time.Time
- func (s *FlowSeries) Zero(ts time.Time) SeriesBucket
- type OpSeries
- func (s *OpSeries) Add(m SeriesModel)
- func (s *OpSeries) BuildQuery(ctx *server.Context, args *SeriesRequest) pack.Query
- func (s *OpSeries) Clone() SeriesBucket
- func (s *OpSeries) Init(params *rpc.Params, columns []string, verbose bool)
- func (s *OpSeries) Interpolate(m SeriesBucket, ts time.Time) SeriesBucket
- func (s *OpSeries) IsEmpty() bool
- func (o *OpSeries) MarshalCSV() ([]string, error)
- func (s *OpSeries) MarshalJSON() ([]byte, error)
- func (o *OpSeries) MarshalJSONBrief() ([]byte, error)
- func (o *OpSeries) MarshalJSONVerbose() ([]byte, error)
- func (s *OpSeries) Null(ts time.Time) SeriesBucket
- func (s *OpSeries) Reset()
- func (s *OpSeries) SetTime(ts time.Time) SeriesBucket
- func (s *OpSeries) Time() time.Time
- func (s *OpSeries) Zero(ts time.Time) SeriesBucket
- type SeriesBucket
- type SeriesModel
- type SeriesRequest
- func (t SeriesRequest) Expires() time.Time
- func (args *SeriesRequest) Fill(from, to time.Time, fillFunc func(SeriesBucket) error) error
- func (t SeriesRequest) LastModified() time.Time
- func (r *SeriesRequest) Parse(ctx *server.Context)
- func (t SeriesRequest) RESTPath(r *mux.Router) string
- func (t SeriesRequest) RESTPrefix() string
- func (t SeriesRequest) RegisterDirectRoutes(r *mux.Router) error
- func (t SeriesRequest) RegisterRoutes(r *mux.Router) error
- func (args *SeriesRequest) StreamCSV(ctx *server.Context) error
- func (args *SeriesRequest) StreamJSON(ctx *server.Context) error
- func (args *SeriesRequest) StreamResponse(ctx *server.Context) (interface{}, int)
- type SupplySeries
- func (s *SupplySeries) Add(m SeriesModel)
- func (s *SupplySeries) BuildQuery(ctx *server.Context, args *SeriesRequest) pack.Query
- func (s *SupplySeries) Clone() SeriesBucket
- func (s *SupplySeries) Init(params *rpc.Params, columns []string, verbose bool)
- func (s *SupplySeries) Interpolate(m SeriesBucket, ts time.Time) SeriesBucket
- func (s *SupplySeries) IsEmpty() bool
- func (s *SupplySeries) MarshalCSV() ([]string, error)
- func (s *SupplySeries) MarshalJSON() ([]byte, error)
- func (s *SupplySeries) MarshalJSONBrief() ([]byte, error)
- func (s *SupplySeries) MarshalJSONVerbose() ([]byte, error)
- func (s *SupplySeries) Null(ts time.Time) SeriesBucket
- func (s *SupplySeries) Reset()
- func (s *SupplySeries) SetTime(ts time.Time) SeriesBucket
- func (s *SupplySeries) Time() time.Time
- func (s *SupplySeries) Zero(ts time.Time) SeriesBucket
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DisableLog ¶
func DisableLog()
DisableLog disables all library log output. Logging output is disabled by default until UseLogger is called.
func StreamSeries ¶
Types ¶
type BalanceModel ¶
func (*BalanceModel) Time ¶
func (m *BalanceModel) Time() time.Time
type BalanceSeries ¶
type BalanceSeries struct {
Timestamp time.Time `json:"time"`
Balance int64 `json:"balance"`
// contains filtered or unexported fields
}
configurable marshalling helper
func (*BalanceSeries) Add ¶
func (s *BalanceSeries) Add(m SeriesModel)
Aggregation func is `last()` instead of `sum()`
func (*BalanceSeries) BuildQuery ¶
func (s *BalanceSeries) BuildQuery(ctx *server.Context, args *SeriesRequest) pack.Query
func (*BalanceSeries) Clone ¶
func (s *BalanceSeries) Clone() SeriesBucket
func (*BalanceSeries) Init ¶
func (s *BalanceSeries) Init(params *rpc.Params, columns []string, verbose bool)
func (*BalanceSeries) Interpolate ¶
func (s *BalanceSeries) Interpolate(m SeriesBucket, ts time.Time) SeriesBucket
func (*BalanceSeries) IsEmpty ¶
func (s *BalanceSeries) IsEmpty() bool
func (*BalanceSeries) MarshalCSV ¶
func (s *BalanceSeries) MarshalCSV() ([]string, error)
func (*BalanceSeries) MarshalJSON ¶
func (s *BalanceSeries) MarshalJSON() ([]byte, error)
func (*BalanceSeries) MarshalJSONBrief ¶
func (s *BalanceSeries) MarshalJSONBrief() ([]byte, error)
func (*BalanceSeries) MarshalJSONVerbose ¶
func (s *BalanceSeries) MarshalJSONVerbose() ([]byte, error)
func (*BalanceSeries) Null ¶
func (s *BalanceSeries) Null(ts time.Time) SeriesBucket
func (*BalanceSeries) Reset ¶
func (s *BalanceSeries) Reset()
func (*BalanceSeries) SetTime ¶
func (s *BalanceSeries) SetTime(ts time.Time) SeriesBucket
func (*BalanceSeries) Time ¶
func (s *BalanceSeries) Time() time.Time
func (*BalanceSeries) Zero ¶
func (s *BalanceSeries) Zero(ts time.Time) SeriesBucket
type BlockSeries ¶
type BlockSeries struct {
Timestamp time.Time `json:"time"`
Count int `json:"count"`
NSlotsEndorsed int64 `json:"n_endorsed_slots"`
NOpsApplied int64 `json:"n_ops_applied"`
NOpsFailed int64 `json:"n_ops_failed"`
NContractCalls int64 `json:"n_calls"`
NRollupCalls int64 `json:"n_rollup_calls"`
NEvents int64 `json:"n_events"`
NTx int64 `json:"n_tx"`
NTickets int64 `json:"n_tickets"`
Volume int64 `json:"volume"`
Fee int64 `json:"fee"`
Reward int64 `json:"reward"`
Deposit int64 `json:"deposit"`
ActivatedSupply int64 `json:"activated_supply"`
MintedSupply int64 `json:"minted_supply"`
BurnedSupply int64 `json:"burned_supply"`
NewAccounts int64 `json:"n_new_accounts"`
NewContracts int64 `json:"n_new_contracts"`
ClearedAccounts int64 `json:"n_cleared_accounts"`
FundedAccounts int64 `json:"n_funded_accounts"`
GasUsed int64 `json:"gas_used"`
StoragePaid int64 `json:"storage_paid"`
// contains filtered or unexported fields
}
Only use fields that can be summed over time configurable marshalling helper
func (*BlockSeries) Add ¶
func (s *BlockSeries) Add(m SeriesModel)
func (*BlockSeries) BuildQuery ¶
func (s *BlockSeries) BuildQuery(ctx *server.Context, args *SeriesRequest) pack.Query
func (*BlockSeries) Clone ¶
func (s *BlockSeries) Clone() SeriesBucket
func (*BlockSeries) Init ¶
func (s *BlockSeries) Init(params *rpc.Params, columns []string, verbose bool)
func (*BlockSeries) Interpolate ¶
func (s *BlockSeries) Interpolate(m SeriesBucket, ts time.Time) SeriesBucket
func (*BlockSeries) IsEmpty ¶
func (s *BlockSeries) IsEmpty() bool
func (*BlockSeries) MarshalCSV ¶
func (b *BlockSeries) MarshalCSV() ([]string, error)
func (*BlockSeries) MarshalJSON ¶
func (s *BlockSeries) MarshalJSON() ([]byte, error)
func (*BlockSeries) MarshalJSONBrief ¶
func (b *BlockSeries) MarshalJSONBrief() ([]byte, error)
func (*BlockSeries) MarshalJSONVerbose ¶
func (b *BlockSeries) MarshalJSONVerbose() ([]byte, error)
func (*BlockSeries) Null ¶
func (s *BlockSeries) Null(ts time.Time) SeriesBucket
func (*BlockSeries) Reset ¶
func (s *BlockSeries) Reset()
func (*BlockSeries) SetTime ¶
func (s *BlockSeries) SetTime(ts time.Time) SeriesBucket
func (*BlockSeries) Time ¶
func (s *BlockSeries) Time() time.Time
func (*BlockSeries) Zero ¶
func (s *BlockSeries) Zero(ts time.Time) SeriesBucket
type ChainSeries ¶
configurable marshalling helper
func (*ChainSeries) Add ¶
func (s *ChainSeries) Add(m SeriesModel)
func (*ChainSeries) BuildQuery ¶
func (s *ChainSeries) BuildQuery(ctx *server.Context, args *SeriesRequest) pack.Query
func (*ChainSeries) Clone ¶
func (s *ChainSeries) Clone() SeriesBucket
func (*ChainSeries) Init ¶
func (s *ChainSeries) Init(params *rpc.Params, columns []string, verbose bool)
func (*ChainSeries) Interpolate ¶
func (s *ChainSeries) Interpolate(m SeriesBucket, ts time.Time) SeriesBucket
func (*ChainSeries) IsEmpty ¶
func (s *ChainSeries) IsEmpty() bool
func (*ChainSeries) MarshalCSV ¶
func (c *ChainSeries) MarshalCSV() ([]string, error)
func (*ChainSeries) MarshalJSON ¶
func (c *ChainSeries) MarshalJSON() ([]byte, error)
func (*ChainSeries) MarshalJSONBrief ¶
func (c *ChainSeries) MarshalJSONBrief() ([]byte, error)
func (*ChainSeries) MarshalJSONVerbose ¶
func (c *ChainSeries) MarshalJSONVerbose() ([]byte, error)
func (*ChainSeries) Null ¶
func (s *ChainSeries) Null(ts time.Time) SeriesBucket
func (*ChainSeries) Reset ¶
func (s *ChainSeries) Reset()
func (*ChainSeries) SetTime ¶
func (s *ChainSeries) SetTime(ts time.Time) SeriesBucket
func (*ChainSeries) Time ¶
func (s *ChainSeries) Time() time.Time
func (*ChainSeries) Zero ¶
func (s *ChainSeries) Zero(ts time.Time) SeriesBucket
type Collapse ¶
func ParseCollapse ¶
func (Collapse) MarshalText ¶
func (Collapse) Truncate ¶
Truncate truncates t to time unit ignoring its value, e.g. - minutes: full minute - hours: full hour - days: midnight UTC - weeks: midnight UTC on first day of week (Sunday) - months: midnight UTC on first day of month - quarters: midnight UTC on first day of quarter - years: midnight UTC on first day of year
func (*Collapse) UnmarshalText ¶
type FillMode ¶
type FillMode string
func ParseFillMode ¶
func (FillMode) MarshalText ¶
func (*FillMode) UnmarshalText ¶
type FlowSeries ¶
type FlowSeries struct {
Timestamp time.Time `json:"time"`
Count int `json:"count"`
AmountIn int64 `json:"amount_in"`
AmountOut int64 `json:"amount_out"`
// contains filtered or unexported fields
}
configurable marshalling helper
func (*FlowSeries) Add ¶
func (s *FlowSeries) Add(m SeriesModel)
func (*FlowSeries) BuildQuery ¶
func (s *FlowSeries) BuildQuery(ctx *server.Context, args *SeriesRequest) pack.Query
func (*FlowSeries) Clone ¶
func (s *FlowSeries) Clone() SeriesBucket
func (*FlowSeries) Init ¶
func (s *FlowSeries) Init(params *rpc.Params, columns []string, verbose bool)
func (*FlowSeries) Interpolate ¶
func (s *FlowSeries) Interpolate(m SeriesBucket, ts time.Time) SeriesBucket
func (*FlowSeries) IsEmpty ¶
func (s *FlowSeries) IsEmpty() bool
func (*FlowSeries) MarshalCSV ¶
func (f *FlowSeries) MarshalCSV() ([]string, error)
func (*FlowSeries) MarshalJSON ¶
func (f *FlowSeries) MarshalJSON() ([]byte, error)
func (*FlowSeries) MarshalJSONBrief ¶
func (f *FlowSeries) MarshalJSONBrief() ([]byte, error)
func (*FlowSeries) MarshalJSONVerbose ¶
func (f *FlowSeries) MarshalJSONVerbose() ([]byte, error)
func (*FlowSeries) Null ¶
func (s *FlowSeries) Null(ts time.Time) SeriesBucket
func (*FlowSeries) Reset ¶
func (s *FlowSeries) Reset()
func (*FlowSeries) SetTime ¶
func (s *FlowSeries) SetTime(ts time.Time) SeriesBucket
func (*FlowSeries) Time ¶
func (s *FlowSeries) Time() time.Time
func (*FlowSeries) Zero ¶
func (s *FlowSeries) Zero(ts time.Time) SeriesBucket
type OpSeries ¶
type OpSeries struct {
Timestamp time.Time `json:"time"`
Count int `json:"count"`
GasUsed int64 `json:"gas_used"`
StoragePaid int64 `json:"storage_paid"`
Volume int64 `json:"volume"`
Fee int64 `json:"fee"`
Reward int64 `json:"reward"`
Deposit int64 `json:"deposit"`
Burned int64 `json:"burned"`
// contains filtered or unexported fields
}
Only use fields that can be summed over time configurable marshalling helper
func (*OpSeries) Add ¶
func (s *OpSeries) Add(m SeriesModel)
func (*OpSeries) BuildQuery ¶
func (*OpSeries) Clone ¶
func (s *OpSeries) Clone() SeriesBucket
func (*OpSeries) Interpolate ¶
func (s *OpSeries) Interpolate(m SeriesBucket, ts time.Time) SeriesBucket
func (*OpSeries) MarshalCSV ¶
func (*OpSeries) MarshalJSON ¶
func (*OpSeries) MarshalJSONBrief ¶
func (*OpSeries) MarshalJSONVerbose ¶
type SeriesBucket ¶
type SeriesBucket interface {
// database query builder
BuildQuery(*server.Context, *SeriesRequest) pack.Query
// series handlers
Init(params *rpc.Params, columns []string, verbose bool)
Add(m SeriesModel)
IsEmpty() bool
Reset()
Clone() SeriesBucket
Null(time.Time) SeriesBucket
Zero(time.Time) SeriesBucket
Time() time.Time
SetTime(time.Time) SeriesBucket
Interpolate(SeriesBucket, time.Time) SeriesBucket
// series marshallers
json.Marshaler
csv.Marshaler
MarshalJSONVerbose() ([]byte, error)
MarshalJSONBrief() ([]byte, error)
}
New common series handling below
type SeriesModel ¶
type SeriesRequest ¶
type SeriesRequest struct {
Series string `schema:"-"`
Columns util.StringList `schema:"columns"`
Collapse Collapse `schema:"collapse"`
FillMode FillMode `schema:"fill"`
From util.Time `schema:"start_date"`
To util.Time `schema:"end_date"`
Limit uint `schema:"limit"`
Verbose bool `schema:"verbose"`
Format string `schema:"-"` // from URL
Order pack.OrderType `schema:"order"` // asc/desc
Filename string `schema:"filename"` // for CSV downloads
// contains filtered or unexported fields
}
build packdb query from request
func (SeriesRequest) Expires ¶
func (t SeriesRequest) Expires() time.Time
func (*SeriesRequest) Fill ¶
func (args *SeriesRequest) Fill(from, to time.Time, fillFunc func(SeriesBucket) error) error
func (SeriesRequest) LastModified ¶
func (t SeriesRequest) LastModified() time.Time
func (*SeriesRequest) Parse ¶
func (r *SeriesRequest) Parse(ctx *server.Context)
func (SeriesRequest) RESTPrefix ¶
func (t SeriesRequest) RESTPrefix() string
func (SeriesRequest) RegisterDirectRoutes ¶
func (t SeriesRequest) RegisterDirectRoutes(r *mux.Router) error
func (SeriesRequest) RegisterRoutes ¶
func (t SeriesRequest) RegisterRoutes(r *mux.Router) error
func (*SeriesRequest) StreamJSON ¶
func (args *SeriesRequest) StreamJSON(ctx *server.Context) error
func (*SeriesRequest) StreamResponse ¶
func (args *SeriesRequest) StreamResponse(ctx *server.Context) (interface{}, int)
type SupplySeries ¶
configurable marshalling helper
func (*SupplySeries) Add ¶
func (s *SupplySeries) Add(m SeriesModel)
func (*SupplySeries) BuildQuery ¶
func (s *SupplySeries) BuildQuery(ctx *server.Context, args *SeriesRequest) pack.Query
func (*SupplySeries) Clone ¶
func (s *SupplySeries) Clone() SeriesBucket
func (*SupplySeries) Init ¶
func (s *SupplySeries) Init(params *rpc.Params, columns []string, verbose bool)
func (*SupplySeries) Interpolate ¶
func (s *SupplySeries) Interpolate(m SeriesBucket, ts time.Time) SeriesBucket
func (*SupplySeries) IsEmpty ¶
func (s *SupplySeries) IsEmpty() bool
func (*SupplySeries) MarshalCSV ¶
func (s *SupplySeries) MarshalCSV() ([]string, error)
func (*SupplySeries) MarshalJSON ¶
func (s *SupplySeries) MarshalJSON() ([]byte, error)
func (*SupplySeries) MarshalJSONBrief ¶
func (s *SupplySeries) MarshalJSONBrief() ([]byte, error)
func (*SupplySeries) MarshalJSONVerbose ¶
func (s *SupplySeries) MarshalJSONVerbose() ([]byte, error)
func (*SupplySeries) Null ¶
func (s *SupplySeries) Null(ts time.Time) SeriesBucket
func (*SupplySeries) Reset ¶
func (s *SupplySeries) Reset()
func (*SupplySeries) SetTime ¶
func (s *SupplySeries) SetTime(ts time.Time) SeriesBucket
func (*SupplySeries) Time ¶
func (s *SupplySeries) Time() time.Time
func (*SupplySeries) Zero ¶
func (s *SupplySeries) Zero(ts time.Time) SeriesBucket