reftable/record: introduce function to compare records by key