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 ¶
- func ApplyEDTFFixes(ctx context.Context, body []byte, props_map map[string]interface{}) map[string]interface{}
- func ApplySFOMuseumProperties(ctx context.Context, opts *SFOMuseumPropertiesOptions, ids ...int64) error
- func CreateCustomProperties(ctx context.Context, wr writer.Writer, id int64) (map[string]interface{}, error)
- func EnsureCustomProperties(ctx context.Context, r reader.Reader, wr writer.Writer, id int64) (map[string]interface{}, error)
- func Id2RelPath(id int64) (string, error)
- func MergeCustomProperties(ctx context.Context, props_r reader.Reader, data_r reader.Reader, ...) error
- func ReadCustomProperties(ctx context.Context, r reader.Reader, id int64) (map[string]interface{}, error)
- func WriteCustomProperties(ctx context.Context, wr writer.Writer, id int64, ...) error
- type SFOMuseumPropertiesOptions
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 ¶
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.
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.