:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package events
import (
json "encoding/json"
easyjson "github.com/mailru/easyjson"
jlexer "github.com/mailru/easyjson/jlexer"
jwriter "github.com/mailru/easyjson/jwriter"
)
// suppress unused package warning
var (
_ *json.RawMessage
_ *jlexer.Lexer
_ *jwriter.Writer
_ easyjson.Marshaler
)
func easyjsonB70d1354DecodeGithubComPosthogPosthogLivestreamEvents(in *jlexer.Lexer, out *PostHogEventWrapper) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "uuid":
out.Uuid = string(in.String())
case "distinct_id":
(out.DistinctId).UnmarshalEasyJSON(in)
case "ip":
out.Ip = string(in.String())
case "data":
out.Data = string(in.String())
case "token":
out.Token = string(in.String())
case "timestamp":
out.Timestamp = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonB70d1354EncodeGithubComPosthogPosthogLivestreamEvents(out *jwriter.Writer, in PostHogEventWrapper) {
out.RawByte('{')
first := true
_ = first
{
const prefix string = ",\"uuid\":"
out.RawString(prefix[1:])
out.String(string(in.Uuid))
}
{
const prefix string = ",\"distinct_id\":"
out.RawString(prefix)
(in.DistinctId).MarshalEasyJSON(out)
}
{
const prefix string = ",\"ip\":"
out.RawString(prefix)
out.String(string(in.Ip))
}
{
const prefix string = ",\"data\":"
out.RawString(prefix)
out.String(string(in.Data))
}
{
const prefix string = ",\"token\":"
out.RawString(prefix)
out.String(string(in.Token))
}
{
const prefix string = ",\"timestamp\":"
out.RawString(prefix)
out.String(string(in.Timestamp))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v PostHogEventWrapper) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonB70d1354EncodeGithubComPosthogPosthogLivestreamEvents(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v PostHogEventWrapper) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonB70d1354EncodeGithubComPosthogPosthogLivestreamEvents(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *PostHogEventWrapper) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonB70d1354DecodeGithubComPosthogPosthogLivestreamEvents(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *PostHogEventWrapper) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonB70d1354DecodeGithubComPosthogPosthogLivestreamEvents(l, v)
}
func easyjsonB70d1354DecodeGithubComPosthogPosthogLivestreamEvents1(in *jlexer.Lexer, out *PostHogEvent) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeFieldName(false)
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "api_key":
out.Token = string(in.String())
case "event":
out.Event = string(in.String())
case "properties":
if in.IsNull() {
in.Skip()
} else {
in.Delim('{')
out.Properties = make(map[string]interface{})
for !in.IsDelim('}') {
key := string(in.String())
in.WantColon()
var v1 interface{}
if m, ok := v1.(easyjson.Unmarshaler); ok {
m.UnmarshalEasyJSON(in)
} else if m, ok := v1.(json.Unmarshaler); ok {
_ = m.UnmarshalJSON(in.Raw())
} else {
v1 = in.Interface()
}
(out.Properties)[key] = v1
in.WantComma()
}
in.Delim('}')
}
case "timestamp":
if m, ok := out.Timestamp.(easyjson.Unmarshaler); ok {
m.UnmarshalEasyJSON(in)
} else if m, ok := out.Timestamp.(json.Unmarshaler); ok {
_ = m.UnmarshalJSON(in.Raw())
} else {
out.Timestamp = in.Interface()
}
case "Uuid":
out.Uuid = string(in.String())
case "DistinctId":
out.DistinctId = string(in.String())
case "Lat":
out.Lat = float64(in.Float64())
case "Lng":
out.Lng = float64(in.Float64())
case "CountryCode":
out.CountryCode = string(in.String())
case "IsBot":
out.IsBot = bool(in.Bool())
case "TrafficType":
out.TrafficType = string(in.String())
case "TrafficCategory":
out.TrafficCategory = string(in.String())
case "BotName":
out.BotName = string(in.String())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonB70d1354EncodeGithubComPosthogPosthogLivestreamEvents1(out *jwriter.Writer, in PostHogEvent) {
out.RawByte('{')
first := true
_ = first
if in.Token != "" {
const prefix string = ",\"api_key\":"
first = false
out.RawString(prefix[1:])
out.String(string(in.Token))
}
{
const prefix string = ",\"event\":"
if first {
first = false
out.RawString(prefix[1:])
} else {
out.RawString(prefix)
}
out.String(string(in.Event))
}
{
const prefix string = ",\"properties\":"
out.RawString(prefix)
if in.Properties == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 {
out.RawString(`null`)
} else {
out.RawByte('{')
v2First := true
for v2Name, v2Value := range in.Properties {
if v2First {
v2First = false
} else {
out.RawByte(',')
}
out.String(string(v2Name))
out.RawByte(':')
if m, ok := v2Value.(easyjson.Marshaler); ok {
m.MarshalEasyJSON(out)
} else if m, ok := v2Value.(json.Marshaler); ok {
out.Raw(m.MarshalJSON())
} else {
out.Raw(json.Marshal(v2Value))
}
}
out.RawByte('}')
}
}
if in.Timestamp != nil {
const prefix string = ",\"timestamp\":"
out.RawString(prefix)
if m, ok := in.Timestamp.(easyjson.Marshaler); ok {
m.MarshalEasyJSON(out)
} else if m, ok := in.Timestamp.(json.Marshaler); ok {
out.Raw(m.MarshalJSON())
} else {
out.Raw(json.Marshal(in.Timestamp))
}
}
{
const prefix string = ",\"Uuid\":"
out.RawString(prefix)
out.String(string(in.Uuid))
}
{
const prefix string = ",\"DistinctId\":"
out.RawString(prefix)
out.String(string(in.DistinctId))
}
{
const prefix string = ",\"Lat\":"
out.RawString(prefix)
out.Float64(float64(in.Lat))
}
{
const prefix string = ",\"Lng\":"
out.RawString(prefix)
out.Float64(float64(in.Lng))
}
{
const prefix string = ",\"CountryCode\":"
out.RawString(prefix)
out.String(string(in.CountryCode))
}
{
const prefix string = ",\"IsBot\":"
out.RawString(prefix)
out.Bool(bool(in.IsBot))
}
{
const prefix string = ",\"TrafficType\":"
out.RawString(prefix)
out.String(string(in.TrafficType))
}
{
const prefix string = ",\"TrafficCategory\":"
out.RawString(prefix)
out.String(string(in.TrafficCategory))
}
{
const prefix string = ",\"BotName\":"
out.RawString(prefix)
out.String(string(in.BotName))
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v PostHogEvent) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonB70d1354EncodeGithubComPosthogPosthogLivestreamEvents1(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v PostHogEvent) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonB70d1354EncodeGithubComPosthogPosthogLivestreamEvents1(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *PostHogEvent) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonB70d1354DecodeGithubComPosthogPosthogLivestreamEvents1(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *PostHogEvent) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonB70d1354DecodeGithubComPosthogPosthogLivestreamEvents1(l, v)
}