MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / New

Method New

pkg/events/builder.go:42–60  ·  view source on GitHub ↗
(ctx context.Context, opts ...Option)

Source from the content-addressed store, hash-verified

40}
41
42func (b *builder) New(ctx context.Context, opts ...Option) Event {
43 evt := &event{
44 ctx: ctx,
45 innerEvent: &ttnpb.Event{
46 UniqueId: NewCorrelationID(),
47 Name: b.definition.name,
48 Time: timestamppb.Now(),
49 Origin: hostname,
50 CorrelationIds: CorrelationIDsFromContext(ctx),
51 },
52 }
53 for _, opt := range b.options {
54 opt.applyTo(evt)
55 }
56 for _, opt := range opts {
57 opt.applyTo(evt)
58 }
59 return evt
60}
61
62func (b *builder) NewWithIdentifiersAndData(ctx context.Context, ids EntityIdentifiers, data any) Event {
63 e := local(b.New(ctx))

Callers 1

Calls 4

NewCorrelationIDFunction · 0.85
NowMethod · 0.65
applyToMethod · 0.65

Tested by

no test coverage detected