download

package
v1.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSONFeed

type JSONFeed struct {
	Versions []*ToolsVersion `json:"versions"`
}

JSONFeed represents the structure of the JSON document consumed by the MongoDB downloads center. An abbreviated version of the document might look like:

{
  "versions": [
    {
      "version": "4.3.2",
      "downloads": [
        {
          "name": "amazon",
          "arch": "x86_64",
          "archive": {
            "url": "fastdl.mongodb.org/tools/db/...tgz",
            "md5": "4ec7...",
            "sha1": "3269...",
            "sha256": "0b679..."
          },
          "package": {
            "url": "fastdl.mongodb.org/tools/db/...rpm",
            "md5": "5b35...",
            "sha1": "b07c...",
            "sha256": "f6e7..."
          }
        },
        ...
      ]
    }
  ]
}

func (*JSONFeed) FindOrCreateDownload

func (f *JSONFeed) FindOrCreateDownload(version, platform, arch string) *ToolsDownload

FindOrCreateDownload will find the ToolsDownload in f that matches the version, platform, and arch. If the ToolsDownload does not exist, it will be added to f. If the parent ToolsVersion doesn't exist either, that will also be created.

func (*JSONFeed) Sort

func (f *JSONFeed) Sort()

Sort will sort f.Versions by semver version. Version preference for the suffix of pre-release versions are alphabetical. Within each version, Downloads are sorted by OS name and architecture.

type ToolsArchive

type ToolsArchive ToolsArtifact

type ToolsArtifact

type ToolsArtifact struct {
	URL    string `json:"url"`
	Md5    string `json:"md5"`
	Sha1   string `json:"sha1"`
	Sha256 string `json:"sha256"`
}

type ToolsDownload

type ToolsDownload struct {
	Name    string        `json:"name"`
	Arch    string        `json:"arch"`
	Archive ToolsArchive  `json:"archive"`
	Package *ToolsPackage `json:"package,omitempty"`
}

type ToolsPackage

type ToolsPackage ToolsArtifact

type ToolsVersion

type ToolsVersion struct {
	Version   string           `json:"version"`
	Downloads []*ToolsDownload `json:"downloads"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL