Go package that provides a common interface for writing data to multiple sources.
Writers are instantiated with the writer.NewWriter
method which takes as its arguments a context.Context
instance and a URI string. The URI's scheme represents the type of writer it implements and the remaining (URI) properties are used by that writer type to instantiate itself. For example:
import (
"context"
"github.com/whosonfirst/go-writer/v2"
"strings"
)
func main() {
ctx := context.Background()
r := strings.NewReader("Hello world")
wr, _ := writer.NewWriter(ctx, "fs:///usr/local/example")
wr.Write(ctx, wr, "hello/world.txt", r)
}
Error handling omitted for the sake of brevity.
The following writers are exported by this package. Additional writers are defined in separate go-writer-* packages.
Implements the Writer
interface for writing documents to the current working directory.
Implements the Writer
interface for writing documents as files on a local disk.
Implements the Writer
interface for writing documents to an io.Writer
instance.
Implements the Writer
interface for writing documents to multiple Writer
instances.
Implements the Writer
interface for writing documents to nowhere.
Implements the Writer
interface for writing documents to a Who's On First "data" directory.
Implements the Writer
interface for writing documents to STDOUT.