blob: e7b0c03dcc39f982abb3f221338b12f530543be8 [file] [log] [blame]
Václav Kubernátab612e92019-11-26 19:51:31 +01001/*
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*/
23class DataQuery {
24public:
25 DataQuery(DatastoreAccess& datastore);
26 /*! \brief Lists all possible instances of key/value pairs for a list specified by the arguments.
Václav Kubernát2db124c2020-05-28 21:58:36 +020027 * \param listPath Path to the list (ending with a list_)
Václav Kubernátab612e92019-11-26 19:51:31 +010028 * \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át59e4ee42020-07-08 17:32:45 +020030 [[nodiscard]] std::vector<ListInstance> listKeys(const dataPath_& listPath) const;
Václav Kubernátab612e92019-11-26 19:51:31 +010031
32private:
33 DatastoreAccess& m_datastore;
34 std::shared_ptr<Schema> m_schema;
35};