Documentation ¶
Index ¶
- Variables
- type CountCollector
- func (c *CountCollector) CollectDailyActiveUser(startTime *time.Time) (int, error)
- func (c *CountCollector) CollectDailyEmailSent(startTime *time.Time) (int, error)
- func (c *CountCollector) CollectDailySMSSent(startTime *time.Time) (int, error)
- func (c *CountCollector) CollectDailyWhatsappOTPVerified(startTime *time.Time) (int, error)
- func (c *CountCollector) CollectMonthlyActiveUser(startTime *time.Time) (int, error)
- func (c *CountCollector) CollectWeeklyActiveUser(startTime *time.Time) (int, error)
- type GlobalDBStore
- func (s *GlobalDBStore) FetchUploadedUsageRecords(appID string, recordName RecordName, period periodical.Type, ...) ([]*UsageRecord, error)
- func (s *GlobalDBStore) FetchUsageRecords(appID string, recordName RecordName, period periodical.Type, ...) ([]*UsageRecord, error)
- func (s *GlobalDBStore) GetAppIDs() (appIDs []string, err error)
- func (s *GlobalDBStore) UpsertUsageRecords(usageRecords []*UsageRecord) error
- type HardSMSBucketer
- type MeterAuditDBStore
- type ReadCounterStore
- type RecordName
- type RecordType
- type UsageRecord
Constants ¶
This section is empty.
Variables ¶
View Source
var DependencySet = wire.NewSet( wire.Struct(new(HardSMSBucketer), "*"), wire.Struct(new(GlobalDBStore), "*"), wire.Struct(new(CountCollector), "*"), )
Functions ¶
This section is empty.
Types ¶
type CountCollector ¶
type CountCollector struct { GlobalHandle *globaldb.Handle GlobalDBStore *GlobalDBStore ReadCounter ReadCounterStore AuditHandle *auditdb.ReadHandle Meters MeterAuditDBStore }
func (*CountCollector) CollectDailyActiveUser ¶
func (c *CountCollector) CollectDailyActiveUser(startTime *time.Time) (int, error)
func (*CountCollector) CollectDailyEmailSent ¶
func (c *CountCollector) CollectDailyEmailSent(startTime *time.Time) (int, error)
func (*CountCollector) CollectDailySMSSent ¶
func (c *CountCollector) CollectDailySMSSent(startTime *time.Time) (int, error)
func (*CountCollector) CollectDailyWhatsappOTPVerified ¶
func (c *CountCollector) CollectDailyWhatsappOTPVerified(startTime *time.Time) (int, error)
func (*CountCollector) CollectMonthlyActiveUser ¶
func (c *CountCollector) CollectMonthlyActiveUser(startTime *time.Time) (int, error)
func (*CountCollector) CollectWeeklyActiveUser ¶
func (c *CountCollector) CollectWeeklyActiveUser(startTime *time.Time) (int, error)
type GlobalDBStore ¶
type GlobalDBStore struct { SQLBuilder *globaldb.SQLBuilder SQLExecutor *globaldb.SQLExecutor }
func (*GlobalDBStore) FetchUploadedUsageRecords ¶
func (s *GlobalDBStore) FetchUploadedUsageRecords( appID string, recordName RecordName, period periodical.Type, stripeStart time.Time, stripeEnd time.Time, ) ([]*UsageRecord, error)
func (*GlobalDBStore) FetchUsageRecords ¶
func (s *GlobalDBStore) FetchUsageRecords( appID string, recordName RecordName, period periodical.Type, startTime time.Time, ) ([]*UsageRecord, error)
func (*GlobalDBStore) GetAppIDs ¶
func (s *GlobalDBStore) GetAppIDs() (appIDs []string, err error)
func (*GlobalDBStore) UpsertUsageRecords ¶
func (s *GlobalDBStore) UpsertUsageRecords(usageRecords []*UsageRecord) error
UpsertUsageRecords upsert usage record in batches
type HardSMSBucketer ¶
type HardSMSBucketer struct {
FeatureConfig *config.FeatureConfig
}
func (*HardSMSBucketer) Bucket ¶
func (b *HardSMSBucketer) Bucket() ratelimit.Bucket
type MeterAuditDBStore ¶
type ReadCounterStore ¶
type ReadCounterStore interface { GetDailyActiveUserCount(appID config.AppID, date *time.Time) (count int, redisKey string, err error) GetWeeklyActiveUserCount(appID config.AppID, year int, week int) (count int, redisKey string, err error) GetMonthlyActiveUserCount(appID config.AppID, year int, month int) (count int, redisKey string, err error) }
type RecordName ¶
type RecordName string
const ( RecordNameActiveUser RecordName = "active-user" RecordNameSMSSentNorthAmerica RecordName = "sms-sent.north-america" RecordNameSMSSentOtherRegions RecordName = "sms-sent.other-regions" RecordNameSMSSentTotal RecordName = "sms-sent.total" RecordNameEmailSent RecordName = "email-sent" RecordNameWhatsappOTPVerified RecordName = "whatsapp-otp-verified" )
type RecordType ¶
type RecordType string
const ( RecordTypeActiveUser RecordType = "active-user" RecordTypeSMSSent RecordType = "sms-sent" RecordTypeEmailSent RecordType = "email-sent" RecordTypeWhatsappOTPVerified RecordType = "whatsapp-otp-verified" )
type UsageRecord ¶
type UsageRecord struct { ID string AppID string Name RecordName Period string StartTime time.Time EndTime time.Time Count int AlertData map[string]interface{} StripeTimestamp *time.Time }
nolint:golint
func NewUsageRecord ¶
func NewUsageRecord(appID string, name RecordName, count int, period periodical.Type, startTime time.Time, endTime time.Time) *UsageRecord
Click to show internal directories.
Click to hide internal directories.