sources

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: BSD-3-Clause Imports: 4 Imported by: 6

README

go-whosonfirst-sources

Go package for working with Who's On First data sources

Example

Simple
import (
	"github.com/whosonfirst/go-whosonfirst-sources"
	"log"
)

log.Println(sources.IsValidSource("sfac"))
log.Println(sources.IsValidSource("chairzen"))

log.Println(sources.IsValidSourceId(404734211))

src, err := sources.GetSourceByName("mapzen")

if err != nil {
   log.Fatal(err)
}

log.Println(src.License)

src, err = sources.GetSourceById(999)

if err != nil {
   log.Fatal(err)
}

Yields:

true
false
true
CC0
Invalid source

See also

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValidSource

func IsValidSource(source string) bool

func IsValidSourceId

func IsValidSourceId(source_id int64) bool

Types

type WOFSource

type WOFSource struct {
	Id          int64  `json:"id"`
	Fullname    string `json:"fullname"`
	Name        string `json:"name"`
	Prefix      string `json:"prefix"`
	Key         string `json:"key"`
	URL         string `json:"url"`
	License     string `json:"license"`
	Description string `json:"description"`
}

func GetSourceById

func GetSourceById(source_id int64) (*WOFSource, error)

func GetSourceByName

func GetSourceByName(source string) (*WOFSource, error)

func GetSourceByPrefix added in v0.2.0

func GetSourceByPrefix(source string) (*WOFSource, error)

type WOFSourceSpecification

type WOFSourceSpecification map[string]WOFSource

func Spec

func Spec() (*WOFSourceSpecification, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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