Skip to content

Commit

Permalink
Add event WithTime func option
Browse files Browse the repository at this point in the history
  • Loading branch information
xfrr committed Oct 25, 2024
1 parent d4d897e commit ae3203f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions event/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ func WithAggregate[ID comparable](id ID, name string, version int) NewOption {
}
}

// WithTime sets the event's time to the given value.
func WithTime(t time.Time) NewOption {
return func(e *Base[any, any]) {
e.time = t
}
}

// New creates a new event with the given reason, and payload.
// Returns an event with the given options applied.
// The event's aggregate reference is set to an empty reference if the options are not provided.
Expand Down

0 comments on commit ae3203f

Please sign in to comment.