fakesegment

package
v1.0.47331 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CompareTrack = cmpopts.IgnoreFields(analytics.Track{}, "MessageId")

	// CompareTime treats timestamps as equal when they are close, because a test
	// cannot know the instant the sender stamped an event or the instant this fake
	// received the batch.
	//
	// The window is deliberately loose. What these assertions are for is "a
	// plausible time was recorded" — that the field was populated at all, from the
	// clock rather than left zero — not sub-second precision. A tight window buys
	// no extra coverage and turns a slow CI box, or a `-race` run under load, into
	// a failure: flushing the batch and delivering it over HTTP is what separates
	// the two times, and that is not bounded by anything the test controls.
	CompareTime = cmpopts.EquateApproxTime(time.Minute)
)

Functions

This section is empty.

Types

type Batch

type Batch struct {
	SentAt   time.Time         `json:"sentAt"`
	Messages []analytics.Track `json:"batch"`
}

type Service

type Service struct {
	http.Handler
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, apiKey string) *Service

func (*Service) Batches

func (s *Service) Batches() []Batch

Jump to

Keyboard shortcuts

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