dataDump

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2019 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(o interface{}, filePrefix string, logger Logger) http.Handler

Handler returns http.Handler that will call DataDump on every o field that implements Interface. If filePrefix is not blank Content-Disposition HTTP header will be added to the response. The response body will be the tar archive containing binary files named by the o fields that implement Interface. The provided interface can be a struct or a map with string keys and interface{} values that will be checked if they implement the Interface.

Types

type Dump

type Dump struct {
	Name        string
	ContentType string
	Length      int64
	ModTime     *time.Time
	Body        io.ReadCloser
}

Dump defines a structure that holds dump metadata and body as reader interface. Body must be closed after the read is done.

type Interface

type Interface interface {
	DataDump(ifModifiedSince *time.Time) (dump *Dump, err error)
}

Interface defines method to retrieve data Dump. If ifModifiedSince is not nil and data is not changed since provided time, both return values, Dump and error, will be nil.

type Logger

type Logger interface {
	Infof(format string, a ...interface{})
	Errorf(format string, a ...interface{})
}

Logger defines methods required for logging.

Jump to

Keyboard shortcuts

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