avg

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterController

func RegisterController(v0 *server.V0, c Controller)

Types

type Asset added in v0.7.0

type Asset struct {
	ID   string `json:"id"`
	Kind string `json:"kind"`
}

type Avg added in v0.7.0

type Avg []Group

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

func NewController

func NewController(service *Service) Controller

func (*Controller) GetGroupByID

func (c *Controller) GetGroupByID(ctx *fiber.Ctx) error

func (*Controller) GetGroups

func (c *Controller) GetGroups(ctx *fiber.Ctx) error

func (*Controller) GetStories

func (c *Controller) GetStories(ctx *fiber.Ctx) error

func (*Controller) GetStoryByID

func (c *Controller) GetStoryByID(ctx *fiber.Ctx) error

type Group

type Group struct {
	ID      string  `json:"id"`
	Name    string  `json:"name"`
	Type    string  `json:"type"`
	Stories []Story `json:"stories"`
}

type GroupRepo

type GroupRepo struct {
	infra.Repo
}

func NewGroupRepo

func NewGroupRepo(db *bun.DB) (*GroupRepo, error)

func (*GroupRepo) GetGroupByID

func (r *GroupRepo) GetGroupByID(ctx context.Context, id string) (*groupModel, error)

func (*GroupRepo) GetGroups

func (r *GroupRepo) GetGroups(ctx context.Context) ([]groupModel, error)

func (*GroupRepo) InsertGroups

func (r *GroupRepo) InsertGroups(ctx context.Context, groups []groupModel) error

func (*GroupRepo) Truncate

func (r *GroupRepo) Truncate(ctx context.Context) error

type ResVersion

type ResVersion struct {
	bun.BaseModel `bun:"table:version"`

	// ID can only be true, because this table should only have one row.
	ID         bool   `bun:",pk"`
	ResVersion string `bun:""`
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(versionRepo *VersionRepo, groupRepo *GroupRepo, storyRepo *StoryRepo) *Service

func (*Service) GetGroupByID

func (s *Service) GetGroupByID(ctx context.Context, id string) (*Group, error)

func (*Service) GetGroups

func (s *Service) GetGroups(ctx context.Context) ([]Group, error)

func (*Service) GetStories

func (s *Service) GetStories(ctx context.Context) ([]Story, error)

func (*Service) GetStoryByID

func (s *Service) GetStoryByID(ctx context.Context, id string) (*Story, error)

func (*Service) GetVersion

func (s *Service) GetVersion(ctx context.Context) (string, error)

func (*Service) Reset added in v0.7.0

func (s *Service) Reset(ctx context.Context) error

func (*Service) SetAvgs

func (s *Service) SetAvgs(version string, groups []Group) (err error)

type Story

type Story struct {
	ID      string  `json:"id"`
	Code    string  `json:"code"`
	Name    string  `json:"name"`
	Tag     string  `json:"tag"`
	GroupID string  `json:"groupID"`
	Assets  []Asset `json:"assets"`
}

type StoryRepo

type StoryRepo struct {
	infra.Repo
}

func NewStoryRepo

func NewStoryRepo(db *bun.DB) (*StoryRepo, error)

func (*StoryRepo) GetStories

func (r *StoryRepo) GetStories(ctx context.Context) ([]storyModel, error)

func (*StoryRepo) GetStoryByID

func (r *StoryRepo) GetStoryByID(ctx context.Context, id string) (*storyModel, error)

func (*StoryRepo) InsertStories

func (r *StoryRepo) InsertStories(ctx context.Context, stories []storyModel) error

func (*StoryRepo) Truncate

func (r *StoryRepo) Truncate(ctx context.Context) (err error)

type VersionRepo

type VersionRepo struct {
	infra.Repo
}

func NewVersionRepo

func NewVersionRepo(db *bun.DB) (*VersionRepo, error)

func (*VersionRepo) GetVersion

func (r *VersionRepo) GetVersion(ctx context.Context) (string, error)

func (*VersionRepo) UpsertVersion

func (r *VersionRepo) UpsertVersion(ctx context.Context, resVersion string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL