custom

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Overview

package custom provides methods for working with custom properties to be applied to Who's On First records. This (and the corresponding tools in cmd) should be migrated in to a standalone whosonfirst/go-whosonfirst-custom package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyEDTFFixes

func ApplyEDTFFixes(ctx context.Context, body []byte, props_map map[string]interface{}) map[string]interface{}

ApplyEDTFFixes applies EDTF 2019 updates to 'props_maps' (derived from 'body') if necessary.

func ApplySFOMuseumProperties added in v0.2.0

func ApplySFOMuseumProperties(ctx context.Context, opts *SFOMuseumPropertiesOptions, ids ...int64) error

ApplySFOMuseumProperties updates one or more Who's On First records identified by 'ids' with SFO Museum specific properties.

func CreateCustomProperties

func CreateCustomProperties(ctx context.Context, wr writer.Writer, id int64) (map[string]interface{}, error)

CreateCustomProperties will create a new (empty) properties map for id, using wr.

func EnsureCustomProperties

func EnsureCustomProperties(ctx context.Context, r reader.Reader, wr writer.Writer, id int64) (map[string]interface{}, error)

EnsureCustomProperties will ensure that a valid properties map exists for id in r. If it does not an empty properties map file will be written to wr.

func Id2RelPath

func Id2RelPath(id int64) (string, error)

Id2RelPath will return a relative path (URI) for id.

func MergeCustomProperties

func MergeCustomProperties(ctx context.Context, props_r reader.Reader, data_r reader.Reader, data_wr writer.Writer, id int64) error

MergeCustomProperties will merge the custom properties for id read from props_r in to a WOF record (for id) read from data_r. The merged document will be exported and published using data_wr.

func ReadCustomProperties

func ReadCustomProperties(ctx context.Context, r reader.Reader, id int64) (map[string]interface{}, error)

ReadCustomProperties will return a properties map for id, reading the raw data from r.

func WriteCustomProperties

func WriteCustomProperties(ctx context.Context, wr writer.Writer, id int64, props_map map[string]interface{}) error

WriteCustomProperties writes props_map to a relative path derived from id, using wr.

Types

type SFOMuseumPropertiesOptions added in v0.2.0

type SFOMuseumPropertiesOptions struct {
	// DataReader is a `whosonfirst/go-reader.Reader` instance used to read Who's On First records.
	DataReader reader.Reader
	// DataReader is a `whosonfirst/go-writer.Writer` instance used to write Who's On First records.
	DataWriter writer.Writer
	// PropertiesReader is a a `whosonfirst/go-reader.Reader` instance used to read SFO Museum properties.
	PropertiesReader reader.Reader
	// PropertiesWriter is a a `whosonfirst/go-writer.ReaderWriter` instance used to writer SFO Museum properties.
	PropertiesWriter writer.Writer
	// CustomProperties is a dictionary containing SFO Museum properties to append to a Who's On First record.
	CustomProperties map[string]interface{}
}

SFOMuseumPropertiesOptions is a struct containing configuration option for updating Who's On First records with SFO Museum specific properties.

Jump to

Keyboard shortcuts

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