envelope

package
v0.13.3 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VENDOR         string = "vendor"
	NAMESPACE      string = "namespace"
	VERSION        string = "version"
	FORMAT         string = "format"
	PATH           string = "path"
	INPUT_PROTOCOL string = "inputProtocol"
	SCHEMA         string = "schema"
)
View Source
const HTTP_HEADERS_CONTEXT string = "io.silverton/buz/internal/contexts/httpHeaders/v1.0.json"

Variables

This section is empty.

Functions

This section is empty.

Types

type Annotations added in v0.11.13

type Annotations struct{}

Reserving this for future use.

type App

type App struct {
	Name    *string `json:"name,omitempty"`
	Version *string `json:"version,omitempty"`
	Build   *string `json:"build,omitempty"`
}

type Browser

type Browser struct {
	Lang           *string `json:"language,omitempty"`
	Cookies        *bool   `json:"cookies,omitempty"`
	ColorDepth     *int64  `json:"colorDepth,omitempty"`
	Charset        *string `json:"charset,omitempty"`
	ViewportSize   *string `json:"viewportSize,omitempty"`
	ViewportWidth  *int    `json:"viewportWidth,omitempty"`
	ViewportHeight *int    `json:"viewportHeight,omitempty"`
	DocumentSize   *string `json:"documentSize,omitempty"`
	DocumentWidth  *int    `json:"documentWidth,omitempty"`
	DocumentHeight *int    `json:"documentHeight,omitempty"`
}

type Collector

type Collector struct {
	Tstamp  time.Time `json:"tstamp"`
	Name    *string   `json:"name"`
	Version *string   `json:"version"`
}

func (Collector) Scan

func (c Collector) Scan(input interface{}) error

func (Collector) Value

func (c Collector) Value() (driver.Value, error)

type Contexts added in v0.13.0

type Contexts map[string]interface{}

func BuildContextsFromRequest added in v0.12.1

func BuildContextsFromRequest(c *gin.Context) Contexts

func (Contexts) Scan added in v0.13.0

func (c Contexts) Scan(input interface{}) error

func (Contexts) Value added in v0.13.0

func (c Contexts) Value() (driver.Value, error)

type Device

type Device struct {
	Ip                string  `json:"ip"`
	Useragent         string  `json:"useragent"`
	Id                string  `json:"id"`                  // Server-side cookie, header, or query params
	Idfa              *string `json:"idfa,omitempty"`      // [iOS]
	Idfv              *string `json:"idfv,omitempty"`      // [iOS]
	AdId              *string `json:"adId,omitempty"`      // [Android] Google play services advertising id
	AndroidId         *string `json:"androidId,omitempty"` // [Android] Android id
	AdTrackingEnabled *bool   `json:"adTrackingEnabled,omitempty"`
	Manufacturer      *string `json:"manufacturer,omitempty"`
	Model             *string `json:"model,omitempty"`
	Name              *string `json:"name,omitempty"`
	Type              *string `json:"type,omitempty"`
	Token             *string `json:"token,omitempty"`
	*Os               `json:"os,omitempty"`
	*Browser          `json:"browser,omitempty"`
	*Screen           `json:"screen,omitempty"`
	*Network          `json:"network,omitempty"`
	*App              `json:"app,omitempty"`
	*Location         `json:"location,omitempty"`
	Traits            map[string]interface{} `json:"traits,omitempty"`
}

func (Device) Scan

func (d Device) Scan(input interface{}) error

func (Device) Value

func (d Device) Value() (driver.Value, error)

type Enrichments added in v0.11.13

type Enrichments struct{}

Reserving this for future use.

type Envelope

type Envelope struct {
	db.BasePKeylessModel
	EventMeta    `json:"event" gorm:"type:json"`
	Pipeline     `json:"pipeline" gorm:"type:json"`
	Device       `json:"device,omitempty" gorm:"type:json"`
	*User        `json:"user,omitempty" gorm:"type:json"`
	*Session     `json:"session,omitempty" gorm:"type:json"`
	*Web         `json:"web,omitempty" gorm:"type:json"`
	*Annotations `json:"annotations,omitempty" gorm:"type:json"`
	*Enrichments `json:"enrichments,omitempty" gorm:"type:json"`
	Validation   `json:"validation" gorm:"type:json"`
	Contexts     *Contexts `json:"contexts,omitempty" gorm:"type:json"`
	Payload      Payload   `json:"payload" gorm:"type:json"`
}

func BuildCommonEnvelope added in v0.12.1

func BuildCommonEnvelope(c *gin.Context, conf config.Middleware, m *meta.CollectorMeta) Envelope

func (*Envelope) AsByte

func (e *Envelope) AsByte() ([]byte, error)

func (*Envelope) AsMap

func (e *Envelope) AsMap() (map[string]interface{}, error)

type Event added in v0.13.0

type Event interface {
	SchemaName() *string
	PayloadAsByte() ([]byte, error)
	Value() (driver.Value, error)
	Scan(input interface{}) error
}

type EventMeta

type EventMeta struct {
	Protocol          string    `json:"protocol,omitempty"`
	Uuid              uuid.UUID `json:"uuid,omitempty"`
	Vendor            string    `json:"vendor,omitempty"`
	Namespace         string    `json:"namespace,omitempty"`
	Version           string    `json:"version,omitempty"`
	Format            string    `json:"format,omitempty"`
	Schema            string    `json:"schema,omitempty"`
	DisableValidation bool      `json:"disableValidation,omitempty"`
}

func (*EventMeta) DbSchemaName added in v0.12.2

func (e *EventMeta) DbSchemaName() string

Return the desired database schema name using event metadata. An event with `com.something` vendor should be directed into a `com_something` schema.

func (*EventMeta) DbTableName added in v0.12.2

func (e *EventMeta) DbTableName() string

Return the desired database table name using event metadata. An event with a namespace of `some.namespace.something` and a version of `1.0` and/or `1.1` should be directed into a `some_namespace_something_1` table.

func (EventMeta) Scan

func (e EventMeta) Scan(input interface{}) error

func (EventMeta) Value

func (e EventMeta) Value() (driver.Value, error)

type Group

type Group struct {
	Id   *string `json:"id,omitempty"`
	Name *string `json:"name,omitempty"`
}

type JsonbEnvelope

type JsonbEnvelope struct {
	db.BasePKeylessModel
	EventMeta    `json:"event" gorm:"type:jsonb"`
	Pipeline     `json:"pipeline" gorm:"type:jsonb"`
	*Device      `json:"device" gorm:"type:jsonb"`
	*User        `json:"user" gorm:"type:jsonb"`
	*Session     `json:"session" gorm:"type:jsonb"`
	*Web         `json:"web" gorm:"type:jsonb"`
	*Annotations `json:"annotations" gorm:"type:jsonb"`
	*Enrichments `json:"enrichments" gorm:"type:jsonb"`
	Validation   `json:"validation" gorm:"type:jsonb"`
	Contexts     *Contexts `json:"contexts" gorm:"type:jsonb"`
	Payload      Payload   `json:"payload" gorm:"type:jsonb"`
}

type Location

type Location struct {
	Latitude  *float64 `json:"latitude,omitempty"`
	Longitude *float64 `json:"longitude,omitempty"`
	Country   *string  `json:"country,omitempty"`
	Region    *string  `json:"region,omitempty"`
	City      *string  `json:"city,omitempty"`
	Dma       *string  `json:"dma,omitempty"`
}

type Network

type Network struct {
	Bluetooth *bool   `json:"bluetooth,omitempty"`
	Cellular  *bool   `json:"cellular,omitempty"`
	Wifi      *bool   `json:"wifi,omitempty"`
	Carrier   *string `json:"carrier,omitempty"`
}

type Os

type Os struct {
	Name     *string `json:"name,omitempty"`
	Version  *string `json:"version,omitempty"`
	Timezone *string `json:"timezone,omitempty"`
}

type PageAttrs

type PageAttrs struct {
	Url      string                  `json:"url,omitempty"`
	Title    *string                 `json:"title,omitempty"`
	Scheme   string                  `json:"scheme,omitempty"`
	Host     string                  `json:"host,omitempty"`
	Port     string                  `json:"port,omitempty"`
	Path     string                  `json:"path,omitempty"`
	Query    *map[string]interface{} `json:"query,omitempty"`
	Fragment *string                 `json:"fragment,omitempty"`
	Medium   *string                 `json:"medium,omitempty"`
	Source   *string                 `json:"source,omitempty"`
	Term     *string                 `json:"term,omitempty"`
	Content  *string                 `json:"content,omitempty"`
	Campaign *string                 `json:"campaign,omitempty"`
}

type Payload added in v0.13.0

type Payload map[string]interface{}

func (*Payload) AsByte added in v0.13.0

func (p *Payload) AsByte() ([]byte, error)

func (Payload) Scan added in v0.13.0

func (p Payload) Scan(input interface{}) error

func (Payload) Value added in v0.13.0

func (p Payload) Value() (driver.Value, error)

type PayloadValidationError

type PayloadValidationError struct {
	Field       string `json:"field,omitempty"`
	Description string `json:"description,omitempty"`
	ErrorType   string `json:"errorType,omitempty"`
}

type Pipeline

type Pipeline struct {
	Source    `json:"source,omitempty"`
	Collector `json:"collector,omitempty"`
}

func (Pipeline) Scan

