Documentation ¶
Index ¶
- func RegisterController(v0 *server.V0, c Controller)
- type BackgroundModel
- type Controller
- type Group
- type GroupModel
- type GroupRepo
- type ImageModel
- type ResVersion
- type Service
- func (s *Service) GetGroupByID(ctx context.Context, id string) (*Group, error)
- func (s *Service) GetGroups(ctx context.Context) ([]Group, error)
- func (s *Service) GetStories(ctx context.Context) ([]Story, error)
- func (s *Service) GetStoryByID(ctx context.Context, id string) (*Story, error)
- func (s *Service) GetVersion(ctx context.Context) (string, error)
- func (s *Service) SetAvgs(version string, groups []Group) (err error)
- type Story
- type StoryModel
- type StoryRepo
- func (r *StoryRepo) GetStories(ctx context.Context) ([]StoryModel, error)
- func (r *StoryRepo) GetStoryByID(ctx context.Context, id string) (*StoryModel, error)
- func (r *StoryRepo) InsertStories(ctx context.Context, stories []StoryModel) error
- func (r *StoryRepo) Truncate(ctx context.Context) (err error)
- type VersionRepo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterController ¶
func RegisterController(v0 *server.V0, c Controller)
Types ¶
type BackgroundModel ¶
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 GroupModel ¶
type GroupModel struct { bun.BaseModel `bun:"table:groups,alias:g"` // ID is the unique id of the AvgGroup. // e.g.: "1stact" (骑兵与猎人), "act15side" (将进酒). ID string `bun:"id,pk"` // Name is the name of the AvgGroup, can be the mainline chapter name, the activity name or the operator record name. // e.g.: "骑兵与猎人", "怒号光明", "学者之心", "火山". Name string ActType string // Stories is the stories belong to the group. Stories []*StoryModel `bun:"rel:has-many,join:id=group_id"` }
GroupModel is a group of story. e.g., a 活动 such as "将进酒" or a 主线 such as "怒号光明".
type GroupRepo ¶
func (*GroupRepo) GetGroupByID ¶
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
type ImageModel ¶
type ResVersion ¶
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 (*Service) GetStoryByID ¶
type StoryModel ¶
type StoryModel struct { bun.BaseModel `bun:"table:stories,alias:s"` // ID is the unique ID of the story. // e.g., "1stact_level_a001_01_beg". ID string `bun:",pk"` // Code is the code of the level the story belongs to, could be empty, in this case the story belongs to no level. // e.g., "GT-1", "1-7", "". Code string // Name is the name of the level or the operator record the story belongs to. // e.g.: "不要恐慌", "埋藏", "我也要大干一场". Name string // Tag is the type of the story, which could be only "行动前", "行动后" or "幕间". Tag string // Images are the images the story uses. Images []*ImageModel `bun:"rel:has-many,join:id=story_id"` // Backgrounds are the backgrounds the story uses. Backgrounds []*BackgroundModel `bun:"rel:has-many,join:id=story_id"` // GroupID is the ID of the group the story belongs to. GroupID string // Group is the group the story belongs to. Group *GroupModel `bun:"rel:belongs-to,join:group_id=id"` }
StoryModel is a part of story of an AVG. e.g., "8-1 行动前" or "IW-9 行动后" (IW stands for activity "将进酒").
type StoryRepo ¶
func (*StoryRepo) GetStories ¶
func (r *StoryRepo) GetStories(ctx context.Context) ([]StoryModel, error)
func (*StoryRepo) GetStoryByID ¶
func (*StoryRepo) InsertStories ¶
func (r *StoryRepo) InsertStories(ctx context.Context, stories []StoryModel) error
type VersionRepo ¶
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
Click to show internal directories.
Click to hide internal directories.