Documentation
¶
Overview ¶
Package user manages users and tenant membership metadata.
Index ¶
- Variables
- type Member
- type MemoryService
- func (service *MemoryService) AddMember(ctx context.Context, member Member) error
- func (service *MemoryService) CreateUser(ctx context.Context, user User) error
- func (service *MemoryService) GetMember(ctx context.Context, tenantID types.TenantID, userID string) (Member, error)
- func (service *MemoryService) GetUser(ctx context.Context, id string) (User, error)
- func (service *MemoryService) ListMembers(ctx context.Context, tenantID types.TenantID) ([]Member, error)
- func (service *MemoryService) RemoveMember(ctx context.Context, tenantID types.TenantID, userID string) error
- type Service
- type User
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidUser = errors.New("gotenancy/user: invalid user") ErrUserNotFound = errors.New("gotenancy/user: user not found") ErrUserExists = errors.New("gotenancy/user: user already exists") ErrMemberNotFound = errors.New("gotenancy/user: member not found") ErrMemberExists = errors.New("gotenancy/user: member already exists") ErrTenantMismatch = errors.New("gotenancy/user: tenant mismatch") )
Functions ¶
This section is empty.
Types ¶
type MemoryService ¶
type MemoryService struct {
// contains filtered or unexported fields
}
func NewMemoryService ¶
func NewMemoryService() *MemoryService
func (*MemoryService) AddMember ¶
func (service *MemoryService) AddMember(ctx context.Context, member Member) error
func (*MemoryService) CreateUser ¶
func (service *MemoryService) CreateUser(ctx context.Context, user User) error
func (*MemoryService) ListMembers ¶
func (*MemoryService) RemoveMember ¶
type Service ¶
type Service interface {
CreateUser(ctx context.Context, user User) error
GetUser(ctx context.Context, id string) (User, error)
AddMember(ctx context.Context, member Member) error
GetMember(ctx context.Context, tenantID types.TenantID, userID string) (Member, error)
ListMembers(ctx context.Context, tenantID types.TenantID) ([]Member, error)
RemoveMember(ctx context.Context, tenantID types.TenantID, userID string) error
}
Click to show internal directories.
Click to hide internal directories.