analytics

package
v0.0.0-...-10388f3 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TABLE_SUBSCRIPTIONS = `subscriptions`

	STATE_UNKNOWN      = 0
	STATE_ACTIVE       = 1
	STATE_TIER_CHANGED = 2
	STATE_CANCELLED    = 3
)
View Source
const (
	TABLE_EVENTS_LOGS = `events_logs`
)
View Source
const (
	TABLE_PERSONS = `persons`
)
View Source
const (
	TABLE_TIERS = `tiers`
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Analytics

type Analytics struct {
	// contains filtered or unexported fields
}

func New

func New(
	db *database.Database,
	personService *PersonService,
	eventLogService *EventLogService,
	tierService *TierService,
	subscriptionService *SubscriptionService,
) *Analytics

func (*Analytics) Process

func (analytics *Analytics) Process(event *webhooks.Sponsorship)

type EventLog

type EventLog struct {
	ID                int64     `db:"id" json:"id"`
	DeliveryID        string    `db:"delivery_id" json:"delivery_id"`
	ReceiverID        int64     `db:"receiver_id" json:"receiver_id"`
	SponsorID         int64     `db:"sponsor_id" json:"sponsor_id"`
	Action            string    `db:"action" json:"action"`
	PrivacyLevel      uint8     `db:"privacy_level" json:"privacy_level"`
	SponsorshipNodeID string    `db:"sponsorship_node_id" json:"sponsorship_node_id"`
	TierID            int64     `db:"tier_id" json:"tier_id"`
	TierPrice         int       `db:"tier_price" json:"tier_price"`
	CreatedAt         time.Time `db:"created_at" json:"created_at"`
}

type EventLogService

type EventLogService struct {
	// contains filtered or unexported fields
}

func NewEventLogService

func NewEventLogService(db *database.Database) *EventLogService

func (*EventLogService) Count

func (service *EventLogService) Count(expr goqu.Ex) (int64, error)

func (*EventLogService) Find

func (service *EventLogService) Find(exp goqu.Ex) ([]EventLog, error)

func (*EventLogService) Insert

func (service *EventLogService) Insert(event EventLog) (int64, error)

type Person

type Person struct {
	ID           int64     `db:"id" json:"id"`
	RemoteNodeID string    `db:"remote_node_id" json:"remote_node_id"`
	RemoteID     int       `db:"remote_id" json:"remote_id"`
	Login        string    `db:"login" json:"login"`
	AvatarURL    string    `db:"avatar_url" json:"avatar_url"`
	CreatedAt    time.Time `db:"created_at" goqu:"skipupdate" json:"created_at"`
}

type PersonService

type PersonService struct {
	// contains filtered or unexported fields
}

func NewPersonService

func NewPersonService(db *database.Database) *PersonService

func (*PersonService) Find

func (service *PersonService) Find(exp goqu.Ex) ([]Person, error)

func (*PersonService) Get

func (service *PersonService) Get(exp goqu.Ex) (*Person, error)

func (*PersonService) Insert

func (service *PersonService) Insert(person Person) (int64, error)

type PrivacyLevel

type PrivacyLevel uint8
const (
	PrivacyLevelUnknown PrivacyLevel = 0
	PrivacyLevelPublic  PrivacyLevel = 1
	PrivacyLevelPrivate PrivacyLevel = 2
)

func GetPrivacyLevel

func GetPrivacyLevel(str string) PrivacyLevel

func (PrivacyLevel) String

func (level PrivacyLevel) String() string

type Subscription

type Subscription struct {
	ID                int64      `db:"id" json:"id"`
	State             uint8      `db:"state" json:"state"`
	SponsorshipNodeID string     `db:"sponsorship_node_id" json:"sponsorship_node_id"`
	RemoteCreatedAt   time.Time  `db:"remote_created_at" json:"remote_created_at"`
	ReceiverID        int64      `db:"receiver_id" json:"receiver_id"`
	SponsorID         int64      `db:"sponsor_id" json:"sponsor_id"`
	TierID            int64      `db:"tier_id" json:"tier_id"`
	TierName          string     `db:"tier_name" json:"tier_name"`
	TierPrice         int        `db:"tier_price" json:"tier_price"`
	CreatedAt         time.Time  `db:"created_at" json:"created_at"`
	CancelledAt       *time.Time `db:"cancelled_at" goqu:"skipinsert" json:"cancelled_at,omitempty"`
}

type SubscriptionService

type SubscriptionService struct {
	// contains filtered or unexported fields
}

func NewSubscriptionService

func NewSubscriptionService(db *database.Database) *SubscriptionService

func (*SubscriptionService) Find

func (service *SubscriptionService) Find(exp goqu.Ex) ([]Subscription, error)

func (*SubscriptionService) Get

func (service *SubscriptionService) Get(exp goqu.Ex) (*Subscription, error)

func (*SubscriptionService) Insert

func (service *SubscriptionService) Insert(sub Subscription) (int64, error)

func (*SubscriptionService) Update

func (service *SubscriptionService) Update(
	set interface{},
	where goqu.Expression,
) error

type Tier

type Tier struct {
	ID              int64      `db:"id" json:"id"`
	RemoteNodeID    string     `db:"remote_node_id" json:"remote_node_id"`
	ReceiverID      int64      `db:"receiver_id" json:"receiver_id"`
	Name            string     `db:"name" json:"name"`
	Description     string     `db:"description" json:"description"`
	Price           int        `db:"price" json:"price"`
	RemoteCreatedAt time.Time  `db:"remote_created_at" json:"remote_created_at"`
	CreatedAt       time.Time  `db:"created_at" json:"created_at"`
	UpdatedAt       *time.Time `db:"updated_at" goqu:"skipinsert" json:"updated_at,omitempty"`
}

type TierService

type TierService struct {
	// contains filtered or unexported fields
}

func NewTierService

func NewTierService(db *database.Database) *TierService

func (*TierService) Find

func (service *TierService) Find(exp goqu.Ex) ([]Tier, error)

func (*TierService) Upsert

func (service *TierService) Upsert(tier Tier) (int64, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL