whosonfirst / go-whosonfirst-export

Go package for exporting Who's On First documents.
BSD 3-Clause "New" or "Revised" License
2 stars 1 forks source link

Add ExportChanged function #10

Closed tomtaylor closed 4 years ago

tomtaylor commented 4 years ago

The current implementation of Export always updates a feature, regardless of whether anything of meaning has changed, because it increments the lastmodified timestamp regardless.

However, it's useful sometimes to only perform an export if there are changes that need writing out, such as when dealing with 2M postcodes, and trying to minimise the amount of noise git collects.

ExportChanged makes this possible without needing to understand the ins and outs of preparing and formatting.

straup commented 4 years ago

This looks good with the exception of the prepare method no longer being public (because the method name has been lower-cased). Can you make sure that it's public. It's a useful thing to have access to outside of an immediate export use-case.

tomtaylor commented 4 years ago

There's still a public Prepare method which should behave exactly as before. Just there's also a lowercased internal prepare method which doesn't do the timestamping. Can rename it if that's confusing.

thisisaaronland commented 4 years ago

Oh, I missed that. Yeah, I guess it would good to rename the private prepare method just so there's less confusing.

Otherwise, LGTM. Feel free to merge and publish a new release.