Documentation ¶
Index ¶
- func GetBadgeLevelByID(bdg *v1.Badge, id string, returnDefaultIfNotExists bool) (*v1.BadgeLevel, error)
- func GetDefaultLevel(bdg *v1.Badge) (*v1.BadgeLevel, error)
- func HandlerCreate(repository *Repository) gin.HandlerFunc
- func HandlerStats(repo *Repository) gin.HandlerFunc
- func UnmarshalLevels(badge v1.Badge) ([]v1.BadgeLevel, error)
- type Repository
- func (repo *Repository) FindBy(criteria map[string]interface{}) (interface{}, error)
- func (repo *Repository) FindOneBy(criteria map[string]interface{}) (hateoas.Entity, error)
- func (repo *Repository) FindOneBySlug(slug string) (*v1.Badge, error)
- func (repo *Repository) FindOneByUnscoped(criteria map[string]interface{}) (hateoas.SoftDeletableEntity, error)
- func (repo *Repository) FindPageBy(pageable hateoas.Pageable, criteria map[string]interface{}) (hateoas.Page, error)
- func (repo *Repository) GatherStats(slug string, defaultLevelID string) (map[string]int, error)
- func (repo *Repository) GetType() reflect.Type
- func (repo *Repository) Remove(badge interface{}) error
- func (repo *Repository) Save(badge hateoas.Entity) error
- func (repo *Repository) Truncate() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetBadgeLevelByID ¶
func GetBadgeLevelByID(bdg *v1.Badge, id string, returnDefaultIfNotExists bool) (*v1.BadgeLevel, error)
GetBadgeLevelByID returns the level identified by id
func GetDefaultLevel ¶
func GetDefaultLevel(bdg *v1.Badge) (*v1.BadgeLevel, error)
GetDefaultLevel returns the default level of a badge
func HandlerCreate ¶
func HandlerCreate(repository *Repository) gin.HandlerFunc
HandlerCreate replace or create a resource
func HandlerStats ¶
func HandlerStats(repo *Repository) gin.HandlerFunc
HandlerStats computes and renders badge statistics
func UnmarshalLevels ¶
func UnmarshalLevels(badge v1.Badge) ([]v1.BadgeLevel, error)
UnmarshalLevels extracts the levels JSONB field form the badge
Types ¶
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository is a repository manager for applications
func NewRepository ¶
func NewRepository(db *gorm.DB) *Repository
NewRepository creates an application repository
func (*Repository) FindBy ¶
func (repo *Repository) FindBy(criteria map[string]interface{}) (interface{}, error)
FindBy fetch a collection of applications matching each criteria
func (*Repository) FindOneBy ¶
func (repo *Repository) FindOneBy(criteria map[string]interface{}) (hateoas.Entity, error)
FindOneBy fetch the first badge matching each criteria
func (*Repository) FindOneBySlug ¶
func (repo *Repository) FindOneBySlug(slug string) (*v1.Badge, error)
FindOneBySlug fetch a collection of applications matching each criteria
func (*Repository) FindOneByUnscoped ¶
func (repo *Repository) FindOneByUnscoped(criteria map[string]interface{}) (hateoas.SoftDeletableEntity, error)
FindOneByUnscoped gives the details of a particular badge, even if soft deleted
func (*Repository) FindPageBy ¶
func (repo *Repository) FindPageBy(pageable hateoas.Pageable, criteria map[string]interface{}) (hateoas.Page, error)
FindPageBy returns a page of matching entities
func (*Repository) GatherStats ¶
GatherStats computes statistics for one badge
func (*Repository) GetType ¶
func (repo *Repository) GetType() reflect.Type
GetType returns the entity type managed by this repository
func (*Repository) Remove ¶
func (repo *Repository) Remove(badge interface{}) error
Remove deletes the application whose GetID is given as a parameter
func (*Repository) Save ¶
func (repo *Repository) Save(badge hateoas.Entity) error
Save persists a badge to the database
func (*Repository) Truncate ¶
func (repo *Repository) Truncate() error
Truncate empties the applications table for testing purposes