citygraph

package module
v0.0.0-...-8a1e6a1 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2023 License: Apache-2.0 Imports: 19 Imported by: 5

README

Citygraph: Torontoverse client library

This library contains tools and functions required for interfacing with torontoverse.com.

These building blocks can be used to build bots and tools that seamlessly integrate into the ecosystem.

Documentation

Overview

Package citygraph contains code for interacting with the Torontoverse.

Index

Constants

This section is empty.

Variables

View Source
var (
	ArticleType = &pb.Identifier{Value: "news-contributor-article"}
	IsRelated   = pb.Identifier{Value: "is-related"}
)
View Source
var (
	// PropertyNameDisplayName identifies the name for this vertex that should
	// be displayed when thnis vertex is viewed. If this data is meaningful, it
	// should be duplicated in another property with a more descriptive name.
	PropertyNameDisplayName = "display_name"

	PropertyNameUpdatedAt = "updated_at"
)
View Source
var (
	PropertyNameBodyText = "body"
	// PropertyNameBodyTextFormat identifies the format for the module's display, default is
	// "content-flex" but also possible in "content-map".
	PropertyNameFormat = "format"
	// PropertyNameImgURL identifies a property containing a URL pointing at an
	// image that should be used for promotion, eg. OpenGraph, feed entries, etc.
	PropertyNameImgURL = "img_url"
	PropertyNameJSFunc = "javascript_function"
)
View Source
var (
	// PropertyNameGeoJSONFeature identifies a property containing a GeoJSON
	// feature or feature collection object.
	PropertyNameGeoJSONFeature = "geojson_feature"
	// PropertyNameGeoJSONShape identifies a property containing GeoJSON
	// compatible geometry that can be included in a feature or feature
	// collection object.
	PropertyNameGeoJSONShape = "geojson_shape"
	// PropertyNameGeoJSONURL identifies a property containing a URL string
	// pointing at a location that will return a valid GeoJSON feature or
	// feeature collection.
	PropertyNameGeoJSONURL = "geojson_url"
)

GeoJSON property names.

View Source
var (
	// CityPrimary identifies a city that is the biggest in its geographic area
	// like Toronto, London or Stockholm.
	CityPrimary = pb.Identifier{Value: "city-primary"}

	// CityIntersection identifies an intersection inside a city.
	CityIntersection = pb.Identifier{Value: "city-intersection"}

	// CityNeighbourhood identifies an neighbourhood inside a city.
	CityNeighbourhood = pb.Identifier{Value: "city-neighbourhood"}

	// CityMayorOffice identifies the mayor's office of a city but not any
	// particular mayor individually.
	CityMayorOffice = pb.Identifier{Value: "city-mayor-office"}

	// CityWard identifies a Ward, a typical city constituency.
	CityWard = pb.Identifier{Value: "city-ward"}

	// A waterfront recreation location that may or may not feature sand.
	Beach = pb.Identifier{Value: "beach"}
)
View Source
var (
	//HasOffice points from a municipality to offices it maintains, like mayor.
	HasOffice = pb.Identifier{Value: "has-office"}

	//HasConstituency points from a municipality to it's electoral constituencies.
	HasConstituency = pb.Identifier{Value: "has-constituency"}
)
View Source
var (
	MarieCurtisParkEastBeach = &pb.Vertex{
		Id: &pb.Uuid{
			Value: MustParseUUIDBytes("ae5c6ed8-ffc1-11eb-b867-244bfe5bf61a"),
		},
		T: &Beach,
	}
	SunnysideBeach = &pb.Vertex{
		Id: &pb.Uuid{
			Value: MustParseUUIDBytes("ae5c6ec1-ffc1-11eb-b867-244bfe5bf61a"),
		},
		T: &Beach,
	}
	HanlansPointBeach = &pb.Vertex{
		Id: &pb.Uuid{
			Value: MustParseUUIDBytes("ae5c6ea4-ffc1-11eb-b867-244bfe5bf61a"),
		},
		T: &Beach,
	}
	GibraltarPointBeach = &pb.Vertex{
		Id: &pb.Uuid{
			Value: MustParseUUIDBytes("ae5c6e96-ffc1-11eb-b867-244bfe5bf61a"),
		},
		T: &Beach,
	}
	CentreIslandBeach = &pb.Vertex{
		Id: &pb.Uuid{
			Value: MustParseUUIDBytes("ae5c6e78-ffc1-11eb-b867-244bfe5bf61a"),
		},
		T: &Beach,
	}
	WardsIslandBeach = &pb.Vertex{
		Id: &pb.Uuid{
			Value: MustParseUUIDBytes("ae5c6e50-ffc1-11eb-b867-244bfe5bf61a"),
		},
		T: &Beach,
	}
	CherryBeach = &pb.Vertex{
		Id: &pb.Uuid{
			Value: MustParseUUIDBytes("ae5c6e44-ffc1-11eb-b867-244bfe5bf61a"),
		},
		T: &Beach,
	}
	WoodbineBeaches = &pb.Vertex{
		Id: &pb.Uuid{
			Value: MustParseUUIDBytes("ae5c6e2d-ffc1-11eb-b867-244bfe5bf61a"),
		},
		T: &Beach,
	}
	KewBalmyBeach = &pb.Vertex{
		Id: &pb.Uuid{
			Value: MustParseUUIDBytes("ae5c6e18-ffc1-11eb-b867-244bfe5bf61a"),
		},
		T: &Beach,
	}
	BluffersParkBeach = &pb.Vertex{
		Id: &pb.Uuid{
			Value: MustParseUUIDBytes("ae5c6db6-ffc1-11eb-b867-244bfe5bf61a"),
		},
		T: &Beach,
	}
)

