download

package
v0.0.0-...-3d71b80 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMongoDB

func GetMongoDB(ctx context.Context, cfg Config) error

GetMongoDB ensures there is a mongodb binary in the cache path It will download one if not already present in the cache

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config keeps the configuration values for downloading and storing the Mongo binary

func NewConfig

func NewConfig(ctx context.Context, mongoVersionStr string) (*Config, error)

NewConfig creates the config values for the given version. It will identify the appropriate mongodb artifact and the cache path based on the current OS

func (*Config) MongoPath

func (cfg *Config) MongoPath() string

MongoPath returns the path to the mongod executable file

type DownloadSpec

type DownloadSpec struct {

	// Platform is "osx" or "linux"
	Platform string

	// Arch
	Arch string

	// OSName is one of:
	// - ubuntu2004
	// - ubuntu1804
	// - ubuntu1604
	// - debian10
	// - debian92
	// - amazon2
	// - "" for MacOS
	OSName string
	// contains filtered or unexported fields
}

DownloadSpec specifies what copy of MongoDB to download

func MakeDownloadSpec

func MakeDownloadSpec(version Version) (*DownloadSpec, error)

MakeDownloadSpec returns a DownloadSpec for the current operating system

func (*DownloadSpec) GetDownloadURL

func (spec *DownloadSpec) GetDownloadURL() (string, error)

GetDownloadURL returns the download URL to download the binary from the MongoDB website

func (*DownloadSpec) Version

func (spec *DownloadSpec) Version() string

Version returns the MongoDb version

type UnsupportedMongoVersionError

type UnsupportedMongoVersionError struct {
	// contains filtered or unexported fields
}

UnsupportedMongoVersionError is used to indicate we do not know how to download the given version of MongoDB

func (*UnsupportedMongoVersionError) Error

func (err *UnsupportedMongoVersionError) Error() string

type UnsupportedSystemError

type UnsupportedSystemError struct {
	// contains filtered or unexported fields
}

UnsupportedSystemError is used to indicate that we do not support automatic selection of the right MongoDB binary for your system

func (*UnsupportedSystemError) Error

func (err *UnsupportedSystemError) Error() string

type Version

type Version struct {
	Major int
	Minor int
	Patch int
}

Version represents a version (Major.Minor.Patch)

func NewVersion

func NewVersion(version string) (*Version, error)

NewVersion parses the version string and creates a Version object

func (*Version) IsGreaterOrEqual

func (v *Version) IsGreaterOrEqual(major int, minor int, patch int) bool

IsGreaterOrEqual checks if the version is greater or equal than another version

func (*Version) String

func (v *Version) String() string

String returns the string representation of a Version: Major.Minor.Patch

Jump to

Keyboard shortcuts

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