parser

package
v0.0.0-...-7e90556 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByteQueryUnescaper

type ByteQueryUnescaper struct{}

ByteQueryUnescaper is a URL query decoder that operates with []byte instead of string.

func (*ByteQueryUnescaper) QueryUnescape

func (s *ByteQueryUnescaper) QueryUnescape(q []byte) ([]byte, error)

QueryUnescape is like net/url.QueryUnescape but with only one encoding and with []byte.

type MixpanelEvent

type MixpanelEvent struct {
	Pstart     time.Time         // the time that we started processing
	EventTime  json.Number       // the time that the server recieved the event
	UUID       string            // UUID of the event as assigned by the edge
	ClientIP   string            // the ipv4 of the client
	Event      string            // the type of the event
	EdgeType   string            // the type of the edge (internal/external)
	UserAgent  string            // the user agent from an edge request
	Properties json.RawMessage   // the raw bytes of the json properties sub object
	Failure    reporter.FailMode // a flag for failure modes
}

MixpanelEvent is a decoded Mixpanel Event with Properties/source information.

func DecodeBase64

func DecodeBase64(matches ParseResult, escaper URLEscaper) ([]MixpanelEvent, error)

DecodeBase64 base64 decodes and json unmarshals a ParseResult into MixpanelEvents.

func MakeErrorEvent

func MakeErrorEvent(line Parseable, uuid string, when string, edgeType string) *MixpanelEvent

MakeErrorEvent returns an event indicating an error happened while parsing the event.

func MakePanickedEvent

func MakePanickedEvent(line Parseable) *MixpanelEvent

MakePanickedEvent returns an event inidicating a panic happened while parsing the event.

type ParseResult

type ParseResult interface {
	Data() []byte
	UUID() string
	Time() string
}

ParseResult is a base 64-encoded byte array with a UUID and time attached.

type Parseable

type Parseable interface {
	Data() []byte
	StartTime() time.Time
}

Parseable is a byte stream to be parsed associated with a time.

type Parser

type Parser interface {
	Parse(Parseable) ([]MixpanelEvent, error)
}

Parser is an interface for turning Parseables into one or more MixpanelEvents.

type URLEscaper

type URLEscaper interface {
	QueryUnescape([]byte) ([]byte, error)
}

URLEscaper is an interface for unescape URL query encoding in a byte stream.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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