优化结构
This commit is contained in:
@@ -1,57 +0,0 @@
|
||||
package biz
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"time"
|
||||
)
|
||||
|
||||
var ErrInvalidVersion = errors.New("版本信息格式错误")
|
||||
|
||||
type VersionStage string
|
||||
|
||||
const (
|
||||
VersionStageMenus VersionStage = "menus"
|
||||
VersionStageAPIs VersionStage = "apis"
|
||||
VersionStageDictionaries VersionStage = "dictionaries"
|
||||
VersionStageJSON VersionStage = "json"
|
||||
VersionStageSave VersionStage = "save"
|
||||
)
|
||||
|
||||
type VersionStageError struct {
|
||||
Stage VersionStage
|
||||
Err error
|
||||
}
|
||||
|
||||
func (e *VersionStageError) Error() string { return e.Err.Error() }
|
||||
func (e *VersionStageError) Unwrap() error { return e.Err }
|
||||
|
||||
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, []*time.Time) ([]*Version, int64, error)
|
||||
BuildVersionBundle(context.Context, []uint, []uint, []uint) (*VersionBundle, error)
|
||||
ImportVersionBundle(context.Context, *VersionBundle) error
|
||||
}
|
||||
type VersionUsecase struct{ VersionRepo }
|
||||
|
||||
func NewVersionUsecase(repo VersionRepo) *VersionUsecase { return &VersionUsecase{VersionRepo: repo} }
|
||||
Reference in New Issue
Block a user