func (p Pipeline) Scan(input interface{}) error

func (Pipeline) Value

func (p Pipeline) Value() (driver.Value, error)

type Screen

type Screen struct {
	Resolution *string `json:"screenResolution,omitempty"`
	Width      *int    `json:"screenWidth,omitempty"`
	Height     *int    `json:"screenHeight,omitempty"`
}

type SelfDescribingContext added in v0.13.0

type SelfDescribingContext SelfDescribingPayload

type SelfDescribingEvent added in v0.13.0

type SelfDescribingEvent struct {
	Contexts `json:"contexts"`
	Payload  SelfDescribingPayload `json:"payload"`
}

type SelfDescribingPayload added in v0.13.0

type SelfDescribingPayload struct {
	Schema string                 `json:"schema"`
	Data   map[string]interface{} `json:"data"`
}

func (SelfDescribingPayload) AsByte added in v0.13.0

func (e SelfDescribingPayload) AsByte() ([]byte, error)

func (SelfDescribingPayload) AsMap added in v0.13.0

func (e SelfDescribingPayload) AsMap() (map[string]interface{}, error)

func (SelfDescribingPayload) PayloadAsByte added in v0.13.0

func (e SelfDescribingPayload) PayloadAsByte() ([]byte, error)

func (SelfDescribingPayload) Scan added in v0.13.0

func (e SelfDescribingPayload) Scan(input interface{}) error

func (SelfDescribingPayload) SchemaName added in v0.13.0

func (e SelfDescribingPayload) SchemaName() *string

func (SelfDescribingPayload) Value added in v0.13.0

func (e SelfDescribingPayload) Value() (driver.Value, error)

type Session

type Session struct {
	Id     *string                 `json:"id,omitempty"`
	Idx    *int64                  `json:"idx,omitempty"`
	Traits *map[string]interface{} `json:"traits,omitempty"`
}

func (Session) Scan

func (e Session) Scan(input interface{}) error

func (Session) Value

func (e Session) Value() (driver.Value, error)

type Source

type Source struct {
	GeneratedTstamp *time.Time `json:"generatedTstamp,omitempty"`
	SentTstamp      *time.Time `json:"sentTstamp,omitempty"`
	Name            *string    `json:"name,omitempty"`
	Version         *string    `json:"version,omitempty"`
}

func (Source) Scan

func (s Source) Scan(input interface{}) error

func (Source) Value

func (s Source) Value() (driver.Value, error)

type StringEnvelope

type StringEnvelope struct {
	db.BasePKeylessModel
	EventMeta    `json:"event" gorm:"type:string"`
	Pipeline     `json:"pipeline" gorm:"type:string"`
	*Device      `json:"device" gorm:"type:string"`
	*User        `json:"user" gorm:"type:string"`
	*Session     `json:"session" gorm:"type:string"`
	*Web         `json:"web" gorm:"type:string"`
	*Annotations `json:"annotations" gorm:"type:string"`
	*Enrichments `json:"enrichments" gorm:"type:string"`
	Validation   `json:"validation" gorm:"type:string"`
	Contexts     *Contexts `json:"contexts" gorm:"type:string"`
	Payload      Payload   `json:"payload" gorm:"type:string"`
}

type Team

type Team struct {
	Id   *string `json:"id,omitempty"`
	Name *string `json:"name,omitempty"`
}

type User

type User struct {
	Id          *string                 `json:"id,omitempty"`
	AnonymousId *string                 `json:"anonymousId,omitempty"`
	Fingerprint *string                 `json:"fingerprint,omitempty"`
	Traits      *map[string]interface{} `json:"traits,omitempty"`
}

func (User) Scan

func (e User) Scan(input interface{}) error

func (User) Value

func (e User) Value() (driver.Value, error)

type Validation

type Validation struct {
	IsValid *bool            `json:"isValid"`
	Error   *ValidationError `json:"error,omitempty"`
}

func (Validation) Scan

func (e Validation) Scan(input interface{}) error

func (Validation) Value

func (e Validation) Value() (driver.Value, error)

type ValidationError

type ValidationError struct {
	ErrorType       *string                  `json:"errorType,omitempty"`
	ErrorResolution *string                  `json:"errorResolution,omitempty"`
	Errors          []PayloadValidationError `json:"payloadValidationErrors,omitempty"`
}

func (*ValidationError) Scan

func (e *ValidationError) Scan(input interface{}) error

func (*ValidationError) Value

func (e *ValidationError) Value() (driver.Value, error)

type Web

type Web struct {
	Page     PageAttrs `json:"page"`
	Referrer PageAttrs `json:"referrer"`
}

func (Web) Scan

func (p Web) Scan(input interface{}) error

func (Web) Value

func (p Web) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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