Documentation ¶
Index ¶
- Constants
- Variables
- func ServiceProvider(highscore HighscoreRepository, user UserRepository, app AppRepository, ...) service.Provider
- type App
- type AppID
- type AppManifest
- type AppOptions
- type AppRepository
- type Highscore
- type HighscoreID
- type HighscoreRepository
- type Repository
- type User
- type UserID
- type UserRepository
- type UsersByLastSeen
Constants ¶
View Source
const (
ServiceName service.Name = "repository"
)
Variables ¶
View Source
var (
ErrNotFound = errors.New("not found")
)
Functions ¶
func ServiceProvider ¶
func ServiceProvider(highscore HighscoreRepository, user UserRepository, app AppRepository, setting setting.Repository) service.Provider
Types ¶
type App ¶
type App struct { ID AppID Manifest *AppManifest Order int }
type AppManifest ¶
type AppOptions ¶
type AppOptions struct {
HighscoresEnabled bool `yaml:"highscoresEnabled"`
}
type AppRepository ¶
type AppRepository interface { // Override overrides app attributes in the repository Override(id AppID, title, description *string, tags []string, order *int) error // Save saves an app in the repository Save(*App) error // List lists apps in the repository List() ([]*App, error) // Get returns an app by its id Get(AppID) (*App, error) // Delete removes an app from the repository Delete(AppID) error // Publish the given app Publish(AppID) error // Unpublish the given app Unpublish(AppID) error // isPublished checks if the given app is published IsPublished(AppID) (bool, error) }
type HighscoreID ¶
type HighscoreID string
type HighscoreRepository ¶
type HighscoreRepository interface { Create(appID AppID, userID UserID, score int64) (*Highscore, error) Delete(HighscoreID) error Get(HighscoreID) (*Highscore, error) List() ([]*Highscore, error) FindByAppID(appID AppID, userFilters ...UserID) ([]*Highscore, error) FindByUserID(userID UserID) ([]*Highscore, error) }
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
func From ¶
func From(container *service.Container) (*Repository, error)
From retrieves the user repository in the given service container
func Must ¶
func Must(container *service.Container) *Repository
Must retrieves the user repository in the given service container or panic otherwise
func NewRepository ¶
func NewRepository(highscore HighscoreRepository, user UserRepository, app AppRepository, setting setting.Repository) *Repository
func (*Repository) App ¶
func (r *Repository) App() AppRepository
func (*Repository) Highscore ¶
func (r *Repository) Highscore() HighscoreRepository
func (*Repository) Setting ¶
func (r *Repository) Setting() setting.Repository
func (*Repository) User ¶
func (r *Repository) User() UserRepository
type UserRepository ¶
type UsersByLastSeen ¶
type UsersByLastSeen []*User
func (UsersByLastSeen) Len ¶
func (b UsersByLastSeen) Len() int
func (UsersByLastSeen) Less ¶
func (b UsersByLastSeen) Less(i, j int) bool
func (UsersByLastSeen) Swap ¶
func (b UsersByLastSeen) Swap(i, j int)
Click to show internal directories.
Click to hide internal directories.