Documentation
¶
Index ¶
- Constants
- Variables
- func NewContextWithPrincipal(ctx context.Context, p *Principal) context.Context
- func Slugify(input string) string
- type Account
- func (a *Account) Init(firstName, lastName, email string, password HashedPassword) error
- func (a *Account) InitAsRoot(email string, password HashedPassword, firstName, lastName string) error
- func (a *Account) Link(id PersonID, linkAs AccountLink, linkedBy *Operator, clubID ClubID) error
- func (a *Account) Query() eventing.JournalQuery
- func (a *Account) Reduce(events []*eventing.JournalEvent)
- func (a *Account) VerifyPassword(password string, verifier PasswordVerifier) (bool, error)
- type AccountCreatedEvent
- func (r *AccountCreatedEvent) AcceptCrypto(transformer eventing.CryptoTransformer) error
- func (r *AccountCreatedEvent) DeclareOwners() []eventing.AggregateID
- func (r *AccountCreatedEvent) IsShredded() bool
- func (r *AccountCreatedEvent) LookupValues() eventing.LookupMap
- func (r *AccountCreatedEvent) UniqueConstraintsToAdd() []eventing.UniqueConstraint
- type AccountID
- type AccountLink
- type AccountLinkedPerson
- type AccountLinkedToPersonEvent
- type AccountRepository
- type AccountState
- type Club
- type ClubCreatedEvent
- type ClubID
- type ClubRepository
- type ClubState
- type EventSourcedAccountRepository
- func (e *EventSourcedAccountRepository) ExistsByEmail(ctx context.Context, email string) (bool, error)
- func (e *EventSourcedAccountRepository) FindByEmail(ctx context.Context, email string) (*Account, error)
- func (e *EventSourcedAccountRepository) FindByID(ctx context.Context, id AccountID) (*Account, error)
- func (e *EventSourcedAccountRepository) Save(ctx context.Context, account *Account) error
- type EventSourcedClubRepository
- func (e *EventSourcedClubRepository) ExistsByID(ctx context.Context, id ClubID) (bool, error)
- func (e *EventSourcedClubRepository) ExistsByName(ctx context.Context, name string) (bool, error)
- func (e *EventSourcedClubRepository) FindByID(ctx context.Context, id ClubID) (*Club, error)
- func (e *EventSourcedClubRepository) Save(ctx context.Context, club *Club) error
- type EventSourcedPersonRepository
- type EventSourcedSessionRepository
- func (e *EventSourcedSessionRepository) FindByID(ctx context.Context, id SessionID) (*Session, error)
- func (e *EventSourcedSessionRepository) FindByToken(ctx context.Context, token SessionToken) (*Session, error)
- func (e *EventSourcedSessionRepository) Save(ctx context.Context, session *Session) error
- type EventSourcedTeamMemberRepository
- func (e *EventSourcedTeamMemberRepository) FindByID(ctx context.Context, id TeamMemberID) (*TeamMember, error)
- func (e *EventSourcedTeamMemberRepository) FindByTeamAndPerson(ctx context.Context, teamID TeamID, personID PersonID) (*TeamMember, error)
- func (e *EventSourcedTeamMemberRepository) Save(ctx context.Context, member *TeamMember) error
- type EventSourcedTeamRepository
- func (e *EventSourcedTeamRepository) ExistsByID(ctx context.Context, id TeamID) (bool, error)
- func (e *EventSourcedTeamRepository) ExistsByName(ctx context.Context, name string) (bool, error)
- func (e *EventSourcedTeamRepository) FindByID(ctx context.Context, id TeamID) (*Team, error)
- func (e *EventSourcedTeamRepository) Save(ctx context.Context, team *Team) error
- type HashedPassword
- type InvalidAggregateStateError
- type Operator
- type PasswordVerifier
- type PasswordVerifierFunc
- type PendingLink
- type Person
- func (p *Person) Claim(token PersonLinkToken, id AccountID) error
- func (p *Person) FindPendingLink(token PersonLinkToken) (PendingLink, error)
- func (p *Person) Init(firstName, lastName string, birthdate time.Time, creator Operator, ...)
- func (p *Person) InitiateNewLink(operator Operator, linkAs AccountLink, token PersonLinkToken, ...) error
- func (p *Person) Query() eventing.JournalQuery
- func (p *Person) Reduce(events []*eventing.JournalEvent)
- type PersonCreatedEvent
- type PersonID
- type PersonInvitedToTeamEvent
- type PersonLinkClaimedEvent
- type PersonLinkInitiatedEvent
- type PersonLinkToken
- type PersonLinkedAccount
- type PersonRepository
- type PersonState
- type Principal
- type PrincipalRole
- type Repositories
- type RootAccountCreatedEvent
- type Session
- type SessionCreatedEvent
- type SessionID
- type SessionRepository
- type SessionState
- type SessionToken
- type Team
- type TeamCreatedEvent
- type TeamDeletedEvent
- type TeamID
- type TeamMember
- type TeamMemberID
- type TeamMemberRepository
- type TeamMemberRoleRole
- type TeamMemberState
- type TeamRepository
- type TeamState
Constants ¶
const ( AccountAggregateType = eventing.AggregateType("account") AccountEmailUniqueConstraint = "account_email" AccountLookupEmail = "account_email" )
const ( AccountCreatedEventType = eventing.EventType("account_created") AccountCreatedEventVersion = eventing.EventVersion("v1") )
const ( AccountLinkedToPersonEventType = eventing.EventType("account_linked_to_person") AccountLinkedToPersonEventVersion = eventing.EventVersion("v1") )
const ( RootAccountCreatedEventType = eventing.EventType("root_account_created") RootAccountCreatedEventVersion = eventing.EventVersion("v1") )
const ( ClubAggregateType = eventing.AggregateType("club") ClubNameUniqueConstraint = "club_name" ClubSlugUniqueConstraint = "club_slug" ClubLookupSlug = "slug" ClubLookupName = "name" )
const ( ClubCreatedEventType = eventing.EventType("club_created") ClubCreatedEventVersion = eventing.EventVersion("v1") )
const ( PersonAggregateType = eventing.AggregateType("person") PersonMaxPendingLinks = 5 )
const ( PersonCreatedEventType = eventing.EventType("person_created") PersonCreatedEventVersion = eventing.EventVersion("v1") )
const ( PersonLinkClaimedEventType = eventing.EventType("person_link_claimed") PersonLinkClaimedEventVersion = eventing.EventVersion("v1") )
const ( PersonLinkInitiatedEventType = eventing.EventType("person_link_initiated") PersonLinkInitiatedEventVersion = eventing.EventVersion("v1") )
const ( SessionAggregateType = eventing.AggregateType("session") // SessionLookupToken is the key used to look up a session by the session token. SessionLookupToken = "session_token" SessionIDUniqueConstraint = "session_id" )
const ( SessionCreatedEventType = eventing.EventType("session_created") SessionCreatedEventVersion = eventing.EventVersion("v1") )
const ( TeamAggregateType = eventing.AggregateType("team") TeamNameUniqueConstraint = "team_name" TeamSlugUniqueConstraint = "team_slug" TeamLookupSlug = eventing.LookupFieldName("slug") TeamLookupName = eventing.LookupFieldName("name") TeamLookupOwningClub = eventing.LookupFieldName("owning_club") )
const ( TeamCreatedEventType = eventing.EventType("team_created") TeamCreatedEventVersion = eventing.EventVersion("v1") )
const ( TeamDeletedEventType = eventing.EventType("team_deleted") TeamDeletedEventVersion = eventing.EventVersion("v1") )
const ( TeamMemberAggregateType = eventing.AggregateType("team_member") // TeamMembershipUniqueConstraint guarantees that a person with a given ID cannot be added twice to a team. TeamMembershipUniqueConstraint = "team_membership" // TeamMembershipLookup allows looking up the owner ID of a membership by team ID + person ID. TeamMembershipLookup = "team_membership" )
const ( PersonInvitedToTeamEventType = eventing.EventType("person_invited_to_team") PersonInvitedToTeamEventVersion = eventing.EventVersion("v1") )
const RedactedString = "**********"
RedactedString is used when an event was crypto shredded, and we need a placeholder value.
Variables ¶
var ( ErrAccountNotFound = errors.New("account not found") ErrRootAccountAlreadyInitialized = errors.New("root account already initialized") ErrWrongCredentials = errors.New("wrong credentials") ErrAccountAlreadyLinkedToPerson = errors.New("already linked to person") ErrAccountAlreadyHasSelfLink = errors.New("already has self link") )
var ( PersonMaxBirthdate = time.Now() PersonMinBirthdate = time.Date(1900, 1, 1, 0, 0, 0, 0, time.UTC) ErrOwningClubNotFound = errors.New("owning club not found") ErrPersonNotFound = errors.New("person not found") ErrPersonAlreadySelfLinked = errors.New("person already self linked") ErrPersonHasTooManyPendingLinks = errors.New("too many pending links for person") ErrPersonInvalidLinkToken = errors.New("invalid link token") ErrPersonLinkTokenExpired = errors.New("link token has expired") )
var ( ErrPrincipalNotFound = errors.New("principal not found") ErrUnauthenticated = errors.New("unauthenticated") ErrMissingSubject = errors.New("the subject of the action was not specified") )
var ( ErrTeamOwningClubNotFound = errors.New("owning club not found") ErrTeamNotFound = errors.New("team not found") )
var (
ErrSessionNotFound = errors.New("session not found")
)
var (
ErrTeamMemberNotFound = errors.New("team member not found")
)
Functions ¶
func NewContextWithPrincipal ¶
NewContextWithPrincipal adds the Principal to the context.
Types ¶
type Account ¶
type Account struct { eventing.BaseWriter State AccountState ID AccountID FirstName string LastName string LinkedPersons []*AccountLinkedPerson Password HashedPassword // IsRoot specifies if this the base service account. IsRoot bool }
func NewAccount ¶
func (*Account) Init ¶
func (a *Account) Init(firstName, lastName, email string, password HashedPassword) error
func (*Account) InitAsRoot ¶
func (a *Account) InitAsRoot(email string, password HashedPassword, firstName, lastName string) error
func (*Account) Query ¶
func (a *Account) Query() eventing.JournalQuery
func (*Account) Reduce ¶
func (a *Account) Reduce(events []*eventing.JournalEvent)
func (*Account) VerifyPassword ¶
func (a *Account) VerifyPassword(password string, verifier PasswordVerifier) (bool, error)
type AccountCreatedEvent ¶
type AccountCreatedEvent struct { *eventing.EventBase FirstName eventing.EncryptedString `json:"first_name"` LastName eventing.EncryptedString `json:"last_name"` Email eventing.EncryptedString `json:"email"` HashedPassword eventing.EncryptedString `json:"hashed_password"` }
func NewAccountCreatedEvent ¶
func NewAccountCreatedEvent(id AccountID, firstName, lastName, email string, hashedPassword HashedPassword) *AccountCreatedEvent
func (*AccountCreatedEvent) AcceptCrypto ¶
func (r *AccountCreatedEvent) AcceptCrypto(transformer eventing.CryptoTransformer) error
func (*AccountCreatedEvent) DeclareOwners ¶
func (r *AccountCreatedEvent) DeclareOwners() []eventing.AggregateID
func (*AccountCreatedEvent) IsShredded ¶
func (r *AccountCreatedEvent) IsShredded() bool
func (*AccountCreatedEvent) LookupValues ¶
func (r *AccountCreatedEvent) LookupValues() eventing.LookupMap
func (*AccountCreatedEvent) UniqueConstraintsToAdd ¶
func (r *AccountCreatedEvent) UniqueConstraintsToAdd() []eventing.UniqueConstraint
type AccountLink ¶
type AccountLink string
const ( AccountLinkParent AccountLink = "parent" AccountLinkSelf AccountLink = "self" )
type AccountLinkedPerson ¶
type AccountLinkedPerson struct { ID PersonID LinkedAs AccountLink // Only set if someone other than themselves linked the person. LinkedBy *Operator }
type AccountLinkedToPersonEvent ¶
type AccountLinkedToPersonEvent struct { *eventing.EventBase PersonID PersonID `json:"person_id"` LinkedAs AccountLink `json:"linked_as"` LinkedBy *Operator `json:"linked_by"` OwningClubID ClubID `json:"owning_club_id"` }
func NewAccountLinkedToPersonEvent ¶
func NewAccountLinkedToPersonEvent(id AccountID, personID PersonID, linkAs AccountLink, linkedBy *Operator, clubID ClubID) *AccountLinkedToPersonEvent
func (*AccountLinkedToPersonEvent) IsShredded ¶
func (l *AccountLinkedToPersonEvent) IsShredded() bool
type AccountRepository ¶
type AccountState ¶
type AccountState int
const ( AccountStateUnspecified AccountState = iota AccountStateActive )
type Club ¶
func (*Club) Query ¶
func (a *Club) Query() eventing.JournalQuery
func (*Club) Reduce ¶
func (a *Club) Reduce(events []*eventing.JournalEvent)
type ClubCreatedEvent ¶
type ClubCreatedEvent struct { *eventing.EventBase Name string `json:"name"` Slug string `json:"slug"` }
func NewClubCreatedEvent ¶
func NewClubCreatedEvent(clubID ClubID, name, slug string) *ClubCreatedEvent
func (*ClubCreatedEvent) IsShredded ¶
func (e *ClubCreatedEvent) IsShredded() bool
func (*ClubCreatedEvent) LookupValues ¶
func (e *ClubCreatedEvent) LookupValues() eventing.LookupMap
func (*ClubCreatedEvent) UniqueConstraintsToAdd ¶
func (e *ClubCreatedEvent) UniqueConstraintsToAdd() []eventing.UniqueConstraint
type ClubRepository ¶
type EventSourcedAccountRepository ¶
type EventSourcedAccountRepository struct {
// contains filtered or unexported fields
}
func NewEventSourcedAccountRepository ¶
func NewEventSourcedAccountRepository(es eventing.EventStore) *EventSourcedAccountRepository
func (*EventSourcedAccountRepository) ExistsByEmail ¶
func (*EventSourcedAccountRepository) FindByEmail ¶
type EventSourcedClubRepository ¶
type EventSourcedClubRepository struct {
// contains filtered or unexported fields
}
func NewEventSourcedClubRepository ¶
func NewEventSourcedClubRepository(es eventing.EventStore) *EventSourcedClubRepository
func (*EventSourcedClubRepository) ExistsByID ¶
func (*EventSourcedClubRepository) ExistsByName ¶
type EventSourcedPersonRepository ¶
type EventSourcedPersonRepository struct {
// contains filtered or unexported fields
}
func NewEventSourcedPersonRepository ¶
func NewEventSourcedPersonRepository(es eventing.EventStore) *EventSourcedPersonRepository
func (*EventSourcedPersonRepository) ExistsByID ¶
type EventSourcedSessionRepository ¶
type EventSourcedSessionRepository struct {
// contains filtered or unexported fields
}
func NewEventSourcedSessionRepository ¶
func NewEventSourcedSessionRepository(es eventing.EventStore) *EventSourcedSessionRepository
func (*EventSourcedSessionRepository) FindByToken ¶
func (e *EventSourcedSessionRepository) FindByToken(ctx context.Context, token SessionToken) (*Session, error)
type EventSourcedTeamMemberRepository ¶
type EventSourcedTeamMemberRepository struct {
// contains filtered or unexported fields
}
func NewEventSourcedTeamMemberRepository ¶
func NewEventSourcedTeamMemberRepository(es eventing.EventStore) *EventSourcedTeamMemberRepository
func (*EventSourcedTeamMemberRepository) FindByID ¶
func (e *EventSourcedTeamMemberRepository) FindByID(ctx context.Context, id TeamMemberID) (*TeamMember, error)
func (*EventSourcedTeamMemberRepository) FindByTeamAndPerson ¶
func (e *EventSourcedTeamMemberRepository) FindByTeamAndPerson(ctx context.Context, teamID TeamID, personID PersonID) (*TeamMember, error)
func (*EventSourcedTeamMemberRepository) Save ¶
func (e *EventSourcedTeamMemberRepository) Save(ctx context.Context, member *TeamMember) error
type EventSourcedTeamRepository ¶
type EventSourcedTeamRepository struct {
// contains filtered or unexported fields
}
func NewEventSourcedTeamRepository ¶
func NewEventSourcedTeamRepository(es eventing.EventStore) *EventSourcedTeamRepository
func (*EventSourcedTeamRepository) ExistsByID ¶
func (*EventSourcedTeamRepository) ExistsByName ¶
type HashedPassword ¶
type HashedPassword string
func Argon2idHashPassword ¶
func Argon2idHashPassword(password string) (HashedPassword, error)
Argon2idHashPassword hashes a password using Argon2id.
type InvalidAggregateStateError ¶
type InvalidAggregateStateError struct { Aggregate *eventing.Aggregate ExpectedState int ActualState int }
func NewInvalidAggregateStateError ¶
func NewInvalidAggregateStateError(aggregate *eventing.Aggregate, expectedState, actualState int) *InvalidAggregateStateError
func (InvalidAggregateStateError) Error ¶
func (e InvalidAggregateStateError) Error() string
type Operator ¶
type Operator struct { ActorID AccountID `json:"actor_id"` // OnBehalfOf is only set if the operator is acting on behalf of another person. // E.g., the system admin is not associated with a person. OnBehalfOf *PersonID `json:"on_behalf_of"` }
Operator is a value object that specifies who operated an event.
func NewOperator ¶
NewOperator creates a new Operator.
type PasswordVerifier ¶
type PasswordVerifier interface {
Verify(password string, hashed HashedPassword) (bool, error)
}
PasswordVerifier compares a password with a hashed password.
type PasswordVerifierFunc ¶
type PasswordVerifierFunc func(password string, hashed HashedPassword) (bool, error)
var Argon2idVerifyPassword PasswordVerifierFunc = argon2idVerifyPassword
Argon2idVerifyPassword implements PasswordVerifier.
func (PasswordVerifierFunc) Verify ¶
func (f PasswordVerifierFunc) Verify(password string, hashed HashedPassword) (bool, error)
type PendingLink ¶
type PendingLink struct { LinkAs AccountLink Token PersonLinkToken ExpiresAt time.Time }
type Person ¶
type Person struct { eventing.BaseWriter ID PersonID Firstname string Lastname string Birthdate time.Time State PersonState OwningClubID ClubID LinkedAccounts []PersonLinkedAccount PendingLinks map[PersonLinkToken]PendingLink Creator Operator CreatedAt time.Time UpdatedAt time.Time }
func (*Person) FindPendingLink ¶
func (p *Person) FindPendingLink(token PersonLinkToken) (PendingLink, error)
func (*Person) InitiateNewLink ¶
func (p *Person) InitiateNewLink(operator Operator, linkAs AccountLink, token PersonLinkToken, expiresAt time.Time) error
func (*Person) Query ¶
func (p *Person) Query() eventing.JournalQuery
func (*Person) Reduce ¶
func (p *Person) Reduce(events []*eventing.JournalEvent)
type PersonCreatedEvent ¶
type PersonCreatedEvent struct { *eventing.EventBase FirstName eventing.EncryptedString `json:"firstname"` LastName eventing.EncryptedString `json:"lastname"` Birthdate eventing.EncryptedString `json:"birthdate"` Creator Operator `json:"creator"` OwningClubID ClubID `json:"owning_club_id"` }
func NewPersonCreatedEvent ¶
func (*PersonCreatedEvent) AcceptCrypto ¶
func (p *PersonCreatedEvent) AcceptCrypto(transformer eventing.CryptoTransformer) error
func (*PersonCreatedEvent) DeclareOwners ¶
func (p *PersonCreatedEvent) DeclareOwners() []eventing.AggregateID
func (*PersonCreatedEvent) IsShredded ¶
func (p *PersonCreatedEvent) IsShredded() bool
type PersonInvitedToTeamEvent ¶
type PersonInvitedToTeamEvent struct { *eventing.EventBase TeamID TeamID `json:"team_id"` PersonID PersonID `json:"person_id"` AssignedRole TeamMemberRoleRole `json:"assigned_role"` InvitedBy Operator `json:"invited_by"` }
func NewPersonInvitedToTeamEvent ¶
func NewPersonInvitedToTeamEvent(id TeamMemberID, personID PersonID, teamID TeamID, invitedBy Operator, assignedRole TeamMemberRoleRole) *PersonInvitedToTeamEvent
func (*PersonInvitedToTeamEvent) IsShredded ¶
func (p *PersonInvitedToTeamEvent) IsShredded() bool
func (*PersonInvitedToTeamEvent) LookupValues ¶
func (p *PersonInvitedToTeamEvent) LookupValues() eventing.LookupMap
func (*PersonInvitedToTeamEvent) UniqueConstraintsToAdd ¶
func (p *PersonInvitedToTeamEvent) UniqueConstraintsToAdd() []eventing.UniqueConstraint
type PersonLinkClaimedEvent ¶
type PersonLinkClaimedEvent struct { *eventing.EventBase AccountID AccountID `json:"account_id"` LinkedAs AccountLink `json:"linked_as"` UsedToken PersonLinkToken `json:"used_token"` }
func NewPersonLinkClaimedEvent ¶
func NewPersonLinkClaimedEvent(id PersonID, accountID AccountID, as AccountLink, usedToken PersonLinkToken) *PersonLinkClaimedEvent
func (*PersonLinkClaimedEvent) IsShredded ¶
func (l *PersonLinkClaimedEvent) IsShredded() bool
type PersonLinkInitiatedEvent ¶
type PersonLinkInitiatedEvent struct { *eventing.EventBase LinkAs AccountLink `json:"link_as"` Token PersonLinkToken `json:"token"` ExpiresAt time.Time `json:"expires_at"` InvitedBy Operator `json:"invited_by"` }
func NewPersonLinkInitiatedEvent ¶
func NewPersonLinkInitiatedEvent(id PersonID, invitedBy Operator, linkAs AccountLink, token PersonLinkToken, expiresAt time.Time) *PersonLinkInitiatedEvent
func (*PersonLinkInitiatedEvent) IsShredded ¶
func (l *PersonLinkInitiatedEvent) IsShredded() bool
type PersonLinkToken ¶
type PersonLinkToken string
type PersonLinkedAccount ¶
type PersonLinkedAccount struct { AccountID AccountID LinkedAs AccountLink LinkedAt time.Time }
type PersonRepository ¶
type PersonState ¶
type PersonState int
const ( PersonStateUnspecified PersonState = iota PersonStateActive )
type Principal ¶
type Principal struct { AccountID AccountID SessionToken SessionToken Role PrincipalRole }
Principal is the authenticated principal of a request.
func NewPrincipal ¶
func NewPrincipal(accountID AccountID, sessionToken SessionToken, role PrincipalRole) *Principal
type PrincipalRole ¶
type PrincipalRole int
PrincipalRole specifies the type of principal that is accessing the system.
const ( PrincipalRoleUnspecified PrincipalRole = iota // PrincipalRoleRoot is allowed to skip subject verification. PrincipalRoleRoot // PrincipalRoleRegular will always require subject verification is necessary. PrincipalRoleRegular )
type Repositories ¶
type Repositories interface { Account() AccountRepository Club() ClubRepository Person() PersonRepository Session() SessionRepository Team() TeamRepository TeamMember() TeamMemberRepository }
type RootAccountCreatedEvent ¶
type RootAccountCreatedEvent struct { *eventing.EventBase Email string `json:"email"` HashedPassword HashedPassword `json:"hashed_password"` FirstName string `json:"first_name"` LastName string `json:"last_name"` }
func NewRootAccountCreatedEvent ¶
func NewRootAccountCreatedEvent(id AccountID, email string, hashedPassword HashedPassword, firstName, lastName string) *RootAccountCreatedEvent
func (*RootAccountCreatedEvent) IsShredded ¶
func (r *RootAccountCreatedEvent) IsShredded() bool
func (*RootAccountCreatedEvent) LookupValues ¶
func (r *RootAccountCreatedEvent) LookupValues() eventing.LookupMap
func (*RootAccountCreatedEvent) UniqueConstraintsToAdd ¶
func (r *RootAccountCreatedEvent) UniqueConstraintsToAdd() []eventing.UniqueConstraint
type Session ¶
type Session struct { eventing.BaseWriter State SessionState ID SessionID AccountID AccountID Role PrincipalRole Token SessionToken }
func NewSession ¶
func (*Session) Init ¶
func (s *Session) Init( token SessionToken, accountID AccountID, userAgent, ipAddress string, validUntil time.Time, role PrincipalRole, ) error
func (*Session) Query ¶
func (s *Session) Query() eventing.JournalQuery
func (*Session) Reduce ¶
func (s *Session) Reduce(events []*eventing.JournalEvent)
type SessionCreatedEvent ¶
type SessionCreatedEvent struct { *eventing.EventBase Token SessionToken `json:"token"` AccountID AccountID `json:"account_id"` UserAgent string `json:"user_agent"` IPAddress string `json:"ip_address"` ValidUntil time.Time `json:"valid_until"` Role PrincipalRole `json:"role"` }
func NewSessionCreatedEvent ¶
func NewSessionCreatedEvent( id SessionID, token SessionToken, accountID AccountID, userAgent, ipAddress string, validUntil time.Time, role PrincipalRole, ) *SessionCreatedEvent
func (*SessionCreatedEvent) IsShredded ¶
func (c *SessionCreatedEvent) IsShredded() bool
func (*SessionCreatedEvent) LookupValues ¶
func (c *SessionCreatedEvent) LookupValues() eventing.LookupMap
func (*SessionCreatedEvent) UniqueConstraintsToAdd ¶
func (c *SessionCreatedEvent) UniqueConstraintsToAdd() []eventing.UniqueConstraint
type SessionID ¶
type SessionID string
SessionID is the unique identifier for a session, distributed to the client.
type SessionRepository ¶
type SessionState ¶
type SessionState int
const ( SessionStateUnspecified SessionState = iota SessionStateActive )
type SessionToken ¶
type SessionToken string
type Team ¶
type Team struct { eventing.BaseWriter ID TeamID Name string Slug string OwningClubID ClubID CreatedAt time.Time CreatedBy Operator UpdatedAt time.Time State TeamState }
func (*Team) Query ¶
func (t *Team) Query() eventing.JournalQuery
func (*Team) Reduce ¶
func (t *Team) Reduce(events []*eventing.JournalEvent)
type TeamCreatedEvent ¶
type TeamCreatedEvent struct { *eventing.EventBase Name string `json:"name"` Slug string `json:"slug"` CreatedBy Operator `json:"created_by"` OwningClubID ClubID `json:"club_id"` }
func NewTeamCreatedEvent ¶
func NewTeamCreatedEvent(id TeamID, name, slug string, owningClubID ClubID, createdBy Operator) *TeamCreatedEvent
func (*TeamCreatedEvent) IsShredded ¶
func (t *TeamCreatedEvent) IsShredded() bool
func (*TeamCreatedEvent) LookupValues ¶
func (t *TeamCreatedEvent) LookupValues() eventing.LookupMap
func (*TeamCreatedEvent) UniqueConstraintsToAdd ¶
func (t *TeamCreatedEvent) UniqueConstraintsToAdd() []eventing.UniqueConstraint
type TeamDeletedEvent ¶
type TeamDeletedEvent struct { *eventing.EventBase OwningClubID ClubID `json:"owning_club_id"` DeletedBy Operator `json:"deleted_by"` }
func NewTeamDeletedEvent ¶
func NewTeamDeletedEvent(id TeamID, owningClubID ClubID, deletedBy Operator) *TeamDeletedEvent
func (*TeamDeletedEvent) IsShredded ¶
func (t *TeamDeletedEvent) IsShredded() bool
func (*TeamDeletedEvent) LookupRemoves ¶
func (t *TeamDeletedEvent) LookupRemoves() []eventing.LookupFieldName
func (*TeamDeletedEvent) UniqueConstraintsToRemove ¶
func (t *TeamDeletedEvent) UniqueConstraintsToRemove() []eventing.UniqueConstraint
type TeamMember ¶
type TeamMember struct { eventing.BaseWriter State TeamMemberState ID TeamMemberID PersonID PersonID TeamID TeamID InvitedBy Operator JoinedAt time.Time }
func NewTeamMember ¶
func NewTeamMember(id TeamMemberID, teamID TeamID, personID PersonID) *TeamMember
func NewTeamMemberByID ¶
func NewTeamMemberByID(id TeamMemberID) *TeamMember
func (*TeamMember) Invite ¶
func (m *TeamMember) Invite(operator Operator, assignedRole TeamMemberRoleRole) error
func (*TeamMember) Query ¶
func (m *TeamMember) Query() eventing.JournalQuery
func (*TeamMember) Reduce ¶
func (m *TeamMember) Reduce(events []*eventing.JournalEvent)
type TeamMemberID ¶
type TeamMemberID string
type TeamMemberRepository ¶
type TeamMemberRepository interface { FindByID(ctx context.Context, id TeamMemberID) (*TeamMember, error) FindByTeamAndPerson(ctx context.Context, teamID TeamID, person PersonID) (*TeamMember, error) Save(ctx context.Context, member *TeamMember) error }
type TeamMemberRoleRole ¶
type TeamMemberRoleRole string
TeamMemberRoleRole is the function of the team member (e.g. coach, player, etc.).
type TeamMemberState ¶
type TeamMemberState int
const ( TeamMemberStateUnspecified TeamMemberState = iota TeamMemberStateActive )
type TeamRepository ¶
Source Files
¶
- account.go
- account_events.go
- account_repo.go
- club.go
- club_events.go
- club_repo.go
- domain.go
- error.go
- operator.go
- password.go
- person.go
- person_events.go
- person_repo.go
- principal.go
- repositories.go
- session.go
- session_events.go
- session_repo.go
- slug.go
- team.go
- team_events.go
- team_repo.go
- teammember.go
- teammember_events.go
- teammember_repo.go