From 826637167c6e17ce5622804cbece8b5391fb764c Mon Sep 17 00:00:00 2001 From: Martchus Date: Tue, 18 Jan 2022 22:35:23 +0100 Subject: [PATCH] Update README for Reflective RapidJSON --- README.md | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 72976ff..90cf441 100644 --- a/README.md +++ b/README.md @@ -264,22 +264,14 @@ struct DNSResourceRecord ``` And we want to do so based on the `qname`, `domain_id` or `ordername` -fields. First, we have to make sure DNSResourceRecord can serialize itself -to a string: - -``` -template -void serialize(Archive & ar, DNSResourceRecord& g, const unsigned int version) -{ - ar & g.qtype; - ar & g.qname; - ar & g.content; - ar & g.ttl; - ar & g.domain_id; - ar & g.ordername; - ar & g.auth; -} -``` +fields. First, we have to make sure DNSResourceRecord can be (de)serialized +to/from a string. For that you need to implement `serToString(const T& t)` and +`serFromString(const string_view& str, T& ret)` like it is shown in +`lmdb-reflective.hh` which uses +[Reflective RapidJSON](https://github.com/Martchus/reflective-rapidjson)'s +binary (de)serializer to ease that task. You can also use Boost.Serialization. +It might also be helpful to utilize Boost.Hana, e.g. in combination with the +previously mentioned libraries. Next up, we need to define our "Object Relational Mapper":