Documentation ¶
Index ¶
- Variables
- func IsPackageNotFound(err error) bool
- func IsVersionSmaller(v1 string, v2 string) bool
- func Less(l defaultVersion, r defaultVersion) bool
- func ParseVersion(versionAsString string, version *defaultVersion) error
- type PackageInfo
- type PackageInfoFilterFunc
- type PackagesByVersion
- type RemoteRepository
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrMsg_PackageNotFound = "package not found"
)
Functions ¶
func IsPackageNotFound ¶
func IsVersionSmaller ¶
func ParseVersion ¶
Types ¶
type PackageInfo ¶
type PackageInfo struct { Name string `json:"name"` Version string `json:"version"` Url string `json:"url"` Checksum string `json:"checksum"` StartPartition uint8 `json:"startPartition"` EndPartition uint8 `json:"endPartition"` }
func (*PackageInfo) UnmarshalJSON ¶
func (t *PackageInfo) UnmarshalJSON(data []byte) error
Custom unmarshal method to deal with default StartPartition and EndPartition
type PackageInfoFilterFunc ¶
type PackageInfoFilterFunc func(pkgInfo *PackageInfo) bool
type PackagesByVersion ¶
type PackagesByVersion []PackageInfo
PackagesByVersion type help us to sort the packages by their version
func (PackagesByVersion) Len ¶
func (a PackagesByVersion) Len() int
func (PackagesByVersion) Less ¶
func (a PackagesByVersion) Less(i, j int) bool
func (PackagesByVersion) Swap ¶
func (a PackagesByVersion) Swap(i, j int)
type RemoteRepository ¶
type RemoteRepository interface { // Fetch the remote repository metadata Fetch() error // Get informations of all packages All() ([]PackageInfo, error) // Get all available package names PackageNames() ([]string, error) // Get the available versions of a given package Versions(packageName string) ([]string, error) // Get the latest available version of a given package LatestVersion(packageName string) (string, error) // Get the latest version of a given package following a filter function // this function will pass the package info to the filter from the latest version to the oldest one // until the filter returns true QueryLatestVersion(packageName string, filter PackageInfoFilterFunc) (string, error) // Get the package info of the latest available version LatestPackageInfo(packageName string) (*PackageInfo, error) // Get the latest package info according to a filter function // this function will pass the package to the filter from the latest version to the oldest one // until the filter returns true QueryLatestPackageInfo(packageName string, filter PackageInfoFilterFunc) (*PackageInfo, error) // Download the package of the command with specific version Package(packageName string, packageVersion string) (command.Package, error) // get the package information of a given version PackageInfo(packageName string, packageVersion string) (*PackageInfo, error) // Verify package: support two verifications: checksum and signature Verify(pkg command.Package, verifyChecksum, verifySignature bool) (bool, error) }
RemoteRepository represents a group of commands packages, and the current version of them to be used by cdt
func CreateRemoteRepository ¶
func CreateRemoteRepository(repoRootUrl string) RemoteRepository
Click to show internal directories.
Click to hide internal directories.