[feat] PkgVersion
This commit is contained in:
parent
4e99e723c9
commit
fefaa09793
@ -7,10 +7,40 @@ type PkgVersion struct {
|
||||
FileName string `db:"filename"`
|
||||
SourceMapFileName string `db:"sourcemapFileName"`
|
||||
Imports []string `db:"imports"`
|
||||
VersionAt string `db:"version_at"`
|
||||
Platform string `db:"platform"`
|
||||
ReleaseAt string `db:"release_at"`
|
||||
UpdatedAt string `db:"updated_at"`
|
||||
CreatedAt string `db:"created_at"`
|
||||
}
|
||||
|
||||
func (this PkgVersion) GetFile() []byte
|
||||
func (this PkgVersion) GetSourceMap() []byte
|
||||
|
||||
type GetPkgVersion func(pkg string) (PkgVersion, bool)
|
||||
type GetPkgVersion func(pkg string, opts ...PkgOption) (PkgVersion, bool)
|
||||
|
||||
// 筛选选项
|
||||
type PkgOption func(option *PkgOptions)
|
||||
type PkgOptions struct {
|
||||
platform string
|
||||
hash string
|
||||
}
|
||||
|
||||
func (this PkgOptions) Platform() string {
|
||||
return this.platform
|
||||
}
|
||||
|
||||
func (this PkgOptions) Hash() string {
|
||||
return this.hash
|
||||
}
|
||||
|
||||
func PkgPlatform(value string) PkgOption {
|
||||
return func(option *PkgOptions) {
|
||||
option.platform = value
|
||||
}
|
||||
}
|
||||
|
||||
func PkgHash(value string) PkgOption {
|
||||
return func(option *PkgOptions) {
|
||||
option.hash = value
|
||||
}
|
||||
}
|
||||
|
7
errno.go
7
errno.go
@ -116,9 +116,10 @@ var (
|
||||
ErrPkgInvalid = &Errno{Code: 20702, Msg: "pkg invalid"}
|
||||
ErrPkgPlatformInvalid = &Errno{Code: 20703, Msg: "pkg platform invalid"}
|
||||
ErrPkgUpgrade = &Errno{Code: 20704, Msg: "pkg upgrade fail"}
|
||||
ErrPkgDownload = &Errno{Code: 20705, Msg: "pkg download fail"}
|
||||
ErrPkgUpload = &Errno{Code: 20706, Msg: "pkg upload fail"}
|
||||
ErrPkgBuild = &Errno{Code: 20707, Msg: "pkg build fail"}
|
||||
ErrPkgRollback = &Errno{Code: 20705, Msg: "pkg version rollback fail"}
|
||||
ErrPkgDownload = &Errno{Code: 20706, Msg: "pkg download fail"}
|
||||
ErrPkgUpload = &Errno{Code: 20707, Msg: "pkg upload fail"}
|
||||
ErrPkgBuild = &Errno{Code: 20708, Msg: "pkg build fail"}
|
||||
)
|
||||
|
||||
// 使用 错误码 和 error 创建新的 错误
|
||||
|
Loading…
Reference in New Issue
Block a user