dwca

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: MIT Imports: 22 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Vers of the app. Hardcoded version appears only in release builds.
	Vers = "v0.2.6"

	// Build timestamp
	Build string
)

Functions

func Version

func Version() gnvers.Version

Types

type Archive

type Archive interface {
	// Config returns the configuration object of the archive.
	Config() config.Config

	// Meta returns the Meta object of the archive.
	Meta() *meta.Meta

	// EML returns the EML object of the archive.
	EML() *eml.EML

	// Load extracts the archive and loads data for EML and Meta.
	// Path determines internal location of the extracted archive.
	Load(path string) error

	// Close cleans up temporary files.
	Close() error

	// CoreSlice takes an offset and a limit and returns a slice of slices of
	// strings, each slice representing a row of the core file. If limit and
	// offset are provided, it returns the corresponding subset of the data.
	CoreSlice(offset, limit int) ([][]string, error)

	// CoreStream takes a channel and populates the channel with slices of
	// strings, each slice representing a row of the core file. The channel
	// is closed when the data is exhausted.
	CoreStream(context.Context, chan<- []string) (int, error)

	// ExtensionSlice takes an index, offset and limit and returns a slice of
	// slices of strings, each slice representing a row of the extension file.
	// Index corresponds the index of the extension in the extension list.
	// If limit and offset are provided, it returns the corresponding subset
	// of the data.
	ExtensionSlice(index, offset, limit int) ([][]string, error)

	// ExtensionStream takes an index and a channel and populates the channel
	// with slices of strings, each slice representing a row of the extension
	// file. The channel is closed when the data is exhausted.
	// Index corresponds the index of the extension in the extension list.
	ExtensionStream(
		ctx context.Context,
		index int, ch chan<- []string,
	) (int, error)

	// Normalize creates a normalized version of Darwin Core Archive
	// with all known ambiguities resolved. The output is written to a file
	// with the provided fileName.
	Normalize() error

	// ZipNorgalized compresses a normalized version of Darwin Core Archive
	// to a ZIP file with the provided filePath.
	ZipNormalized(filePath string) error

	// TarGzNormalized compresses a normalized version of Darwin Core Archive
	// to a TAR file with the provided filePath.
	TarGzNormalized(filePath string) error
}

Archive is an interface for Darwin Core Archive objects.

func Factory

func Factory(fpath string, cfg config.Config) (Archive, error)

Factory creates a new DwCA object. It takes a list of options for the configuration, and a path to the DwCA file. The path is used to initialize the DwCA object, and the options are used to configure the object. This function is the only place where concrete IO objects are allowed.

func FactoryOutput added in v0.2.0

func FactoryOutput(cfg config.Config) (Archive, error)

FactoryOutput creates a new DwCA object from normalized output DwCA.

func New

func New(cfg config.Config, df dcfile.DCFile) Archive

New creates a new Archive object. It takes configuration file and necessary internal objects to handle the DwCA archive.

Directories

Path Synopsis
ent
eml
package eml contains structures that represent the EML file format.
package eml contains structures that represent the EML file format.

Jump to

Keyboard shortcuts

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