Documentation
¶
Overview ¶
types/errors.go
types/stats.go
types/validation.go
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidInput = fmt.Errorf("invalid input") ErrNetworkFailure = fmt.Errorf("network failure") ErrTimeout = fmt.Errorf("operation timed out") ErrNotConnected = fmt.Errorf("not connected") )
Common error types
Functions ¶
This section is empty.
Types ¶
type AuthMethod ¶
type AuthMethod string
AuthMethod represents authentication methods
const ( AuthMethodGoogle AuthMethod = "google" AuthMethodEmail AuthMethod = "email" )
func (AuthMethod) String ¶
func (a AuthMethod) String() string
type Event ¶
type Event struct { ID string UserId string Name EventName // Using EventName type instead of string Properties Properties Timestamp time.Time }
Event represents a tracking event
type EventName ¶
type EventName string
EventName represents a strongly typed event name
const ( // User lifecycle events UserSignedUp EventName = "user_signed_up" UserLoggedIn EventName = "user_logged_in" FeatureUsed EventName = "feature_used" // Revenue & Conversion Events OrderCompleted EventName = "order_completed" SubscriptionStarted EventName = "subscription_started" SubscriptionChanged EventName = "subscription_changed" SubscriptionCanceled EventName = "subscription_canceled" CartViewed EventName = "cart_viewed" CheckoutStarted EventName = "checkout_started" CheckoutCompleted EventName = "checkout_completed" )
Event Types
func (EventName) IsStandardEvent ¶
IsStandardEvent checks if the event name is a known standard event
type GroupInfo ¶
type GroupInfo struct { UserId string GroupId string Properties Properties }
GroupInfo represents a group event
type Identity ¶
type Identity struct { UserId string Properties Properties }
Identity represents a user identification event
type NetworkError ¶
NetworkError represents a network-related error
func (*NetworkError) Error ¶
func (e *NetworkError) Error() string
func (*NetworkError) Is ¶
func (e *NetworkError) Is(target error) bool
Is implements error matching for NetworkError
type PaymentMethod ¶
type PaymentMethod string
PaymentMethod represents payment methods
const (
PaymentMethodCard PaymentMethod = "card"
)
func (PaymentMethod) String ¶
func (p PaymentMethod) String() string
type Properties ¶
type Properties map[string]interface{}
Properties represents a map of property values
type Revenue ¶
type Revenue struct { OrderID string Amount float64 Currency Currency Type RevenueType // Using RevenueType instead of string Products []Product Properties Properties }
Revenue represents a revenue event
type RevenueType ¶
type RevenueType string
Revenue type represents different types of revenue transactions
const ( RevenueTypeSubscription RevenueType = "subscription" RevenueTypeOneTime RevenueType = "one_time" )
type Stats ¶
type Stats struct { EventsInQueue int64 EventsSent int64 EventsFailed int64 ConnectionState string ConnectionUptime time.Duration LastFlushTime time.Time LastFailureTime time.Time AverageBatchSize float64 ActiveEndpoint string // Current endpoint being used ResolvedEndpoints []string // All available endpoints LastDNSResolution time.Time // Last successful DNS resolution DNSFailures int64 // Number of DNS resolution failures }
Stats represents client statistics
type TimeoutError ¶
TimeoutError represents a timeout error
func (*TimeoutError) Error ¶
func (e *TimeoutError) Error() string
func (*TimeoutError) Is ¶
func (e *TimeoutError) Is(target error) bool
Is implements error matching for TimeoutError
type ValidationError ¶
ValidationError represents a validation error
func NewValidationError ¶
func NewValidationError(field, message string) *ValidationError
NewValidationError creates a new validation error
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
func (*ValidationError) Is ¶
func (e *ValidationError) Is(target error) bool
Is implements error matching for ValidationError