timeless-partialeq
PartialEq, but ignores timestamps, ideal for API testing
This crate provides a custom derive macro TimelessPartialEq that allows you to implement PartialEq for structs while ignoring fields ending with _at.
Usage
First, add TimelessPartialEq as a dependency.
Then, derive TimelessPartialEq for your struct:
use TimelessPartialEq;
This will generate an implementation of PartialEq that ignores the fields ending with _at, while still checking for Option's outer None & Some values.
Limitations
Currently, it only assert fields (or should I say it does not assert) that end with _at, thus requiring that your structs are forced to be defined that way. It would be a great addition to the current tests if we could check that struct fields that are renamed with another derive proc macro (e.g. a struct that represents a SQLx table fields) also work with TimelessPartialEq.