Toronto Beaches

View Source
var (
	// Vertex types
	NewsPublisher    = pb.Identifier{Value: "news-publisher"}
	NewsArticle      = pb.Identifier{Value: "news-article"}
	NewsWireArticle  = pb.Identifier{Value: "news-wire-article"}
	NewsWireBulletin = pb.Identifier{Value: "news-wire-bulletin"}
	NewsAuthor       = pb.Identifier{Value: "news-author"}
	NewsCategory     = pb.Identifier{Value: "news-category"}
	NewsImage        = pb.Identifier{Value: "news-image"}
	NewsGeoJSON      = pb.Identifier{Value: "news-geojson"}

	// Edge types
	Published      = pb.Identifier{Value: "published"}       // author or publisher -> publish -> item.
	PublishedBy    = pb.Identifier{Value: "published-by"}    // item -> published by -> author or publisher
	PublishesAbout = pb.Identifier{Value: "publishes-about"} // item or publisher -> about -> a category.
	ItemAbout      = pb.Identifier{Value: "item-about"}      // item or publisher -> about -> a category.
	IllustratedBy  = pb.Identifier{Value: "illustrated-by"}
	CoversTopic    = pb.Identifier{Value: "covers-topic"}
	Featuring      = pb.Identifier{Value: "featuring"}
)

News Types

View Source
var (
	PlaceType = pb.Identifier{Value: "poi"}

	HasOtherLocation = &pb.Identifier{Value: "has-other-location"}
)
View Source
var ModuleType = &pb.Identifier{Value: "module"}
View Source
var (
	// PropertyNameSource identifies a property containing a source object
	// that describes the provider or the dataset and the license under which
	// it is being used.
	PropertyNameSource = "source"
)

Dataset property names.

View Source
var (
	Toronto = &pb.Vertex{
		Id: &pb.Uuid{
			Value: MustParseUUIDBytes("ae5c6bc0-ffc1-11eb-b867-244bfe5bf61a"),
		},
		T: &CityPrimary,
	}
)

Municipal anchor vertices

View Source
var (
	Torontoverse = &pb.Vertex{
		Id: &pb.Uuid{
			Value: MustParseUUIDBytes("ae5c6bb4-ffc1-11eb-b867-244bfe5bf61a"),
		},
		T: &NewsPublisher,
	}
)

