~aleteoryx/muditaos

ref: 6ced1ee3e865adee03e8ae1ffaa80dcd15e32cf4 muditaos/module-db/queries/messages/threads/QueryThreadsGet.hpp -rw-r--r-- 1.5 KiB
6ced1ee3 — Mateusz Piesta [BH-1495] Relaxation app assets update 3 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once

#include <Tables/ThreadsTable.hpp>
#include "Interface/ThreadRecord.hpp"
#include <Common/Query.hpp>
#include <string>

namespace db::query
{

    class ThreadsGet : public Query
    {
      public:
        unsigned int offset;
        unsigned int limit;
        ThreadsGet(unsigned int offset, unsigned int limit);

        [[nodiscard]] auto debugInfo() const -> std::string override;
    };

    class ThreadsGetWithTotalCount : public ThreadsGet
    {
      public:
        ThreadsGetWithTotalCount(std::size_t offset, std::size_t limit);
        [[nodiscard]] auto debugInfo() const -> std::string override;
    };

    class ThreadsGetResults : public QueryResult
    {
        std::vector<ThreadRecord> results;

      public:
        ThreadsGetResults(std::vector<ThreadRecord> result_rows);
        [[nodiscard]] auto getResults() const -> std::vector<ThreadRecord>;
        [[nodiscard]] auto debugInfo() const -> std::string override;
    };

    class ThreadsGetResultsWithTotalCount : public ThreadsGetResults
    {
      public:
        ThreadsGetResultsWithTotalCount(std::vector<ThreadRecord> records, std::size_t allLength);
        [[nodiscard]] auto debugInfo() const -> std::string override;
        auto getTotalCount() const noexcept -> std::size_t;

      private:
        std::size_t totalCount;
    };
}; // namespace db::query