Václav Kubernát | ab612e9 | 2019-11-26 19:51:31 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2019 CESNET, https://photonics.cesnet.cz/ |
| 3 | * |
| 4 | * Written by Václav Kubernát <kubernat@cesnet.cz> |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #pragma once |
| 9 | |
| 10 | #include <boost/optional.hpp> |
| 11 | #include <map> |
| 12 | #include <memory> |
| 13 | #include <set> |
| 14 | #include "ast_values.hpp" |
| 15 | #include "datastore_access.hpp" |
| 16 | #include "schema.hpp" |
| 17 | |
| 18 | |
| 19 | /*! \class DataQuery |
| 20 | * \brief A class used for querying data from a datastore for usage in tab-completion. |
| 21 | * |
| 22 | */ |
| 23 | class DataQuery { |
| 24 | public: |
| 25 | DataQuery(DatastoreAccess& datastore); |
| 26 | /*! \brief Lists all possible instances of key/value pairs for a list specified by the arguments. |
Václav Kubernát | 2db124c | 2020-05-28 21:58:36 +0200 | [diff] [blame] | 27 | * \param listPath Path to the list (ending with a list_) |
Václav Kubernát | ab612e9 | 2019-11-26 19:51:31 +0100 | [diff] [blame] | 28 | * \return A vector of maps, which represent the instances. The map is keyed by the name of the list key. The values in the map, are values of the list keys. |
| 29 | */ |
Václav Kubernát | 59e4ee4 | 2020-07-08 17:32:45 +0200 | [diff] [blame] | 30 | [[nodiscard]] std::vector<ListInstance> listKeys(const dataPath_& listPath) const; |
Václav Kubernát | ab612e9 | 2019-11-26 19:51:31 +0100 | [diff] [blame] | 31 | |
| 32 | private: |
| 33 | DatastoreAccess& m_datastore; |
| 34 | std::shared_ptr<Schema> m_schema; |
| 35 | }; |