Functions

func FloatVal

func FloatVal(num float64) *pb.Json

FloatVal creates a JSON protobuf value from a provided int.

func IntVal

func IntVal(num int) *pb.Json

IntVal creates a JSON protobuf value from a provided int.

func Json

func Json(b []byte) *pb.Json

Json creates a JSON protobuf object value from the provided json byte array.

func LngLatVal

func LngLatVal(loc LngLat) *pb.Json

LngLatVal creates a JSON protobuf value from a provided LngLat.

func MustParseUUIDBytes

func MustParseUUIDBytes(id string) []byte

func NewEdgePropertyQuery

func NewEdgePropertyQuery(inner *pb.EdgeQuery, name string) *pb.EdgePropertyQuery

NewEdgePropertyQuery generates an edge property query.

func NewID

func NewID() uuid.UUID

NewID() returns a v1 UUID (or panics, which seems reasonable). The v1 UUID is used here for it's convenient ordering.

func NewPipeEdgeQuery

func NewPipeEdgeQuery(inner *pb.VertexQuery, dir pb.EdgeDirection, t *pb.Identifier) *pb.EdgeQuery

NewPipeEdgeQuery returns a new query for the provided edge keys.

func NewPipeEdgeQueryLimit

func NewPipeEdgeQueryLimit(inner *pb.VertexQuery, dir pb.EdgeDirection, t *pb.Identifier, limit int) *pb.EdgeQuery

NewPipeEdgeQueryLimit returns a new query for the provided edge keys.

func NewPipeEdgeQueryLimitOffset

func NewPipeEdgeQueryLimitOffset(inner *pb.VertexQuery, dir pb.EdgeDirection, t *pb.Identifier, limit int, low *timestamppb.Timestamp) *pb.EdgeQuery

NewPipeEdgeQueryLimitOffset returns a new query for the provided edge keys.

func NewPipeVertexQuery

func NewPipeVertexQuery(inner *pb.EdgeQuery, dir pb.EdgeDirection, t *pb.Identifier) *pb.VertexQuery

NewPipeVertexQuery returns a new query for the provided edge keys.

func NewSpecificEdgeQuery

func NewSpecificEdgeQuery(keys ...*pb.EdgeKey) *pb.EdgeQuery

NewSpecificEdgeQuery returns a new query for the provided edge keys.

func NewSpecificVertexQuery

func NewSpecificVertexQuery(ids ...*pb.Uuid) *pb.VertexQuery

NewSpecificVertexQuery returns a new query for the provided UUIDs.

func NewVertexPropertyQuery

func NewVertexPropertyQuery(inner *pb.VertexQuery, name string) *pb.VertexPropertyQuery

NewVertexPropertyQuery generates a vertex property query.

func SetEdgePropertiesRequest

func SetEdgePropertiesRequest(inner *pb.EdgeQuery, name string, jsonValue interface{}) (*pb.SetEdgePropertiesRequest, error)

SetEdgePropertiesRequest encodes the supplied value as JSON and returns a request to set that value for the supplied EdgeQuery and property name.

func SetVertexPropertiesRequest

func SetVertexPropertiesRequest(inner *pb.VertexQuery, name string, jsonValue interface{}) (*pb.SetVertexPropertiesRequest, error)

SetVertexPropertiesRequest encodes the supplied value as JSON and returns a request to set that value for the supplied VertexQuery and property name.

func StringVal

func StringVal(str string) *pb.Json

StringVal creates a JSON protobuf value from the provided string.

func UUID

func UUID(id uuid.UUID) *pb.Uuid

UUID wraps a UUID (preferably v1 for ordering) in a graph client proto.

Types

type Article

