download

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Overview

Package download implements downloading DuckDB releases as a library

Index

Constants

View Source
const (
	LatestVersion  = "latest"
	PreviewVersion = "preview"
)
View Source
const (
	BinTypeDynLib = BinType(iota)
	BinTypeCli
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BinType

type BinType int

func (BinType) Prefix added in v0.4.0

func (typ BinType) Prefix() string

Prefix is found in the beginning of some archive and file names in DuckDB packages

type Result added in v0.2.0

type Result struct {
	OutputFile string
	// OutputWritten may be false if there was an existing appropriate file and Spec.Overwrite was false
	// See Spec.Overwrite for details.
	OutputWritten bool
}

func Do

func Do(spec Spec) (Result, error)

Do downloads a DuckDB release

type Spec

type Spec struct {
	// Type of binary to download (enum)
	Type BinType

	// DuckDB version, defaults to latest
	// Supported values are either plain semantic version with optional 'v' prefix - e.g. 1.2.2, v1.3.2,
	// or "latest" - latest release version
	// or "preview" - latest preview version from https://duckdb.org/docs/installation/?version=main
	Version string

	// Target OS, defaults to runtime.GOOS
	OS string

	// Target arch defaults, to runtime.GOARCH
	Arch string

	// CacheDownload enables caching the bundle downloaded from the Internet in the temp directory,
	// if the server supports it by exposing Etag and Content-Length headers.
	// CacheDownload is independent of the Overwrite setting.
	CacheDownload bool

	// Overwrite forces overwriting the final file even if there is an existing appropriate in the working directory
	// The definition of "appropriate" will evolve over time - for now, all existing files are accepted.
	Overwrite bool
}

Spec defines the desired DuckDB binary and download options Use DefaultSpec() to get a recommended configuration. The zero value is also valid.

func DefaultSpec

func DefaultSpec() Spec

DefaultSpec creates a recommended spec for downloading releases The zero-value of Spec is also a valid configuration. NB: Changes to the default spec are not considered breaking changes and may happen in a minor release. They won't happen in patch releases.

Jump to

Keyboard shortcuts

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