Documentation ¶
Overview ¶
Package chiv archives relational data to Amazon S3.
Index ¶
- func Archive(db Database, s3 Uploader, table, bucket string, options ...Option) error
- func ArchiveRows(rows Rows, s3 Uploader, bucket string, options ...Option) error
- func ArchiveRowsWithContext(ctx context.Context, rows Rows, s3 Uploader, bucket string, options ...Option) error
- func ArchiveWithContext(ctx context.Context, db Database, s3 Uploader, table, bucket string, ...) error
- type Archiver
- func (a *Archiver) Archive(table, bucket string, options ...Option) error
- func (a *Archiver) ArchiveRows(rows Rows, bucket string, options ...Option) (err error)
- func (a *Archiver) ArchiveRowsWithContext(ctx context.Context, rows Rows, bucket string, options ...Option) (err error)
- func (a *Archiver) ArchiveWithContext(ctx context.Context, table, bucket string, options ...Option) (err error)
- type Column
- type Database
- type Extensioner
- type Formatter
- type FormatterFunc
- type Option
- type Rows
- type Uploader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArchiveRows ¶
ArchiveRows to S3.
Types ¶
type Archiver ¶
type Archiver struct {
// contains filtered or unexported fields
}
Archiver archives database tables to Amazon S3.
func NewArchiver ¶
NewArchiver constructs an archiver with the given Database, S3 uploader and options. Options set on creation apply to all calls to Archive unless overridden.
func (*Archiver) Archive ¶
Archive a Database table to S3. Any options provided override those set on creation.
func (*Archiver) ArchiveRows ¶
ArchiveRows to S3.
type Database ¶
type Database interface {
QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
}
Database queries tables for rows.
type Extensioner ¶
type Extensioner interface {
Extension() string
}
Extensioner is a Formatter that provides a default extension.
type Formatter ¶
type Formatter interface { // Open the Formatter and perform any format-specific initialization. Open() error // Format and write a single record. Format([][]byte) error // Close the Formatter and perform any format-specific cleanup. Close() error }
Formatter formats and writes records. A custom Formatter may implement Extensioner to provide chiv with a default file extension.
type FormatterFunc ¶
FormatterFunc returns an initialized Formatter.
type Option ¶
type Option func(*Archiver)
Option configures the Archiver. Options can be provided when creating an Archiver or on each call to Archive.
func WithColumns ¶
WithColumns configures a list of column names to archive.
func WithExtension ¶
WithExtension configures an extension for object keys uploaded to S3.