type Article struct {
	LoadedFrom   string                 `json:"-"`
	ID           string                 `json:"id"`
	Name         string                 `json:"display_name"`
	PastNames    []string               `json:"past_names"`
	Headline     string                 `json:"headline_html,omitempty"`
	Description  string                 `json:"h2"`
	FeatureImage string                 `json:"img_url"`
	IsLive       bool                   `json:"is_live"`
	Categories   []string               `json:"categories"`
	Authors      []string               `json:"authors"`
	Pitch        float64                `json:"pitch,omitempty"`
	Camera       map[string]interface{} `json:"camera,omitempty"`
	Promo        string                 `json:"promo,omitempty"`
	PubDate      string                 `json:"pub_date"`
	LastUpdated  string                 `json:"last_updated,omitempty"`
	CodeCredit   string                 `json:"code_credit"`
	PromoAt      time.Time              `json:"promo_start"`
	PromoUntil   time.Time              `json:"promo_until"`
	PromoWait    Duration               `json:"promo_wait"`
	PromoExpires time.Time              `json:"promo_expires,omitempty"`
	Slug         string                 `json:"slug,omitempty"`
	//	Loc             citygraph.LngLat       `json:"loc,omitempty"`
	//	Zoom            float64                `json:"zoom,omitempty"`
	Related         []string               `json:"related,omitempty"`
	GeoJSONDatasets []*GeoJSONDataset      `json:"geojson_datasets,omitempty"`
	Teaser          map[string]interface{} `json:"teaser,omitempty"`
	Format          string                 `json:"format,omitempty"`
}

func (*Article) AllSlugTitles

func (a *Article) AllSlugTitles() (slugs []string)

AllSlugTitles includes past slug titles form former headlines that may still be out there as valid links.

func (*Article) LoadBodyText

func (a *Article) LoadBodyText() (string, error)

func (*Article) Path

func (a *Article) Path() (string, error)

func (*Article) SlugID

func (a *Article) SlugID() (string, error)

func (*Article) SlugTitle

func (a *Article) SlugTitle() string

func (*Article) UUID

func (a *Article) UUID() (uuid.UUID, error)

func (*Article) VertexQuery

func (a *Article) VertexQuery() (*pb.VertexQuery, error)

type Bar

type Bar struct {
	Style string `json:"style,omitempty"`
}

Bar contains details specific to bar POIs.

type BulkSender

type BulkSender interface {
	Send(*pb.BulkInsertItem) error
	CloseAndRecv() (*emptypb.Empty, error)
}

type Cafe

type Cafe struct {
	Style string `json:"style,omitempty"`
}

Cafe contains details specific to cafe POIs.

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(conn grpc.ClientConnInterface) *Client

func (*Client) CreateEdge

func (c *Client) CreateEdge(ctx context.Context, outbound *pb.Uuid, t *pb.Identifier, inbound *pb.Uuid) error

func (*Client) CreateVertex

func (c *Client) CreateVertex(ctx context.Context, id *pb.Uuid, t *pb.Identifier) error

func (*Client) CreateVertexFromType

func (c *Client) CreateVertexFromType(ctx context.Context, t *pb.Identifier) (*pb.Uuid, error)

func (*Client) DeleteEdges

func (c *Client) DeleteEdges(ctx context.Context, query *pb.EdgeQuery) error

func (*Client) DeleteVertices

func (c *Client) DeleteVertices(ctx context.Context, query *pb.VertexQuery) error

func (*Client) GetAllEdgeProperties

func (c *Client) GetAllEdgeProperties(ctx context.Context, query *pb.EdgeQuery) ([]*pb.EdgeProperties, error)

func (*Client) GetAllVertexProperties

func (c *Client) GetAllVertexProperties(ctx context.Context, query *pb.VertexQuery) ([]*pb.VertexProperties, error)

func (*Client) GetEdgeProperties

func (c *Client) GetEdgeProperties(ctx context.Context, query *pb.EdgeQuery, name string) ([]*pb.EdgeProperty, error)

func (*Client) GetEdges

func (c *Client) GetEdges(ctx context.Context, query *pb.EdgeQuery) ([]*pb.Edge, error)

func (*Client) GetVertexProperties

func (c *Client) GetVertexProperties(ctx context.Context, query *pb.VertexQuery, name string) ([]*pb.VertexProperty, error)

func (*Client) GetVertices

func (c *Client) GetVertices(ctx context.Context, query *pb.VertexQuery) ([]*pb.Vertex, error)

func (*Client) NewBulkSender

func (c *Client) NewBulkSender(ctx context.Context) (BulkSender, error)

func (*Client) SetEdgeProperties

func (c *Client) SetEdgeProperties(ctx context.Context, query *pb.EdgeQuery, name string, jsonValue interface{}) error

func (*Client) SetVertexProperties

func (c *Client) SetVertexProperties(ctx context.Context, query *pb.VertexQuery, name string, jsonValue interface{}) error

type Duration

type Duration struct {
	time.Duration
}

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(b []byte) error

type FakeGraphClient

type FakeGraphClient struct {
	sync.Mutex

	CreateVertexReqs            []*pb.Vertex
	CreateVertexFromTypeReqs    []*pb.Identifier
	CreateVertexFromTypeResps   []*pb.Uuid
	GetVerticesReqs             []*pb.VertexQuery
	GetVerticesResps            [][]*pb.Vertex
	GetVertexPropertiesReqs     []*pb.VertexPropertyQuery
	GetVertexPropertiesResps    [][]*pb.VertexProperty
	SetVertexPropertiesReqs     []*pb.SetVertexPropertiesRequest
	GetAllVertexPropertiesReqs  []*pb.VertexQuery
	GetAllVertexPropertiesResps [][]*pb.VertexProperties

	CreateEdgeReqs            []*pb.EdgeKey
	DeleteEdgesReqs           []*pb.EdgeQuery
	GetEdgesReqs              []*pb.EdgeQuery
	GetEdgesResps             [][]*pb.Edge
	GetEdgePropertiesReqs     []*pb.EdgePropertyQuery
	GetEdgePropertiesResps    [][]*pb.EdgeProperty
	SetEdgePropertiesReqs     []*pb.SetEdgePropertiesRequest
	GetAllEdgePropertiesReqs  []*pb.EdgeQuery
	GetAllEdgePropertiesResps [][]*pb.EdgeProperties
}

func (*FakeGraphClient) CreateEdge

func (f *FakeGraphClient) CreateEdge(ctx context.Context, outbound *pb.Uuid, t *pb.Identifier, inbound *pb.Uuid) error

func (*FakeGraphClient) CreateVertex

func (f *FakeGraphClient) CreateVertex(ctx context.Context, id *pb.Uuid, t *pb.Identifier) error

func (*FakeGraphClient) CreateVertexFromType

func (f *FakeGraphClient) CreateVertexFromType(ctx context.Context, t *pb.Identifier) (*pb.Uuid, error)

func (*FakeGraphClient) DeleteEdges

func (f *FakeGraphClient) DeleteEdges(ctx context.Context, query *pb.EdgeQuery) error

func (*FakeGraphClient) DeleteVertices

func (c *FakeGraphClient) DeleteVertices(ctx context.Context, query *pb.VertexQuery) error

func (*FakeGraphClient) GetAllEdgeProperties

func (f *FakeGraphClient) GetAllEdgeProperties(ctx context.Context, query *pb.EdgeQuery) ([]*pb.EdgeProperties, error)

func (*FakeGraphClient) GetAllVertexProperties

func (f *FakeGraphClient) GetAllVertexProperties(ctx context.Context, query *pb.VertexQuery) ([]*pb.VertexProperties, error)

func (*FakeGraphClient) GetEdgeProperties

func (f *FakeGraphClient) GetEdgeProperties(ctx context.Context, query *pb.EdgeQuery, name string) ([]*pb.EdgeProperty, error)

func (*FakeGraphClient) GetEdges

func (f *FakeGraphClient) GetEdges(ctx context.Context, query *pb.EdgeQuery) ([]*pb.Edge, error)

