1#ifndef tutorial_rpc_Service_declared
2#define tutorial_rpc_Service_declared
34 if (city_id.is_null())
50 if (city_id.is_not_null())
61 const auto &db = client.get_database();
65 const std::string &city_name = population.
get_city_name(data);
66 const id_of_city city = db.find_city_by_name(city_name);
71 for (
const auto person: db.get_person_table())
72 if (db.get_home(person) == city)
85 if (message_city.is_not_null())
87 const auto &db = client.get_database();
89 const auto city = db.find_city_by_name(message.
get_name(message_city));
90 if (city.is_not_null())
92 for (
const auto person: db.get_person_table())
94 if (db.get_home(person) == city)
98 db.get_first_name(person),
99 db.get_last_name(person),
id_of_city find_city_by_name(const std::string &field_value_of_name) const
const std::string & get_name(id_of_city record) const
container_of_city get_city_table() const
A Database that contains a joedb::Writable_Journal and keeps them in sync.
id_of_person new_person()
void delete_city(id_of_city record)
Strongly-typed wrapper around an integer representing a row of the city table.
constexpr bool is_not_null() const
Specialization of joedb::rpc::Client.
A collection of procedures that will be executed in the rpc server.
void get_inhabitants(tutorial::Writable_Database &message)
A message can have the same schema as the main database.
void get_population(population::Writable_Database &population)
A procedure can return values by writing them to the message database.
void delete_city(city::Writable_Database &city)
Delete a city from a name string.
void insert_city(city::Writable_Database &city)
Insert a city from a name string.
const std::string & get_name(id_of_city record=id_of_city{0}) const
A Database that contains a joedb::Writable_Journal and keeps them in sync.
container_of_data get_data_table() const
const std::string & get_city_name(id_of_data record) const
A Database that contains a joedb::Writable_Journal and keeps them in sync.
void set_city(id_of_data record, id_of_city field_value_of_city)
void set_population(id_of_data record, int64_t field_value_of_population)