chore: move the go code into a subfolder

This commit is contained in:
Florian Forster
2025-08-05 15:20:32 -07:00
parent 4ad22ba456
commit cd2921de26
2978 changed files with 373 additions and 300 deletions

View File

@@ -0,0 +1,57 @@
package projection
import (
"github.com/zitadel/zitadel/internal/v2/eventstore"
"github.com/zitadel/zitadel/internal/v2/org"
)
type OrgPrimaryDomain struct {
projection
id string
Domain string
}
func NewOrgPrimaryDomain(id string) *OrgPrimaryDomain {
return &OrgPrimaryDomain{
id: id,
}
}
func (p *OrgPrimaryDomain) Filter() []*eventstore.Filter {
return []*eventstore.Filter{
eventstore.NewFilter(
eventstore.FilterPagination(
eventstore.GlobalPositionGreater(&p.position),
),
eventstore.AppendAggregateFilter(
org.AggregateType,
eventstore.AggregateIDs(p.id),
eventstore.AppendEvent(
eventstore.SetEventTypes(org.DomainPrimarySetType),
),
),
),
}
}
func (p *OrgPrimaryDomain) Reduce(events ...*eventstore.StorageEvent) error {
for _, event := range events {
if !p.shouldReduce(event) {
continue
}
if event.Type != org.DomainPrimarySetType {
continue
}
e, err := org.DomainPrimarySetEventFromStorage(event)
if err != nil {
return err
}
p.Domain = e.Payload.Name
p.projection.reduce(event)
}
return nil
}