func (*FakeGraphClient) GetVertexProperties

func (f *FakeGraphClient) GetVertexProperties(ctx context.Context, query *pb.VertexQuery, name string) ([]*pb.VertexProperty, error)

func (*FakeGraphClient) GetVertices

func (f *FakeGraphClient) GetVertices(ctx context.Context, query *pb.VertexQuery) ([]*pb.Vertex, error)

func (*FakeGraphClient) NewBulkSender

func (f *FakeGraphClient) NewBulkSender(ctx context.Context) (BulkSender, error)

func (*FakeGraphClient) SetEdgeProperties

func (f *FakeGraphClient) SetEdgeProperties(ctx context.Context, query *pb.EdgeQuery, name string, jsonValue interface{}) error

func (*FakeGraphClient) SetVertexProperties

func (f *FakeGraphClient) SetVertexProperties(ctx context.Context, query *pb.VertexQuery, name string, jsonValue interface{}) error

type GeoJSONDataset

type GeoJSONDataset struct {
	ID      string    `json:"id"`
	Name    string    `json:"name"`
	URL     string    `json:"url"`
	Render  string    `json:"render,omitempty"`
	Source  *Source   `json:"source,omitempty"`
	Sources []*Source `json:"sources,omitempty"`
}

func (*GeoJSONDataset) UUID

func (d *GeoJSONDataset) UUID() (uuid.UUID, error)

func (*GeoJSONDataset) VertexQuery

func (d *GeoJSONDataset) VertexQuery() (*pb.VertexQuery, error)

type GraphClient

type GraphClient interface {
	CreateVertex(context.Context, *pb.Uuid, *pb.Identifier) error
	CreateVertexFromType(context.Context, *pb.Identifier) (*pb.Uuid, error)
	DeleteVertices(context.Context, *pb.VertexQuery) error
	GetVertexProperties(context.Context, *pb.VertexQuery, string) ([]*pb.VertexProperty, error)
	SetVertexProperties(context.Context, *pb.VertexQuery, string, interface{}) error
	GetVertices(context.Context, *pb.VertexQuery) ([]*pb.Vertex, error)
	GetAllVertexProperties(context.Context, *pb.VertexQuery) ([]*pb.VertexProperties, error)
	DeleteEdges(context.Context, *pb.EdgeQuery) error
	CreateEdge(context.Context, *pb.Uuid, *pb.Identifier, *pb.Uuid) error
	GetEdges(context.Context, *pb.EdgeQuery) ([]*pb.Edge, error)
	GetEdgeProperties(context.Context, *pb.EdgeQuery, string) ([]*pb.EdgeProperty, error)
	SetEdgeProperties(context.Context, *pb.EdgeQuery, string, interface{}) error
	GetAllEdgeProperties(context.Context, *pb.EdgeQuery) ([]*pb.EdgeProperties, error)

	NewBulkSender(ctx context.Context) (BulkSender, error)
}

type Image

type Image struct {
	URL string `json:"url"`
	Alt string `json:"alt"`
}

type LngLat

type LngLat struct {
	Lng float64 `json:"lng"`
	Lat float64 `json:"lat"`
}

LngLat represents a geographic coordinate in the map. Encodes directly into a Mapbox-compatible json object.

type Module

type Module struct {
	ID           string                 `json:"id"`
	Name         string                 `json:"display_name"`
	Headline     string                 `json:"headline_html,omitempty"`
	Description  string                 `json:"desc"`
	FeatureImage string                 `json:"img_url"`
	Format       string                 `json:"format"`
	Categories   []string               `json:"categories"`
	Creators     []string               `json:"creators"`
	Camera       map[string]interface{} `json:"camera,omitempty"`
	PubDate      string                 `json:"pub_date"`
	LastUpdated  string                 `json:"last_updated,omitempty"`
	CodeCredit   string                 `json:"code_credit"`
	Teaser       map[string]interface{} `json:"teaser,omitempty"`
}

func (*Module) SlugID

