38 lines
1.0 KiB
Go
38 lines
1.0 KiB
Go
package biz
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
)
|
|
|
|
type Version struct {
|
|
ID uint
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
Name string
|
|
Code string
|
|
Description string
|
|
Data string
|
|
}
|
|
type VersionBundle struct {
|
|
Name string
|
|
Code string
|
|
Description string
|
|
ExportTime string
|
|
Menus []*Menu
|
|
APIs []*API
|
|
Dictionaries []*Dictionary
|
|
}
|
|
type VersionRepo interface {
|
|
CreateVersion(context.Context, *Version) error
|
|
DeleteVersions(context.Context, []uint) error
|
|
FindVersion(context.Context, uint) (*Version, error)
|
|
ListVersions(context.Context, int, int, string, string) ([]*Version, int64, error)
|
|
BuildVersionBundle(context.Context, []uint, []uint, []uint) (*VersionBundle, error)
|
|
ImportVersionBundle(context.Context, *VersionBundle) error
|
|
}
|
|
type VersionUsecase struct{ repo VersionRepo }
|
|
|
|
func NewVersionUsecase(repo VersionRepo) *VersionUsecase { return &VersionUsecase{repo: repo} }
|
|
func (uc *VersionUsecase) Repo() VersionRepo { return uc.repo }
|