Documentation
¶
Index ¶
- Variables
- func AccountToGraphQL(acc *Account) *exmodels.Account
- func UserListFilterMapper(fl *exmodels.UserListFilter) user.QOption
- func UserListOrderMapper(ord *exmodels.UserListOrder) user.QOption
- func UserToGraphQL(u *User) *exmodels.User
- func UserToGraphQLPtr(u *User) *exmodels.User
- type Account
- func AccountFromProfile(approve pkgModels.ApproveStatus, ...) *Account
- func AccountStub(id uint64) *Account
- func AccountStubWithAdmins(id uint64, adminUserIDs ...uint64) *Account
- func FillAccountFromCreateInput(dest *Account, input *exmodels.AccountCreateInput, ...) *Account
- func FillAccountFromInputWithStatus(dest *Account, inp *exmodels.AccountUpdateInput, ...) *Account
- func FillAccountFromUpdateInput(dest *Account, input *exmodels.AccountUpdateInput, ...) *Account
- type AccountGraphQLMappers
- type AccountGraphQLMappersImpl
- func (AccountGraphQLMappersImpl) FromCreateInput(inp *exmodels.AccountCreateInput) *Account
- func (AccountGraphQLMappersImpl) FromFilter(f *exmodels.AccountListFilter) accountrepo.QOption
- func (AccountGraphQLMappersImpl) FromOrder(o *exmodels.AccountListOrder) accountrepo.QOption
- func (AccountGraphQLMappersImpl) FromUpdateInput(inp *exmodels.AccountUpdateInput, dest *Account) *Account
- func (AccountGraphQLMappersImpl) New() *Account
- func (AccountGraphQLMappersImpl) NewPayload(clientMutationID string, accountID uint64, account *exmodels.Account) *exmodels.AccountPayload
- func (AccountGraphQLMappersImpl) ToGQL(a *Account) *exmodels.Account
- type AccountMember
- type AccountProfile
- func (p *AccountProfile) ApplyProfile(title, description, logoURI, policyURI, tosURI, clientURI string, ...)
- func (p *AccountProfile) GetClientURI() string
- func (p *AccountProfile) GetContacts() []string
- func (p *AccountProfile) GetDescription() string
- func (p *AccountProfile) GetLogoURI() string
- func (p *AccountProfile) GetPolicyURI() string
- func (p *AccountProfile) GetTermsOfServiceURI() string
- func (p *AccountProfile) GetTitle() string
- type User
- type UserGraphQLMappers
- type UserGraphQLMappersImpl
- func (UserGraphQLMappersImpl) FromCreateInput(inp *exmodels.UserCreateInput) *User
- func (UserGraphQLMappersImpl) FromFilter(f *exmodels.UserListFilter) userrepo.QOption
- func (UserGraphQLMappersImpl) FromOrder(o *exmodels.UserListOrder) userrepo.QOption
- func (UserGraphQLMappersImpl) FromUpdateInput(inp *exmodels.UserUpdateInput, dest *User) *User
- func (UserGraphQLMappersImpl) New() *User
- func (UserGraphQLMappersImpl) NewPayload(clientMutationID string, userID uint64, u *exmodels.User) *exmodels.UserPayload
- func (UserGraphQLMappersImpl) ToAccountGQL(u *User) *exmodels.User
- func (UserGraphQLMappersImpl) ToGQL(u *User) *exmodels.User
Constants ¶
This section is empty.
Variables ¶
var Anonymous = User{UserBase: userModels.UserBase{ID: 0}}
Anonymous is the example anonymous session user placeholder.
Functions ¶
func AccountToGraphQL ¶
AccountToGraphQL maps example domain Account to extended GraphQL Account.
func UserListFilterMapper ¶
func UserListFilterMapper(fl *exmodels.UserListFilter) user.QOption
UserListFilterMapper converts extended user list filter to domain query option.
func UserListOrderMapper ¶
func UserListOrderMapper(ord *exmodels.UserListOrder) user.QOption
UserListOrderMapper converts extended user list order to domain query option.
func UserToGraphQL ¶
UserToGraphQL maps example domain User to base GraphQL User.
func UserToGraphQLPtr ¶
UserToGraphQLPtr maps example domain User to base GraphQL User pointer (account/member payloads).
Types ¶
type Account ¶
type Account struct {
accountModels.AccountBase
AccountProfile
}
Account is the bundled default for example/api: Base + consumer profile trait.
func AccountFromProfile ¶
func AccountFromProfile(approve pkgModels.ApproveStatus, title, description, logoURI, policyURI, tosURI, clientURI string, contacts []string) *Account
AccountFromProfile builds account from profile/base fields.
func AccountStub ¶
AccountStub returns account with only ID set (ACL/GraphQL placeholders).
func AccountStubWithAdmins ¶
AccountStubWithAdmins returns account stub with admin user IDs.
func FillAccountFromCreateInput ¶
func FillAccountFromCreateInput(dest *Account, input *exmodels.AccountCreateInput, appStatus ...pkgModels.ApproveStatus) *Account
FillAccountFromCreateInput copies account create input into domain Account.
func FillAccountFromInputWithStatus ¶
func FillAccountFromInputWithStatus(dest *Account, inp *exmodels.AccountUpdateInput, appStatus ...pkgModels.ApproveStatus) *Account
FillAccountFromInputWithStatus is a helper for wiring account repos that need an approve-status override. Used internally by account graphql wiring.
func FillAccountFromUpdateInput ¶
func FillAccountFromUpdateInput(dest *Account, input *exmodels.AccountUpdateInput, appStatus ...pkgModels.ApproveStatus) *Account
FillAccountFromUpdateInput applies account update input to a domain Account.
func (*Account) NewWithIDs ¶
NewWithIDs returns a new account instance with ID and admin user IDs set.
func (*Account) RBACResourceName ¶
RBACResourceName is nil-safe.
type AccountGraphQLMappers ¶
type AccountGraphQLMappers[T accountrepo.Model, TGQLAccount any] = accountgraphql.AccountGraphQLMappers[ T, TGQLAccount, *exmodels.AccountPayload, *exmodels.AccountCreateInput, *exmodels.AccountUpdateInput, *exmodels.AccountListFilter, *exmodels.AccountListOrder, *exmodels.User, ]
AccountGraphQLMappers is the 2-param consumer alias for example/api. It pins the 4 concrete types (create input, update input, filter, order) so callers need only supply T (domain account) and TGQLAccount (GraphQL account type).
type AccountGraphQLMappersImpl ¶
type AccountGraphQLMappersImpl struct{}
AccountGraphQLMappersImpl implements AccountGraphQLMappers for example/api. All methods delegate to the free functions in domain/graphql.go. Instantiate with AccountGraphQLMappersImpl{} — stateless.
func (AccountGraphQLMappersImpl) FromCreateInput ¶
func (AccountGraphQLMappersImpl) FromCreateInput(inp *exmodels.AccountCreateInput) *Account
FromCreateInput builds a new domain Account from a create-account account input.
func (AccountGraphQLMappersImpl) FromFilter ¶
func (AccountGraphQLMappersImpl) FromFilter(f *exmodels.AccountListFilter) accountrepo.QOption
FromFilter converts the extended GraphQL account list filter to a domain QOption.
func (AccountGraphQLMappersImpl) FromOrder ¶
func (AccountGraphQLMappersImpl) FromOrder(o *exmodels.AccountListOrder) accountrepo.QOption
FromOrder converts the extended GraphQL account list order to a domain QOption.
func (AccountGraphQLMappersImpl) FromUpdateInput ¶
func (AccountGraphQLMappersImpl) FromUpdateInput(inp *exmodels.AccountUpdateInput, dest *Account) *Account
FromUpdateInput merges an update mutation input into an existing domain Account. AccountUpdateInput carries only the approval status; profile edits use a separate mutation.
func (AccountGraphQLMappersImpl) New ¶
func (AccountGraphQLMappersImpl) New() *Account
New creates a new empty domain Account.
func (AccountGraphQLMappersImpl) NewPayload ¶
func (AccountGraphQLMappersImpl) NewPayload(clientMutationID string, accountID uint64, account *exmodels.Account) *exmodels.AccountPayload
NewPayload builds account payload from parts.
type AccountMember ¶
AccountMember is the bundled member type for example/api.
type AccountProfile ¶
type AccountProfile struct {
Title string `json:"title"`
Description string `json:"description"`
LogoURI string `json:"logo_uri" gorm:"column:logo_uri"`
PolicyURI string `json:"policy_uri" gorm:"column:policy_uri"`
TermsOfServiceURI string `json:"tos_uri" gorm:"column:tos_uri"`
ClientURI string `json:"client_uri" gorm:"column:client_uri"`
Contacts gosql.NullableStringArray `json:"contacts" gorm:"column:contacts;type:text[]"`
}
AccountProfile is example/api profile metadata (consumer-defined per project).
func (*AccountProfile) ApplyProfile ¶
func (p *AccountProfile) ApplyProfile(title, description, logoURI, policyURI, tosURI, clientURI string, contacts []string)
ApplyProfile sets profile fields from input values.
func (*AccountProfile) GetClientURI ¶
func (p *AccountProfile) GetClientURI() string
GetClientURI returns client URI.
func (*AccountProfile) GetContacts ¶
func (p *AccountProfile) GetContacts() []string
GetContacts returns contact list.
func (*AccountProfile) GetDescription ¶
func (p *AccountProfile) GetDescription() string
GetDescription returns account description.
func (*AccountProfile) GetLogoURI ¶
func (p *AccountProfile) GetLogoURI() string
GetLogoURI returns logo URI.
func (*AccountProfile) GetPolicyURI ¶
func (p *AccountProfile) GetPolicyURI() string
GetPolicyURI returns policy URI.
func (*AccountProfile) GetTermsOfServiceURI ¶
func (p *AccountProfile) GetTermsOfServiceURI() string
GetTermsOfServiceURI returns terms of service URI.
func (*AccountProfile) GetTitle ¶
func (p *AccountProfile) GetTitle() string
GetTitle returns account title.
type User ¶
type User struct {
userModels.UserBase
userModels.UserEmail
userModels.UserPassword
}
User is the example consumer user model (Base + Email + Password traits).
func UserFromCreateInput ¶
func UserFromCreateInput(input *exmodels.UserCreateInput, appStatus ...pkgModels.ApproveStatus) *User
UserFromCreateInput builds a new domain User from GraphQL create input.
func UserFromUpdateInput ¶
func UserFromUpdateInput(input *exmodels.UserUpdateInput, dest *User, appStatus ...pkgModels.ApproveStatus) *User
FillUserFromInput merges GraphQL update input into an existing domain User.
type UserGraphQLMappers ¶
type UserGraphQLMappers[T userrepo.Model, TGQLUser any] = usergraphql.UserGraphQLMappers[ T, TGQLUser, *exmodels.UserCreateInput, *exmodels.UserUpdateInput, *exmodels.UserPayload, *exmodels.UserListFilter, *exmodels.UserListOrder, ]
UserGraphQLMappers is the 2-param consumer alias for example/api. It pins the 5 concrete types (create input, update input, payload, filter, order) so callers need only supply T (domain user) and TGQLUser (GraphQL user type).
m := domain.UserGraphQLMappersImpl{}
resolver := resolvers.NewUserResolver[*domain.User](uc, m)
type UserGraphQLMappersImpl ¶
type UserGraphQLMappersImpl struct{}
UserGraphQLMappersImpl implements UserGraphQLMappers for example/api. All methods delegate to the free functions in domain/graphql.go. Instantiate with UserGraphQLMappersImpl{} — stateless.
func (UserGraphQLMappersImpl) FromCreateInput ¶
func (UserGraphQLMappersImpl) FromCreateInput(inp *exmodels.UserCreateInput) *User
FromCreateInput builds a new domain User from a create mutation input.
func (UserGraphQLMappersImpl) FromFilter ¶
func (UserGraphQLMappersImpl) FromFilter(f *exmodels.UserListFilter) userrepo.QOption
FromFilter converts the extended GraphQL user list filter to a domain QOption.
func (UserGraphQLMappersImpl) FromOrder ¶
func (UserGraphQLMappersImpl) FromOrder(o *exmodels.UserListOrder) userrepo.QOption
FromOrder converts the extended GraphQL user list order to a domain QOption.
func (UserGraphQLMappersImpl) FromUpdateInput ¶
func (UserGraphQLMappersImpl) FromUpdateInput(inp *exmodels.UserUpdateInput, dest *User) *User
FromUpdateInput merges an update mutation input into an existing domain User.
func (UserGraphQLMappersImpl) New ¶
func (UserGraphQLMappersImpl) New() *User
New creates a new empty domain User.
func (UserGraphQLMappersImpl) NewPayload ¶
func (UserGraphQLMappersImpl) NewPayload(clientMutationID string, userID uint64, u *exmodels.User) *exmodels.UserPayload
NewPayload wraps a GQL User in the mutation payload type.
func (UserGraphQLMappersImpl) ToAccountGQL ¶
func (UserGraphQLMappersImpl) ToAccountGQL(u *User) *exmodels.User
ToAccountGQL converts a domain User to the account-facing GQL user type.