Documentation
¶
Index ¶
- func GenerateItemJSON(rev *ItemRevision, pretty bool) (b []byte, err error)
- type ChecksumType
- type FormatParam
- type Item
- func (i *Item) AddOrUpdateRevision(rev *ItemRevision, mode ReviseMode)
- func (i *Item) DeleteRevision(version string) (deleted bool)
- func (i *Item) GetLatest() (rev *ItemRevision)
- func (i *Item) GetLatestURL(param FormatParam) (url string, err error)
- func (i *Item) GetRevision(version string) (rev *ItemRevision)
- func (i *Item) Print(pretty bool) (b []byte, err error)
- func (i *Item) String() string
- func (i *Item) UpdateRevisionChecksum(ver string, sum *ItemChecksum) (success bool)
- type ItemChecksum
- type ItemRevision
- type ReviseMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateItemJSON ¶
func GenerateItemJSON(rev *ItemRevision, pretty bool) (b []byte, err error)
Types ¶
type ChecksumType ¶
type ChecksumType int
const ( ChecksumTypeSHA256 ChecksumType = iota + 1 ChecksumTypeCRC ChecksumTypeMD5 ChecksumTypeUnknown ChecksumType = -1 )
type FormatParam ¶
type Item ¶
type Item struct {
// contains filtered or unexported fields
}
Item wraps itemProps which corresponds to JSON structure of item data
func DecodeItemJSON ¶
func (*Item) AddOrUpdateRevision ¶
func (i *Item) AddOrUpdateRevision(rev *ItemRevision, mode ReviseMode)
func (*Item) DeleteRevision ¶
func (*Item) GetLatest ¶
func (i *Item) GetLatest() (rev *ItemRevision)
func (*Item) GetLatestURL ¶
func (i *Item) GetLatestURL(param FormatParam) (url string, err error)
func (*Item) GetRevision ¶
func (i *Item) GetRevision(version string) (rev *ItemRevision)
func (*Item) UpdateRevisionChecksum ¶
func (i *Item) UpdateRevisionChecksum(ver string, sum *ItemChecksum) (success bool)
type ItemChecksum ¶
type ItemChecksum struct {
File string `json:"file"`
SHA256 string `json:"sha256,omitempty"`
// CRC-32 IEEE Std.
CRC string `json:"crc,omitempty"`
MD5 string `json:"md5,omitempty"`
}
func NewItemChecksums ¶
func NewItemChecksums(arg string) (sums []ItemChecksum)
func (*ItemChecksum) GetSumAndHasher ¶
func (sum *ItemChecksum) GetSumAndHasher() (s string, h hash.Hash, t ChecksumType)
func (*ItemChecksum) SetSum ¶
func (sum *ItemChecksum) SetSum(val string, t ChecksumType)
type ItemRevision ¶
type ItemRevision struct {
Version string `json:"version"`
Checksums []ItemChecksum `json:"checksums,omitempty"`
URLFormat string `json:"url-format,omitempty"`
Replacements map[string]string `json:"replacements,omitempty"`
Extension map[string]string `json:"extension,omitempty"`
RenameFiles map[string]string `json:"rename-files,omitempty"`
}
func (*ItemRevision) AddOrSwapChecksum ¶
func (rev *ItemRevision) AddOrSwapChecksum(sum *ItemChecksum)
func (*ItemRevision) ConvertFileName ¶
func (rev *ItemRevision) ConvertFileName(src string, param FormatParam) (dest string)
func (*ItemRevision) GetChecksum ¶
func (rev *ItemRevision) GetChecksum(file string) (sum *ItemChecksum)
func (*ItemRevision) GetURL ¶
func (rev *ItemRevision) GetURL(param FormatParam) (url string, err error)
type ReviseMode ¶
type ReviseMode int
const ( ReviseModeNatural ReviseMode = iota + 1 ReviseModeLatest ReviseModeOld )
Click to show internal directories.
Click to hide internal directories.