Documentation
¶
Index ¶
- type APIKey
- type APIKeyFake
- type AccountMapping
- type AccountMappingFake
- type App
- type AppFake
- type ChangeLog
- type ChangeLogFake
- type ErrAliasNotFound
- type ErrEntryExists
- type ErrEntryNotFound
- type FeatureToggle
- type FeatureToggleFake
- type SSOMap
- type SSOMapFake
- type ShortLink
- type ShortLinkFake
- func (s *ShortLinkFake) CreateShortLink(shortLinkInput entity.ShortLinkInput) error
- func (s ShortLinkFake) DeleteShortLink(alias string) error
- func (s ShortLinkFake) GetShortLinkByAlias(alias string) (entity.ShortLink, error)
- func (s ShortLinkFake) GetShortLinksByAliases(aliases []string) ([]entity.ShortLink, error)
- func (s ShortLinkFake) IsAliasExist(alias string) (bool, error)
- func (s ShortLinkFake) UpdateShortLink(oldAlias string, shortLinkInput entity.ShortLinkInput) (entity.ShortLink, error)
- type User
- type UserChangeLog
- type UserChangeLogFake
- type UserFake
- func (u *UserFake) CreateUser(user entity.User) error
- func (u UserFake) GetUserByEmail(email string) (entity.User, error)
- func (u UserFake) GetUserByID(id string) (entity.User, error)
- func (u UserFake) IsEmailExist(email string) (bool, error)
- func (u UserFake) IsIDExist(id string) (bool, error)
- func (u UserFake) IsUserIDExist(userID string) bool
- type UserRole
- type UserRoleFake
- type UserShortLink
- type UserShortLinkFake
- func (u *UserShortLinkFake) CreateRelation(user entity.User, shortLinkInput entity.ShortLinkInput) error
- func (u UserShortLinkFake) FindAliasesByUser(user entity.User) ([]string, error)
- func (u UserShortLinkFake) HasMapping(user entity.User, alias string) (bool, error)
- func (u *UserShortLinkFake) UpdateAliasCascade(oldAlias string, shortLinkInput entity.ShortLinkInput) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIKey ¶
type APIKey interface { GetAPIKey(appID string, key string) (entity.APIKey, error) CreateAPIKey(input entity.APIKeyInput) (entity.APIKey, error) }
APIKey accesses API keys for third party apps from persistent storage, such as database.
type APIKeyFake ¶
type APIKeyFake struct {
// contains filtered or unexported fields
}
APIKeyFake represents in memory implementation of APIKey repository
func NewAPIKeyFake ¶
func NewAPIKeyFake(apiKeys []entity.APIKey) APIKeyFake
NewAPIKeyFake creates in memory implementation of APIKey repository.
func (*APIKeyFake) CreateAPIKey ¶
func (a *APIKeyFake) CreateAPIKey(input entity.APIKeyInput) (entity.APIKey, error)
CreateAPIKey creates an api key for a given app.
type AccountMapping ¶
type AccountMapping interface { IsSSOUserExist(ssoUser entity.SSOUser) (bool, error) CreateMapping(ssoUser entity.SSOUser, user entity.User) error }
AccountMapping accesses account mapping between SSOUser and internal User from storage media, such as database.
type AccountMappingFake ¶
type AccountMappingFake struct {
// contains filtered or unexported fields
}
AccountMappingFake represents in memory implementation of AccountMapping repository.
func NewAccountMappingFake ¶
func NewAccountMappingFake( ssoUsers []entity.SSOUser, users []entity.User) (AccountMappingFake, error)
NewAccountMappingFake creates in memory implementation of AccountMapping repository.
func (*AccountMappingFake) CreateMapping ¶
CreateMapping links an external user with an internal user.
func (AccountMappingFake) IsRelationExist ¶
IsRelationExist checks whether a given external user is linked to a given internal user.
func (AccountMappingFake) IsSSOUserExist ¶
func (a AccountMappingFake) IsSSOUserExist(ssoUser entity.SSOUser) (bool, error)
IsSSOUserExist checks whether a external user is linked to any internal user.
type AppFake ¶
type AppFake struct {
// contains filtered or unexported fields
}
AppFake represents in memory implementation of App repository
func NewAppFake ¶
NewAppFake create in-memory implementation of App repository.
type ChangeLog ¶
type ChangeLog interface { GetChangeLog() ([]entity.Change, error) CreateChange(newChange entity.Change) (entity.Change, error) DeleteChange(id string) error UpdateChange(newChange entity.Change) (entity.Change, error) }
ChangeLog accesses changelog from storage, such as database.
type ChangeLogFake ¶
type ChangeLogFake struct {
// contains filtered or unexported fields
}
ChangeLogFake represents in memory implementation of ChangeLog repository
func NewChangeLogFake ¶
func NewChangeLogFake(changeLog []entity.Change) ChangeLogFake
NewChangeLogFake creates ChangeLogFake
func (*ChangeLogFake) CreateChange ¶
CreateChange creates and persists new Change in the repository
func (*ChangeLogFake) DeleteChange ¶
func (c *ChangeLogFake) DeleteChange(id string) error
DeleteChange removes a change based on a given id
func (ChangeLogFake) GetChangeLog ¶
func (c ChangeLogFake) GetChangeLog() ([]entity.Change, error)
GetChangeLog fetches full ChangeLog from memory
func (*ChangeLogFake) UpdateChange ¶
UpdateChange replaces an existing change having given id with updated attributes.
type ErrAliasNotFound ¶
type ErrAliasNotFound struct {
Alias string
}
ErrAliasNotFound represents no short link entry found with the given alias.
func (ErrAliasNotFound) Error ¶
func (e ErrAliasNotFound) Error() string
type ErrEntryExists ¶
type ErrEntryExists string
ErrEntryExists represents table entry already exists error.
func (ErrEntryExists) Error ¶
func (e ErrEntryExists) Error() string
Error coverts ErrEntryExists into human readable message to easy debugging.
type ErrEntryNotFound ¶
type ErrEntryNotFound string
ErrEntryNotFound represents table entry not found error.
func (ErrEntryNotFound) Error ¶
func (e ErrEntryNotFound) Error() string
Error coverts ErrEntryNotFound into human readable message to easy debugging.
type FeatureToggle ¶
FeatureToggle accesses feature toggle from storage, such as database.
type FeatureToggleFake ¶
type FeatureToggleFake struct {
// contains filtered or unexported fields
}
FeatureToggleFake represents in-memory implementation of FeatureToggle repository.
func NewFeatureToggleFake ¶
func NewFeatureToggleFake(toggles map[string]entity.Toggle) FeatureToggleFake
NewFeatureToggleFake creates fake feature toggle repository.
func (FeatureToggleFake) FindToggleByID ¶
func (f FeatureToggleFake) FindToggleByID(id string) (entity.Toggle, error)
FindToggleByID fetches Toggle with given ID.
type SSOMap ¶
type SSOMap interface { IsSSOUserExist(ssoUserID string) (bool, error) GetShortUserID(ssoUserID string) (string, error) CreateMapping(sshUserID string, shortUserID string) error }
SSOMap accesses account mapping between SSOUser and internal User from storage media, such as database.
type SSOMapFake ¶
type SSOMapFake struct {
// contains filtered or unexported fields
}
SSOMapFake represents in memory implementation of SSOMap repository.
func NewsSSOMapFake ¶
func NewsSSOMapFake( ssoUserIDs []string, userIDs []string) (SSOMapFake, error)
NewsSSOMapFake creates in memory implementation of SSOMapFake repository.
func (*SSOMapFake) CreateMapping ¶
func (s *SSOMapFake) CreateMapping(ssoUserID string, userID string) error
CreateMapping links an external user with an internal user.
func (SSOMapFake) GetShortUserID ¶
func (s SSOMapFake) GetShortUserID(ssoUserID string) (string, error)
GetShortUserID retrieves the internal user ID that is linked to the external user.
func (SSOMapFake) IsRelationExist ¶
func (s SSOMapFake) IsRelationExist(ssoUserID string, userID string) bool
IsRelationExist checks whether a given external user is linked to a given internal user.
func (SSOMapFake) IsSSOUserExist ¶
func (s SSOMapFake) IsSSOUserExist(ssoUserID string) (bool, error)
IsSSOUserExist checks whether a external user is linked to any internal user.
type ShortLink ¶
type ShortLink interface { IsAliasExist(alias string) (bool, error) GetShortLinkByAlias(alias string) (entity.ShortLink, error) CreateShortLink(shortLinkInput entity.ShortLinkInput) error UpdateShortLink(oldAlias string, shortLinkInput entity.ShortLinkInput) (entity.ShortLink, error) DeleteShortLink(alias string) error GetShortLinksByAliases(aliases []string) ([]entity.ShortLink, error) }
ShortLink accesses shortLinks from storage, such as database.
type ShortLinkFake ¶
type ShortLinkFake struct {
// contains filtered or unexported fields
}
ShortLinkFake accesses ShortLink information in short_link table through SQL.
func NewShortLinkFake ¶
func NewShortLinkFake(userShortLinkRepoFake *UserShortLinkFake, shortLinks map[string]entity.ShortLink) ShortLinkFake
NewShortLinkFake creates in memory ShortLink repository
func (*ShortLinkFake) CreateShortLink ¶
func (s *ShortLinkFake) CreateShortLink(shortLinkInput entity.ShortLinkInput) error
CreateShortLink inserts a new ShortLink into short_link table.
func (ShortLinkFake) DeleteShortLink ¶
func (s ShortLinkFake) DeleteShortLink(alias string) error
DeleteShortLink deletes an existing user short link from in memory data store.
func (ShortLinkFake) GetShortLinkByAlias ¶
func (s ShortLinkFake) GetShortLinkByAlias(alias string) (entity.ShortLink, error)
GetShortLinkByAlias finds an ShortLink in short_link table given alias.
func (ShortLinkFake) GetShortLinksByAliases ¶
func (s ShortLinkFake) GetShortLinksByAliases(aliases []string) ([]entity.ShortLink, error)
GetShortLinksByAliases finds all ShortLink for a list of aliases
func (ShortLinkFake) IsAliasExist ¶
func (s ShortLinkFake) IsAliasExist(alias string) (bool, error)
IsAliasExist checks whether a given alias exist in short_link table.
func (ShortLinkFake) UpdateShortLink ¶
func (s ShortLinkFake) UpdateShortLink(oldAlias string, shortLinkInput entity.ShortLinkInput) (entity.ShortLink, error)
UpdateShortLink updates an existing ShortLink with new properties.
type User ¶
type User interface { IsIDExist(id string) (bool, error) IsEmailExist(email string) (bool, error) GetUserByID(id string) (entity.User, error) GetUserByEmail(email string) (entity.User, error) CreateUser(user entity.User) error }
User accesses users' information from storage, such as database.
type UserChangeLog ¶
type UserChangeLog interface { GetLastViewedAt(user entity.User) (time.Time, error) UpdateLastViewedAt(user entity.User, currentTime time.Time) (time.Time, error) CreateRelation(user entity.User, currentTime time.Time) error }
UserChangeLog accesses user-changelog information from storage, such as database.
type UserChangeLogFake ¶
type UserChangeLogFake struct {
// contains filtered or unexported fields
}
UserChangeLogFake represents in memory implementation of UserChangeLog repository.
func NewUserChangeLogFake ¶
func NewUserChangeLogFake(lastViewedAt map[string]time.Time) UserChangeLogFake
NewUserChangeLogFake creates in memory UserChangeLog repository
func (*UserChangeLogFake) CreateRelation ¶
CreateRelation inserts new entry into UserChangeLog repository
func (UserChangeLogFake) GetLastViewedAt ¶
GetLastViewedAt retrieves lastViewedAt for user
func (*UserChangeLogFake) UpdateLastViewedAt ¶
func (u *UserChangeLogFake) UpdateLastViewedAt(user entity.User, currentTime time.Time) (time.Time, error)
UpdateLastViewedAt updates lastViewedAt for user to currentTime
type UserFake ¶
type UserFake struct {
// contains filtered or unexported fields
}
UserFake represents in memory implementation of user repository.
func NewUserFake ¶
NewUserFake create in memory user repository implementation.
func (*UserFake) CreateUser ¶
CreateUser creates and persists user in the repository for future access.
func (UserFake) GetUserByEmail ¶
GetUserByEmail finds an user with a given email.
func (UserFake) GetUserByID ¶
GetUserByID finds an user with a given user ID.
func (UserFake) IsEmailExist ¶
IsEmailExist checks whether an user with given email exists in the repository.
func (UserFake) IsUserIDExist ¶
IsUserIDExist checks whether an user with given ID exists in the repository.
type UserRole ¶
type UserRole interface { GetRoles(user entity.User) ([]role.Role, error) AddRole(user entity.User, role role.Role) error DeleteRole(user entity.User, role role.Role) error }
UserRole accesses users' role information from storage, such as database.
type UserRoleFake ¶
type UserRoleFake struct {
// contains filtered or unexported fields
}
UserRoleFake represents in memory implementation of UserRole repository.
func NewUserRoleFake ¶
func NewUserRoleFake(userRoles map[string][]role.Role) UserRoleFake
NewUserRoleFake creates a new instance of UserRoleFake
func (UserRoleFake) DeleteRole ¶
DeleteRole removes the given role from the user
type UserShortLink ¶
type UserShortLink interface { CreateRelation(user entity.User, shortLinkInput entity.ShortLinkInput) error FindAliasesByUser(user entity.User) ([]string, error) HasMapping(user entity.User, alias string) (bool, error) }
UserShortLink accesses User-ShortLink relationship from storage, such as database.
type UserShortLinkFake ¶
type UserShortLinkFake struct {
// contains filtered or unexported fields
}
UserShortLinkFake represents in memory implementation of User-ShortLink relationship accessor.
func NewUserShortLinkRepoFake ¶
func NewUserShortLinkRepoFake(users []entity.User, shortLinks []entity.ShortLink) UserShortLinkFake
NewUserShortLinkRepoFake creates UserShortLinkFake
func (*UserShortLinkFake) CreateRelation ¶
func (u *UserShortLinkFake) CreateRelation(user entity.User, shortLinkInput entity.ShortLinkInput) error
CreateRelation creates many to many relationship between User and ShortLink.
func (UserShortLinkFake) FindAliasesByUser ¶
func (u UserShortLinkFake) FindAliasesByUser(user entity.User) ([]string, error)
FindAliasesByUser fetches the aliases of all the ShortLinks created by the given user.
func (UserShortLinkFake) HasMapping ¶
HasMapping checks whether a given short link belongs to a user.
func (*UserShortLinkFake) UpdateAliasCascade ¶
func (u *UserShortLinkFake) UpdateAliasCascade(oldAlias string, shortLinkInput entity.ShortLinkInput) error
UpdateAliasCascade updates user-shortlink relationships to reflect changes to alias. TODO(issue#958) use eventbus for propagating short link change to all related repos
Source Files
¶
- accountmapping.go
- accountmapping_fake.go
- apikey.go
- apikey_fake.go
- app.go
- app_fake.go
- change_log.go
- change_log_fake.go
- error.go
- featuretoggle.go
- featuretoggle_fake.go
- shortlink.go
- shortlink_fake.go
- ssomap.go
- ssomap_fake.go
- user.go
- user_changelog.go
- user_changelog_fake.go
- user_fake.go
- userrole.go
- userrole_fake.go
- usershortlink.go
- usershortlink_fake.go