Documentation
¶
Index ¶
- type DBQuerier
- func (q *DBQuerier) FindEndsByMSISDN(ctx context.Context, msisdnA string) ([]FindEndsByMSISDNRow, error)
- func (q *DBQuerier) SumBusySubscribers(ctx context.Context, minUnits int64) ([]UsageRow, error)
- func (q *DBQuerier) SumByMSISDN(ctx context.Context, msisdnA string) ([]UsageRow, error)
- func (q *DBQuerier) SumByProvider(ctx context.Context, provider string) ([]UsageRow, error)
- type FindEndsByMSISDNRow
- type Querier
- type RecordType
- type UsageRow
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DBQuerier ¶
type DBQuerier struct {
// contains filtered or unexported fields
}
func NewQuerier ¶
func NewQuerier(conn genericConn) *DBQuerier
NewQuerier creates a DBQuerier that implements Querier. conn is typically a clickhouse.Conn.
func (*DBQuerier) FindEndsByMSISDN ¶
func (q *DBQuerier) FindEndsByMSISDN(ctx context.Context, msisdnA string) ([]FindEndsByMSISDNRow, error)
FindEndsByMSISDN implements Querier.FindEndsByMSISDN.
func (*DBQuerier) SumBusySubscribers ¶
SumBusySubscribers implements Querier.SumBusySubscribers.
func (*DBQuerier) SumByMSISDN ¶
SumByMSISDN implements Querier.SumByMSISDN.
type FindEndsByMSISDNRow ¶
type Querier ¶
type Querier interface {
// Sums usage per subscriber for one provider.
SumByProvider(ctx context.Context, provider string) ([]UsageRow, error)
// The same shape over a different filter, so the two share one Go struct.
SumBusySubscribers(ctx context.Context, minUnits int64) ([]UsageRow, error)
// Sums usage for one subscriber, sharing UsageRow across files.
SumByMSISDN(ctx context.Context, msisdnA string) ([]UsageRow, error)
// Returns the two columns whose Go types are built out of wrappers. A pointer
// reports no import of its own and a map reports none either — its key and
// value can come from different packages — so this file needs "time" from
// inside a *time.Time and nothing else brings it in.
FindEndsByMSISDN(ctx context.Context, msisdnA string) ([]FindEndsByMSISDNRow, error)
}
Querier is a typesafe Go interface backed by SQL queries.
type RecordType ¶
type RecordType struct {
Label string
}
RecordType is what --go-type maps the enum column to, in place of the string chgen would pick on its own.
It implements sql.Scanner because clickhouse-go decodes into the Go type the column maps to natively, or into a sql.Scanner — and into nothing else. A plain named type like `type RecordType string` compiles and then fails at run time with "converting Enum8 to *RecordType is unsupported", so an override that is only a rename does not work here.
func (*RecordType) Scan ¶
func (r *RecordType) Scan(src any) error
func (RecordType) String ¶
func (r RecordType) String() string
type UsageRow ¶
type UsageRow struct {
MSISDNA string `ch:"msisdn_a" json:"msisdn_a"`
RecordType RecordType `ch:"record_type" json:"record_type"`
Units int64 `ch:"units" json:"units"`
}