ec

package
v0.0.0-...-3f61646 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package ec is an interface for event tracker

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveAppInfo

func ResolveAppInfo(appID string) (string, string)

ResolveAppInfo resolves appID into package id and app type

Types

type Config

type Config struct {
	Enabled  bool     `yaml:"enabled" json:"enabled"`
	Type     string   `yaml:"type" json:"type"`
	Addrs    []string `yaml:"addrs" json:"addrs"`
	Topic    string   `yaml:"topic" json:"topic"`
	Encoding string   `yaml:"encoding" json:"encoding"`

	Compression string `yaml:"compression" json:"compression"`
}

Config sets event collector.

type ConfigType

type ConfigType int

ConfigType represents the event collector's type.

const (
	// KafkaConfig is kafka configuration.
	KafkaConfig ConfigType = iota
)

type Event

type Event struct {
	Body []byte `json:"body"`
}

Event represent the event message.

type EventCollector

type EventCollector interface {
	Collect(*Event) error
	CollectByTopic(string, *Event) error
	Close() error
}

EventCollector collects the event message.

type Option

type Option func(*Options)

Option defines the option setting function.

func Addrs

func Addrs(addrs ...string) Option

Addrs is the host:port pairs to use.

func Topic

func Topic(topic string) Option

Topic is the topic to use.

type Options

type Options struct {
	// Addrs stores the collector's addresses, like kafka server `127.0.0.1:9092`.
	Addrs []string

	// Topic represents the collector's topic to receive event, like kafka server, optional.
	Topic string

	// Other options for implementations of the interface
	// can be stored in a context
	Context context.Context
}

Options configures the event collector.

type TrackInfoHeader

type TrackInfoHeader struct {
	AppID          string `json:"appId"`
	AppVersion     string `json:"appVersion"`
	ConnectionType string `json:"connectionType"`
	Locale         string `json:"locale"`
	Carrier        string `json:"carrier"`
	DeviceBrand    string `json:"deviceBrand"`
	DeviceModel    string `json:"deviceModel"`
	OSName         string `json:"osName"`
	OSVersion      string `json:"osVersion"`
	Resolution     string `json:"resolution"`
	Orientation    string `json:"orientation"`
}

TrackInfoHeader includes the device info

func GetTrackInfo

func GetTrackInfo(req *http.Request) *TrackInfoHeader

GetTrackInfo extracts the device track info from header

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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