reader

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2021 License: BSD-3-Clause Imports: 7 Imported by: 36

README

go-whosonfirst-reader

Common methods for reading Who's On First documents.

Examples

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

LoadReadCloserFromID
import (
	"context"
	"github.com/whosonfirst/go-reader"
	wof_reader "github.com/whosonfirst/go-whosonfirst-reader"
	"io"
	"os"
)

func main() {

	ctx := context.Backround()
	wof_id := int64(101736545)

	r_uri := "local:///usr/local/data/whosonfirst-data-admin-ca/data"
	r, _ := reader.NewReader(ctx, r_uri)

	fh, _ := wof_reader.LoadReadCloserFromID(ctx, r, wof_id)
	io.Copy(os.Stdout, fh)
}
LoadBytesFromID
import (
	"context"
	"fmt"
	"github.com/whosonfirst/go-reader"
	wof_reader "github.com/whosonfirst/go-whosonfirst-reader"
)

func main() {

	ctx := context.Backround()
	wof_id := int64(101736545)

	r_uri := "local:///usr/local/data/whosonfirst-data-admin-ca/data"
	r, _ := reader.NewReader(ctx, r_uri)

	body, _ := wof_reader.LoadReadCloserFromID(ctx, r, wof_id)
	fmt.Printf("%d bytes\n", len(body))
}
LoadFeatureFromID
import (
	"context"
	"fmt"
	"github.com/whosonfirst/go-reader"
	wof_reader "github.com/whosonfirst/go-whosonfirst-reader"	
)

func main() {

	ctx := context.Backround()
	wof_id := int64(101736545)

	r_uri := "local:///usr/local/data/whosonfirst-data-admin-ca/data"
	r, _ := reader.NewReader(ctx, r_uri)

	f, _ := wof_reader.LoadFeatureFromID(ctx, r, wof_id)
	fmt.Println(f.Name())
}

See also

Documentation

Overview

package reader provides common logic for whosonfirst/go-reader applications specific to Who's On First documents.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadBytesFromID

func LoadBytesFromID(ctx context.Context, r go_reader.Reader, id int64) ([]byte, error)

func LoadFeatureFromID

func LoadFeatureFromID(ctx context.Context, r go_reader.Reader, id int64) (geojson.Feature, error)

func LoadReadCloserFromID

func LoadReadCloserFromID(ctx context.Context, r go_reader.Reader, id int64) (io.ReadCloser, error)

Types

This section is empty.

Directories

Path Synopsis
package application provides common logic for whosonfirst/go-reader related applications targeting Who's On First documents.
package application provides common logic for whosonfirst/go-reader related applications targeting Who's On First documents.
server
package server provides an HTTP server application for emitting (reading) data from a go-reader instance
package server provides an HTTP server application for emitting (reading) data from a go-reader instance
cmd
package www provides common net/http handlers for reader-related HTTP requests.
package www provides common net/http handlers for reader-related HTTP requests.

Jump to

Keyboard shortcuts

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