func (a *Module) SlugID() (string, error)

func (*Module) SlugTitle

func (a *Module) SlugTitle() string

func (*Module) UUID

func (a *Module) UUID() (uuid.UUID, error)

func (*Module) VertexQuery

func (a *Module) VertexQuery() (*pb.VertexQuery, error)

type Place

type Place struct {
	ID      string    `json:"id"`
	Name    string    `json:"name"`
	Desc    string    `json:"description"`
	AddedAt time.Time `json:"added_at"`
	// PhoneNumber should be formatted like this: "416-902-7200".
	PhoneNumber string `json:"phone_number"`
	Address     string `json:"street_address"`
	// Status is all OK if missing/empty otherwise "Closed" and "Temporarily closed".
	Status string `json:"status,omitempty"`
	// Established records when the business was established.
	Established string `json:"established"`
	// Instagram is the business or location's Instagram username.
	Instagram string `json:"instagram"`
	// Twitter is the business or location's Twitter username.
	Twitter   string `json:"twitter"`
	ForFeed   bool   `json:"for_feed"`
	URL       string `json:"url"`
	ShortName string `json:"short_name"`
	Type      string `json:"type"`
	// Restaurant is optional, will be present only for some restaurant-type locations.
	Restaurant *Restaurant `json:"restaurant"`
	// Bar is optional, will be present only for some bar-type locations.
	Bar *Bar `json:"bar"`
	// Cafe is optional, will be present only for some cafe-type locations.
	Cafe      *Cafe            `json:"cafe"`
	Sprite    string           `json:"sprite"`
	Location  LngLat           `json:"location"`
	Images    []*Image         `json:"images,omitempty"`
	Locations []*PlaceLocation `json:"locations"`
}

func (*Place) SlugTitle

func (p *Place) SlugTitle() string

func (*Place) UUID

func (p *Place) UUID() (uuid.UUID, error)

func (*Place) VertexQuery

func (p *Place) VertexQuery() (*pb.VertexQuery, error)

type PlaceLocation

type PlaceLocation struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	// Status is all OK if missing/empty otherwise "Closed" and "Temporarily closed".
	Status string `json:"status,omitempty"`
	// PhoneNumber should be formatted like this: "416-902-7200".
	PhoneNumber string `json:"phone_number"`
	// Address holds the street address of the location in the form "123 Sesame St W".
	Address  string   `json:"street_address"`
	City     string   `json:"city,omitempty"`
	Location LngLat   `json:"location"`
	Images   []*Image `json:"images,omitempty"`
	// Restaurant is optional, will be present only for some restaurant-type locations.
	Restaurant *Restaurant `json:"restaurant"`
	// Bar is optional, will be present only for some bar-type locations.
	Bar *Bar `json:"bar"`
	// Cafe is optional, will be present only for some cafe-type locations.
	Cafe *Cafe `json:"cafe"`
}

func (*PlaceLocation) SlugID

func (p *PlaceLocation) SlugID() (string, error)

func (*PlaceLocation) UUID

func (p *PlaceLocation) UUID() (uuid.UUID, error)

func (*PlaceLocation) VertexQuery

func (p *PlaceLocation) VertexQuery() (*pb.VertexQuery, error)

type Restaurant

type Restaurant struct {
	Style         string `json:"style,omitempty"`
	OpenTable     string `json:"open_table,omitempty"`
	Ritual        string `json:"ritual,omitempty"`
	SkipTheDishes string `json:"skip_the_dishes,omitempty"`
	Custom        string `json:"custom,omitempty"`
}

Restaurant contains details specific to restaurant POIs.

type Source

type Source struct {
	Title        string `json:"title"`
	Provider     string `json:"provider"`
	URL          string `json:"url"`
	DateAcquired string `json:"date_acquired"`
	Description  string `json:"description"`
	License      string `json:"license"`
	LicenseURL   string `json:"license_url"`
}

Directories

Path Synopsis
feed_producer
pb

Jump to

Keyboard shortcuts

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