-
-
Notifications
You must be signed in to change notification settings - Fork 598
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
45 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
|
||
#pragma once | ||
|
||
#include "kv/value_wrapper_proto.hpp" | ||
|
||
class ValueWrapper; | ||
|
||
#ifndef USE_PRECOMPILED_HEADERS | ||
#include <string> | ||
#include <cstdint> | ||
#endif | ||
|
||
struct StoreDetail { | ||
|
||
std::string toString() const { | ||
return fmt::format("Description: {}, Coin Amount: {}, CreatedAt: {}, Is Gold: {}", description, coinAmount, createdAt, isGold); | ||
} | ||
|
||
ValueWrapper serialize() const { | ||
return { | ||
{ "description", description }, | ||
{ "coinAmount", coinAmount }, | ||
{ "created_at", createdAt }, | ||
{ "is_gold", isGold } | ||
}; | ||
} | ||
|
||
static StoreDetail deserialize(const ValueWrapper &val) { | ||
auto map = val.get<MapType>(); | ||
return { | ||
map["description"]->get<StringType>(), | ||
map["coinAmount"]->get<IntType>(), | ||
map["created_at"]->get<IntType>(), | ||
map["is_gold"]->get<BooleanType>() | ||
}; | ||
} | ||
|
||
std::string description; | ||
int32_t coinAmount {}; | ||
int createdAt {}; | ||
bool isGold {}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters