mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-13 03:24:26 +00:00
append events without return value
This commit is contained in:
parent
f8028f07d0
commit
f6cdcee77a
@ -142,7 +142,7 @@ type reducer interface {
|
||||
// it only appends the newly added events
|
||||
Reduce() error
|
||||
//AppendEvents appends the passed events to an internal list of events
|
||||
AppendEvents(...EventReader) error
|
||||
AppendEvents(...EventReader)
|
||||
}
|
||||
|
||||
//FilterToReducer filters the events based on the search query, appends all events to the reducer and calls it's reduce function
|
||||
@ -151,9 +151,8 @@ func (es *Eventstore) FilterToReducer(ctx context.Context, searchQuery *SearchQu
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err = r.AppendEvents(events...); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
r.AppendEvents(events...)
|
||||
|
||||
return r.Reduce()
|
||||
}
|
||||
@ -180,9 +179,7 @@ func (es *Eventstore) FilterToQueryReducer(ctx context.Context, r queryReducer)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err = r.AppendEvents(events...); err != nil {
|
||||
return err
|
||||
}
|
||||
r.AppendEvents(events...)
|
||||
|
||||
return r.Reduce()
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package eventstore
|
||||
|
||||
import "time"
|
||||
|
||||
func NewWriteModel() *WriteModel {
|
||||
return &WriteModel{
|
||||
Events: []EventReader{},
|
||||
@ -14,6 +16,7 @@ type WriteModel struct {
|
||||
ProcessedSequence uint64 `json:"-"`
|
||||
Events []EventReader `json:"-"`
|
||||
ResourceOwner string `json:"-"`
|
||||
ChangeDate time.Time `json:"-"`
|
||||
}
|
||||
|
||||
//AppendEvents adds all the events to the read model.
|
||||
@ -38,6 +41,7 @@ func (wm *WriteModel) Reduce() error {
|
||||
}
|
||||
|
||||
wm.ProcessedSequence = wm.Events[len(wm.Events)-1].Sequence()
|
||||
wm.ChangeDate = wm.Events[len(wm.Events)-1].CreationDate()
|
||||
|
||||
// all events processed and not needed anymore
|
||||
wm.Events = nil
|
||||
|
@ -60,11 +60,13 @@ func (r *Repository) ChangeIAMMember(ctx context.Context, member *iam_model.IAMM
|
||||
iam := iam_repo.AggregateFromWriteModel(&existingMember.WriteModel.WriteModel).
|
||||
PushMemberChangedFromExisting(ctx, existingMember, member.Roles...)
|
||||
|
||||
_, err = r.eventstore.PushAggregates(ctx, iam)
|
||||
events, err := r.eventstore.PushAggregates(ctx, iam)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
existingMember.AppendEvents(events...)
|
||||
|
||||
updatedMember, err := r.MemberByID(ctx, member.AggregateID, member.UserID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -37,10 +37,8 @@ func (r *Repository) iamByID(ctx context.Context, id string) (_ *iam_repo.ReadMo
|
||||
ctx, span := tracing.NewSpan(ctx)
|
||||
defer func() { span.EndWithError(err) }()
|
||||
|
||||
query := eventstore.NewSearchQueryFactory(eventstore.ColumnsEvent, iam_repo.AggregateType).AggregateIDs(id)
|
||||
|
||||
readModel := new(iam_repo.ReadModel)
|
||||
err = r.eventstore.FilterToReducer(ctx, query, readModel)
|
||||
readModel := iam_repo.NewReadModel(id)
|
||||
err = r.eventstore.FilterToQueryReducer(ctx, readModel)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -52,7 +50,7 @@ func (r *Repository) memberWriteModelByID(ctx context.Context, iamID, userID str
|
||||
ctx, span := tracing.NewSpan(ctx)
|
||||
defer func() { span.EndWithError(err) }()
|
||||
|
||||
writeModel := iam_repo.PrepareMemberWriteModel(iamID, userID)
|
||||
writeModel := iam_repo.NewMemberReadModel(iamID, userID)
|
||||
err = r.eventstore.FilterToQueryReducer(ctx, writeModel)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -18,8 +18,8 @@ const (
|
||||
type Aggregate struct {
|
||||
eventstore.Aggregate
|
||||
|
||||
SetUpStarted Step
|
||||
SetUpDone Step
|
||||
// SetUpStarted Step
|
||||
// SetUpDone Step
|
||||
}
|
||||
|
||||
func NewAggregate(
|
||||
@ -47,9 +47,15 @@ func AggregateFromWriteModel(wm *eventstore.WriteModel) *Aggregate {
|
||||
|
||||
func AggregateFromReadModel(rm *ReadModel) *Aggregate {
|
||||
return &Aggregate{
|
||||
Aggregate: *eventstore.NewAggregate(rm.AggregateID, AggregateType, rm.ResourceOwner, AggregateVersion, rm.ProcessedSequence),
|
||||
SetUpDone: rm.SetUpDone,
|
||||
SetUpStarted: rm.SetUpStarted,
|
||||
Aggregate: *eventstore.NewAggregate(
|
||||
rm.AggregateID,
|
||||
AggregateType,
|
||||
rm.ResourceOwner,
|
||||
AggregateVersion,
|
||||
rm.ProcessedSequence,
|
||||
),
|
||||
// SetUpDone: rm.SetUpDone,
|
||||
// SetUpStarted: rm.SetUpStarted,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ type MemberReadModel struct {
|
||||
member.ReadModel
|
||||
}
|
||||
|
||||
func (rm *MemberReadModel) AppendEvents(events ...eventstore.EventReader) (err error) {
|
||||
func (rm *MemberReadModel) AppendEvents(events ...eventstore.EventReader) {
|
||||
for _, event := range events {
|
||||
switch e := event.(type) {
|
||||
case *MemberAddedEvent:
|
||||
@ -28,20 +28,19 @@ func (rm *MemberReadModel) AppendEvents(events ...eventstore.EventReader) (err e
|
||||
rm.ReadModel.AppendEvents(e)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type MemberWriteModel struct {
|
||||
member.WriteModel
|
||||
}
|
||||
|
||||
func PrepareMemberWriteModel(iamID, userID string) *MemberWriteModel {
|
||||
func NewMemberReadModel(iamID, userID string) *MemberWriteModel {
|
||||
return &MemberWriteModel{
|
||||
WriteModel: *member.PrepareWriteModel(userID, AggregateType, iamID),
|
||||
WriteModel: *member.NewWriteModel(userID, AggregateType, iamID),
|
||||
}
|
||||
}
|
||||
|
||||
func (wm *MemberWriteModel) AppendEvents(events ...eventstore.EventReader) (err error) {
|
||||
func (wm *MemberWriteModel) AppendEvents(events ...eventstore.EventReader) {
|
||||
for _, event := range events {
|
||||
switch e := event.(type) {
|
||||
case *MemberAddedEvent:
|
||||
@ -54,20 +53,12 @@ func (wm *MemberWriteModel) AppendEvents(events ...eventstore.EventReader) (err
|
||||
wm.WriteModel.AppendEvents(e)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type MemberAddedEvent struct {
|
||||
member.AddedEvent
|
||||
}
|
||||
|
||||
type MemberChangedEvent struct {
|
||||
member.ChangedEvent
|
||||
}
|
||||
type MemberRemovedEvent struct {
|
||||
member.RemovedEvent
|
||||
}
|
||||
|
||||
func NewMemberAddedEvent(
|
||||
ctx context.Context,
|
||||
userID string,
|
||||
@ -86,6 +77,10 @@ func NewMemberAddedEvent(
|
||||
}
|
||||
}
|
||||
|
||||
type MemberChangedEvent struct {
|
||||
member.ChangedEvent
|
||||
}
|
||||
|
||||
func MemberChangedEventFromExisting(
|
||||
ctx context.Context,
|
||||
current *MemberWriteModel,
|
||||
@ -127,6 +122,10 @@ func NewMemberChangedEvent(
|
||||
}
|
||||
}
|
||||
|
||||
type MemberRemovedEvent struct {
|
||||
member.RemovedEvent
|
||||
}
|
||||
|
||||
func NewMemberRemovedEvent(
|
||||
ctx context.Context,
|
||||
userID string,
|
||||
|
@ -10,7 +10,7 @@ type MembersReadModel struct {
|
||||
members.ReadModel
|
||||
}
|
||||
|
||||
func (rm *MembersReadModel) AppendEvents(events ...eventstore.EventReader) (err error) {
|
||||
func (rm *MembersReadModel) AppendEvents(events ...eventstore.EventReader) {
|
||||
for _, event := range events {
|
||||
switch e := event.(type) {
|
||||
case *MemberAddedEvent:
|
||||
@ -23,5 +23,4 @@ func (rm *MembersReadModel) AppendEvents(events ...eventstore.EventReader) (err
|
||||
rm.ReadModel.AppendEvents(e)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ var (
|
||||
|
||||
type LabelPolicyReadModel struct{ policy.LabelPolicyReadModel }
|
||||
|
||||
func (rm *LabelPolicyReadModel) AppendEvents(events ...eventstore.EventReader) (err error) {
|
||||
func (rm *LabelPolicyReadModel) AppendEvents(events ...eventstore.EventReader) {
|
||||
for _, event := range events {
|
||||
switch e := event.(type) {
|
||||
case *LabelPolicyAddedEvent:
|
||||
@ -23,7 +23,6 @@ func (rm *LabelPolicyReadModel) AppendEvents(events ...eventstore.EventReader) (
|
||||
rm.ReadModel.AppendEvents(e)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type LabelPolicyAddedEvent struct {
|
||||
|
@ -12,7 +12,7 @@ var (
|
||||
|
||||
type LoginPolicyReadModel struct{ policy.LoginPolicyReadModel }
|
||||
|
||||
func (rm *LoginPolicyReadModel) AppendEvents(events ...eventstore.EventReader) (err error) {
|
||||
func (rm *LoginPolicyReadModel) AppendEvents(events ...eventstore.EventReader) {
|
||||
for _, event := range events {
|
||||
switch e := event.(type) {
|
||||
case *LoginPolicyAddedEvent:
|
||||
@ -23,7 +23,6 @@ func (rm *LoginPolicyReadModel) AppendEvents(events ...eventstore.EventReader) (
|
||||
rm.ReadModel.AppendEvents(e)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type LoginPolicyAddedEvent struct {
|
||||
|
@ -11,7 +11,7 @@ var (
|
||||
|
||||
type OrgIAMPolicyReadModel struct{ policy.OrgIAMPolicyReadModel }
|
||||
|
||||
func (rm *OrgIAMPolicyReadModel) AppendEvents(events ...eventstore.EventReader) (err error) {
|
||||
func (rm *OrgIAMPolicyReadModel) AppendEvents(events ...eventstore.EventReader) {
|
||||
for _, event := range events {
|
||||
switch e := event.(type) {
|
||||
case *OrgIAMPolicyAddedEvent:
|
||||
@ -20,7 +20,6 @@ func (rm *OrgIAMPolicyReadModel) AppendEvents(events ...eventstore.EventReader)
|
||||
rm.ReadModel.AppendEvents(e)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type OrgIAMPolicyAddedEvent struct {
|
||||
|
@ -14,7 +14,7 @@ type PasswordAgePolicyReadModel struct {
|
||||
policy.PasswordAgePolicyReadModel
|
||||
}
|
||||
|
||||
func (rm *PasswordAgePolicyReadModel) AppendEvents(events ...eventstore.EventReader) (err error) {
|
||||
func (rm *PasswordAgePolicyReadModel) AppendEvents(events ...eventstore.EventReader) {
|
||||
for _, event := range events {
|
||||
switch e := event.(type) {
|
||||
case *PasswordAgePolicyAddedEvent:
|
||||
@ -25,7 +25,6 @@ func (rm *PasswordAgePolicyReadModel) AppendEvents(events ...eventstore.EventRea
|
||||
rm.ReadModel.AppendEvents(e)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type PasswordAgePolicyAddedEvent struct {
|
||||
|
@ -14,7 +14,7 @@ type PasswordComplexityPolicyReadModel struct {
|
||||
policy.PasswordComplexityPolicyReadModel
|
||||
}
|
||||
|
||||
func (rm *PasswordComplexityPolicyReadModel) AppendEvents(events ...eventstore.EventReader) (err error) {
|
||||
func (rm *PasswordComplexityPolicyReadModel) AppendEvents(events ...eventstore.EventReader) {
|
||||
for _, event := range events {
|
||||
switch e := event.(type) {
|
||||
case *PasswordComplexityPolicyAddedEvent:
|
||||
@ -25,7 +25,6 @@ func (rm *PasswordComplexityPolicyReadModel) AppendEvents(events ...eventstore.E
|
||||
rm.ReadModel.AppendEvents(e)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type PasswordComplexityPolicyAddedEvent struct {
|
||||
|
@ -14,7 +14,7 @@ type PasswordLockoutPolicyReadModel struct {
|
||||
policy.PasswordLockoutPolicyReadModel
|
||||
}
|
||||
|
||||
func (rm *PasswordLockoutPolicyReadModel) AppendEvents(events ...eventstore.EventReader) (err error) {
|
||||
func (rm *PasswordLockoutPolicyReadModel) AppendEvents(events ...eventstore.EventReader) {
|
||||
for _, event := range events {
|
||||
switch e := event.(type) {
|
||||
case *PasswordLockoutPolicyAddedEvent:
|
||||
@ -25,7 +25,6 @@ func (rm *PasswordLockoutPolicyReadModel) AppendEvents(events ...eventstore.Even
|
||||
rm.ReadModel.AppendEvents(e)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type PasswordLockoutPolicyAddedEvent struct {
|
||||
|
@ -25,7 +25,15 @@ type ReadModel struct {
|
||||
DefaultPasswordLockoutPolicy PasswordLockoutPolicyReadModel
|
||||
}
|
||||
|
||||
func (rm *ReadModel) AppendEvents(events ...eventstore.EventReader) (err error) {
|
||||
func NewReadModel(id string) *ReadModel {
|
||||
return &ReadModel{
|
||||
ReadModel: eventstore.ReadModel{
|
||||
AggregateID: id,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (rm *ReadModel) AppendEvents(events ...eventstore.EventReader) {
|
||||
rm.ReadModel.AppendEvents(events...)
|
||||
for _, event := range events {
|
||||
switch event.(type) {
|
||||
@ -45,7 +53,6 @@ func (rm *ReadModel) AppendEvents(events ...eventstore.EventReader) (err error)
|
||||
rm.DefaultPasswordLockoutPolicy.AppendEvents(event)
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (rm *ReadModel) Reduce() (err error) {
|
||||
@ -87,3 +94,7 @@ func (rm *ReadModel) AppendAndReduce(events ...eventstore.EventReader) error {
|
||||
}
|
||||
return rm.Reduce()
|
||||
}
|
||||
|
||||
func (rm *ReadModel) Query() *eventstore.SearchQueryFactory {
|
||||
return eventstore.NewSearchQueryFactory(eventstore.ColumnsEvent, AggregateType).AggregateIDs(rm.AggregateID)
|
||||
}
|
||||
|
@ -27,10 +27,8 @@ type ConfigReadModel struct {
|
||||
OIDCConfig *oidc.ConfigReadModel
|
||||
}
|
||||
|
||||
func (rm *ConfigReadModel) AppendEvents(events ...eventstore.EventReader) error {
|
||||
func (rm *ConfigReadModel) AppendEvents(events ...eventstore.EventReader) {
|
||||
rm.ReadModel.AppendEvents(events...)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (rm *ConfigReadModel) Reduce() error {
|
||||
|
@ -18,8 +18,8 @@ type ConfigReadModel struct {
|
||||
UsernameMapping MappingField
|
||||
}
|
||||
|
||||
func (rm *ConfigReadModel) AppendEvents(events ...eventstore.EventReader) error {
|
||||
return nil
|
||||
func (rm *ConfigReadModel) AppendEvents(events ...eventstore.EventReader) {
|
||||
rm.ReadModel.AppendEvents(events...)
|
||||
}
|
||||
|
||||
func (rm *ConfigReadModel) Reduce() error {
|
||||
|
@ -37,10 +37,7 @@ func ChangeEventFromExisting(
|
||||
roles ...string,
|
||||
) (*ChangedEvent, error) {
|
||||
|
||||
change := &ChangedEvent{
|
||||
BaseEvent: *base,
|
||||
UserID: current.UserID,
|
||||
}
|
||||
change := NewChangedEvent(base, current.userID)
|
||||
|
||||
sort.Strings(current.Roles)
|
||||
sort.Strings(roles)
|
||||
|
@ -17,7 +17,7 @@ type WriteModel struct {
|
||||
aggregateID string
|
||||
}
|
||||
|
||||
func PrepareWriteModel(
|
||||
func NewWriteModel(
|
||||
userID string,
|
||||
aggregateType eventstore.AggregateType,
|
||||
aggregateID string,
|
||||
|
@ -27,7 +27,7 @@ func (rm *ReadModel) MemberByUserID(id string) (idx int, member *member.ReadMode
|
||||
return -1, nil
|
||||
}
|
||||
|
||||
func (rm *ReadModel) AppendEvents(events ...eventstore.EventReader) (err error) {
|
||||
func (rm *ReadModel) AppendEvents(events ...eventstore.EventReader) {
|
||||
for _, event := range events {
|
||||
switch e := event.(type) {
|
||||
case *member.AddedEvent:
|
||||
@ -40,14 +40,13 @@ func (rm *ReadModel) AppendEvents(events ...eventstore.EventReader) (err error)
|
||||
case *member.RemovedEvent:
|
||||
idx, _ := rm.MemberByUserID(e.UserID)
|
||||
if idx < 0 {
|
||||
return nil
|
||||
continue
|
||||
}
|
||||
copy(rm.Members[idx:], rm.Members[idx+1:])
|
||||
rm.Members[len(rm.Members)-1] = nil
|
||||
rm.Members = rm.Members[:len(rm.Members)-1]
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (rm *ReadModel) Reduce() (err error) {
|
||||
|
@ -35,7 +35,7 @@ type MembersReadModel struct {
|
||||
members.ReadModel
|
||||
}
|
||||
|
||||
func (rm *MembersReadModel) AppendEvents(events ...eventstore.EventReader) (err error) {
|
||||
func (rm *MembersReadModel) AppendEvents(events ...eventstore.EventReader) {
|
||||
for _, event := range events {
|
||||
switch e := event.(type) {
|
||||
case *MemberAddedEvent:
|
||||
@ -46,12 +46,11 @@ func (rm *MembersReadModel) AppendEvents(events ...eventstore.EventReader) (err
|
||||
rm.ReadModel.AppendEvents(&e.RemovedEvent)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type MemberReadModel member.ReadModel
|
||||
|
||||
func (rm *MemberReadModel) AppendEvents(events ...eventstore.EventReader) (err error) {
|
||||
func (rm *MemberReadModel) AppendEvents(events ...eventstore.EventReader) {
|
||||
for _, event := range events {
|
||||
switch e := event.(type) {
|
||||
case *MemberAddedEvent:
|
||||
@ -60,7 +59,6 @@ func (rm *MemberReadModel) AppendEvents(events ...eventstore.EventReader) (err e
|
||||
rm.ReadModel.AppendEvents(&e.ChangedEvent)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type MemberAddedEvent struct {
|
||||
|
@ -12,7 +12,7 @@ var (
|
||||
|
||||
type LabelPolicyReadModel struct{ policy.LabelPolicyReadModel }
|
||||
|
||||
func (rm *LabelPolicyReadModel) AppendEvents(events ...eventstore.EventReader) (err error) {
|
||||
func (rm *LabelPolicyReadModel) AppendEvents(events ...eventstore.EventReader) {
|
||||
for _, event := range events {
|
||||
switch e := event.(type) {
|
||||
case *LabelPolicyAddedEvent:
|
||||
@ -23,7 +23,6 @@ func (rm *LabelPolicyReadModel) AppendEvents(events ...eventstore.EventReader) (
|
||||
rm.ReadModel.AppendEvents(e)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type LabelPolicyAddedEvent struct {
|
||||
|
@ -12,7 +12,7 @@ var (
|
||||
|
||||
type LoginPolicyReadModel struct{ policy.LoginPolicyReadModel }
|
||||
|
||||
func (rm *LoginPolicyReadModel) AppendEvents(events ...eventstore.EventReader) (err error) {
|
||||
func (rm *LoginPolicyReadModel) AppendEvents(events ...eventstore.EventReader) {
|
||||
for _, event := range events {
|
||||
switch e := event.(type) {
|
||||
case *LoginPolicyAddedEvent:
|
||||
@ -23,7 +23,6 @@ func (rm *LoginPolicyReadModel) AppendEvents(events ...eventstore.EventReader) (
|
||||
rm.ReadModel.AppendEvents(e)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type LoginPolicyAddedEvent struct {
|
||||
|
@ -11,7 +11,7 @@ var (
|
||||
|
||||
type OrgIAMPolicyReadModel struct{ policy.OrgIAMPolicyReadModel }
|
||||
|
||||
func (rm *OrgIAMPolicyReadModel) AppendEvents(events ...eventstore.EventReader) (err error) {
|
||||
func (rm *OrgIAMPolicyReadModel) AppendEvents(events ...eventstore.EventReader) {
|
||||
for _, event := range events {
|
||||
switch e := event.(type) {
|
||||
case *OrgIAMPolicyAddedEvent:
|
||||
@ -20,7 +20,6 @@ func (rm *OrgIAMPolicyReadModel) AppendEvents(events ...eventstore.EventReader)
|
||||
rm.ReadModel.AppendEvents(e)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type OrgIAMPolicyAddedEvent struct {
|
||||
|
@ -14,7 +14,7 @@ type PasswordAgePolicyReadModel struct {
|
||||
policy.PasswordAgePolicyReadModel
|
||||
}
|
||||
|
||||
func (rm *PasswordAgePolicyReadModel) AppendEvents(events ...eventstore.EventReader) (err error) {
|
||||
func (rm *PasswordAgePolicyReadModel) AppendEvents(events ...eventstore.EventReader) {
|
||||
for _, event := range events {
|
||||
switch e := event.(type) {
|
||||
case *PasswordAgePolicyAddedEvent:
|
||||
@ -25,7 +25,6 @@ func (rm *PasswordAgePolicyReadModel) AppendEvents(events ...eventstore.EventRea
|
||||
rm.ReadModel.AppendEvents(e)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type PasswordAgePolicyAddedEvent struct {
|
||||
|
@ -14,7 +14,7 @@ type PasswordComplexityPolicyReadModel struct {
|
||||
policy.PasswordComplexityPolicyReadModel
|
||||
}
|
||||
|
||||
func (rm *PasswordComplexityPolicyReadModel) AppendEvents(events ...eventstore.EventReader) (err error) {
|
||||
func (rm *PasswordComplexityPolicyReadModel) AppendEvents(events ...eventstore.EventReader) {
|
||||
for _, event := range events {
|
||||
switch e := event.(type) {
|
||||
case *PasswordComplexityPolicyAddedEvent:
|
||||
@ -25,7 +25,6 @@ func (rm *PasswordComplexityPolicyReadModel) AppendEvents(events ...eventstore.E
|
||||
rm.ReadModel.AppendEvents(e)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type PasswordComplexityPolicyAddedEvent struct {
|
||||
|
@ -14,7 +14,7 @@ type PasswordLockoutPolicyReadModel struct {
|
||||
policy.PasswordLockoutPolicyReadModel
|
||||
}
|
||||
|
||||
func (rm *PasswordLockoutPolicyReadModel) AppendEvents(events ...eventstore.EventReader) (err error) {
|
||||
func (rm *PasswordLockoutPolicyReadModel) AppendEvents(events ...eventstore.EventReader) {
|
||||
for _, event := range events {
|
||||
switch e := event.(type) {
|
||||
case *PasswordLockoutPolicyAddedEvent:
|
||||
@ -25,7 +25,6 @@ func (rm *PasswordLockoutPolicyReadModel) AppendEvents(events ...eventstore.Even
|
||||
rm.ReadModel.AppendEvents(e)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type PasswordLockoutPolicyAddedEvent struct {
|
||||
|
@ -17,9 +17,8 @@ type IAM struct {
|
||||
// TODO: how to implement queries?
|
||||
}
|
||||
|
||||
func (rm *IAM) AppendEvents(events ...eventstore.EventReader) (err error) {
|
||||
func (rm *IAM) AppendEvents(events ...eventstore.EventReader) {
|
||||
rm.ReadModel.AppendEvents(events...)
|
||||
return err
|
||||
}
|
||||
|
||||
//Reduce implements eventstore.ReadModel
|
||||
|
Loading…
Reference in New Issue
Block a user