Documentation
¶
Overview ¶
Package ch is used to interact with ClickHouse servers.
Index ¶
- Constants
- Variables
- type AggSignal
- type AliasHandleMapper
- type FieldType
- type Service
- func (s *Service) GetAggregatedSignals(ctx context.Context, aggArgs *model.AggregatedSignalArgs) ([]*AggSignal, error)
- func (s *Service) GetAvailableSignals(ctx context.Context, tokenId uint32, filter *model.SignalFilter) ([]string, error)
- func (s *Service) GetEvents(ctx context.Context, subject string, from, to time.Time, ...) ([]*vss.Event, error)
- func (s *Service) GetLatestSignals(ctx context.Context, latestArgs *model.LatestSignalsArgs) ([]*vss.Signal, error)
Constants ¶
const ( // IntervalGroup is the column alias for the interval group. IntervalGroup = "group_timestamp" AggNumberCol = "agg_number" AggStringCol = "agg_string" )
const ( // TimeoutErrCode is the error code returned by ClickHouse when a query is interrupted due to exceeding the max_execution_time. TimeoutErrCode = int32(159) )
Variables ¶
var SourceTranslations = map[string][]string{
"macaron": {"dimo/integration/2ULfuC8U9dOqRshZBAi0lMM1Rrx", "0x4c674ddE8189aEF6e3b58F5a36d7438b2b1f6Bc2"},
"tesla": {"dimo/integration/26A5Dk3vvvQutjSyF0Jka2DP5lg", "0xc4035Fecb1cc906130423EF05f9C20977F643722"},
"autopi": {"dimo/integration/27qftVRWQYpVDcO5DltO5Ojbjxk", "0x5e31bBc786D7bEd95216383787deA1ab0f1c1897"},
"smartcar": {"dimo/integration/22N2xaPOq2WW2gAHBHd0Ikn4Zob", "0xcd445F4c6bDAD32b68a2939b912150Fe3C88803E"},
"ruptela": {"0xF26421509Efe92861a587482100c6d728aBf1CD0"},
"compass": {"0x55BF1c27d468314Ea119CF74979E2b59F962295c"},
"motorq": {"0x5879B43D88Fa93CE8072d6612cBc8dE93E98CE5d"},
}
Functions ¶
This section is empty.
Types ¶
type AggSignal ¶ added in v0.1.19
type AggSignal struct { // SignalType describes the type of values in the aggregation: // float, string, or approximate location. SignalType FieldType // SignalIndex is an identifier for the aggregation within its // SignalType. // // For float and string aggregations this is simply an index // into the corresponding argument array. // // For approximate location, we imagine expanding each element of // the slice model.AllFloatAggregation into two: first the // longitude and then the latitude. So, for example, SignalType = 3 // and SignalIndex = 3 means latitude for the 1-th float // aggregation. // // We could get away with a single number, since we know how many // arguments of each type there are, but it appears to us that this // would make adding new types riskier. SignalIndex uint16 // Timestamp is the timestamp for the bucket, the leftmost point. Timestamp time.Time // ValueNumber is the value for this row if it is of float or // approximate location type. ValueNumber float64 // ValueNumber is the value for this row if it is of float or // approximate location type. ValueString string }
type AliasHandleMapper ¶ added in v0.1.19
type AliasHandleMapper struct {
// contains filtered or unexported fields
}
func NewAliasHandleMapper ¶ added in v0.1.19
func NewAliasHandleMapper() *AliasHandleMapper
func (*AliasHandleMapper) Add ¶ added in v0.1.19
func (m *AliasHandleMapper) Add(alias, handle string)
func (*AliasHandleMapper) Alias ¶ added in v0.1.19
func (m *AliasHandleMapper) Alias(handle string) string
func (*AliasHandleMapper) Handle ¶ added in v0.1.19
func (m *AliasHandleMapper) Handle(alias string) string
type FieldType ¶ added in v0.1.19
type FieldType uint8
FieldType indicates the type of values in the aggregation. Currently there are three types: normal float values, string values, and "approximate location" values that are computed from the precise location values, in Go.
const ( // FloatType is the type for rows with numeric values that are in // the VSS spec. FloatType FieldType = 1 // StringType is the type for rows with string values. StringType FieldType = 2 // AppLocType is the type for rows needed to compute approximate // locations. AppLocType FieldType = 3 )
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is a ClickHouse service that interacts with the ClickHouse database.
func NewService ¶
NewService creates a new ClickHouse service.
func (*Service) GetAggregatedSignals ¶
func (s *Service) GetAggregatedSignals(ctx context.Context, aggArgs *model.AggregatedSignalArgs) ([]*AggSignal, error)
GetAggregatedSignals returns a slice of aggregated signals based on the provided arguments from the ClickHouse database. The signals are sorted by timestamp in ascending order. The timestamp on each signal is for the start of the interval.
func (*Service) GetAvailableSignals ¶ added in v0.0.21
func (s *Service) GetAvailableSignals(ctx context.Context, tokenId uint32, filter *model.SignalFilter) ([]string, error)
GetAvailableSignals returns a slice of available signals from the ClickHouse database. if no signals are available, a nil slice is returned.
func (*Service) GetLatestSignals ¶
func (s *Service) GetLatestSignals(ctx context.Context, latestArgs *model.LatestSignalsArgs) ([]*vss.Signal, error)
GetLatestSignals returns the latest signals based on the provided arguments from the ClickHouse database.