writer

package module
v3.1.6 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2025 License: BSD-3-Clause Imports: 9 Imported by: 24

README

go-whosonfirst-writer

Common methods for writing Who's On First documents.

Documentation

Go Reference

Examples

Note that error handling has been removed for the sake of brevity.

WriteBytes
import (
	"context"
	"flag"
	"github.com/whosonfirst/go-writer"	
	wof_writer "github.com/whosonfirst/go-whosonfirst-writer"
	"io"
)

func main() {

	flag.Parse()

	ctx := context.Background()
	wr, _ := writer.NewWriter(ctx, "stdout://")
	
	for _, feature_path := range flag.Args() {
	
		r, _ := os.Open(feature_path)
		defer r.Close()
		
		body, _ := io.ReadAll(r)
		wof_writer.WriteBytes(ctx, wr, body)
	}

See also

Documentation

Overview

package writer provides common methods for writing Who's On First documents with `whosonfirst/go-writer.Writer` instances.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteBytes

func WriteBytes(ctx context.Context, wr go_writer.Writer, body []byte) (int64, error)

WriteBytes will write 'body' using 'wr' using a default `whosonfirst/go-whosonfirst-export/v2.Exporter` instance.

func WriteBytesWithExporter

func WriteBytesWithExporter(ctx context.Context, wr go_writer.Writer, ex export.Exporter, body []byte) (int64, error)

WriteBytesWithExporter will write 'body' using 'wr' using a custom `whosonfirst/go-whosonfirst-export/v2.Exporter` instance.

func WriteFeature

func WriteFeature(ctx context.Context, wr go_writer.Writer, f *geojson.Feature) (int64, error)

WriteFeature will serialize and write 'f' using 'wr' using a default `whosonfirst/go-whosonfirst-export/v2.Exporter` instance.

func WriteFeatureWithExporter

func WriteFeatureWithExporter(ctx context.Context, wr go_writer.Writer, ex export.Exporter, f *geojson.Feature) (int64, error)

WriteFeatureWithExporter will serialize and write 'f' using 'wr' using a custom `whosonfirst/go-whosonfirst-export/v2.Exporter` instance.

Types

This section is empty.

Jump to

Keyboard shortcuts

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