mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-06-17 21:10:12 -04:00
Refactor phonebook's models to merge both implementation. One model class is used for both main and search results windows. Improve search by matching entered string against: - first_name " " last_name - last_name " " fist_name Sort results by last_name " " first_name, favs first. Small improvement to the list view has been added to deal with asynchronous db reads. Signed-off-by: Marcin Smoczyński <smoczynski.marcin@gmail.com>
57 lines
1.2 KiB
C++
57 lines
1.2 KiB
C++
#include "RecordQuery.hpp"
|
|
|
|
#include <Common/Query.hpp>
|
|
|
|
#include <string>
|
|
#include <utility>
|
|
|
|
using namespace db::query;
|
|
|
|
RecordQuery::RecordQuery() noexcept : Query(Query::Type::Read)
|
|
{}
|
|
|
|
RecordQuery::RecordQuery(std::size_t offset, std::size_t limit) noexcept
|
|
: Query(Query::Type::Read), limit(limit), offset(offset)
|
|
{}
|
|
|
|
RecordsSizeQuery::RecordsSizeQuery() noexcept : Query(Query::Type::Read)
|
|
{}
|
|
|
|
[[nodiscard]] std::pair<std::size_t, std::size_t> RecordQuery::getLimitOffset() const noexcept
|
|
{
|
|
return std::make_pair(limit, offset);
|
|
}
|
|
|
|
[[nodiscard]] std::size_t RecordQuery::getLimit() const noexcept
|
|
{
|
|
return limit;
|
|
}
|
|
|
|
[[nodiscard]] std::size_t RecordQuery::getOffset() const noexcept
|
|
{
|
|
return offset;
|
|
}
|
|
|
|
RecordsSizeQueryResult::RecordsSizeQueryResult(std::size_t size) noexcept : size(size)
|
|
{}
|
|
|
|
[[nodiscard]] std::size_t RecordsSizeQueryResult::getSize() const noexcept
|
|
{
|
|
return size;
|
|
}
|
|
|
|
[[nodiscard]] auto RecordQuery::debugInfo() const -> std::string
|
|
{
|
|
return "RecordQuery";
|
|
}
|
|
|
|
[[nodiscard]] auto RecordsSizeQuery::debugInfo() const -> std::string
|
|
{
|
|
return "RecordsSizeQuery";
|
|
}
|
|
|
|
[[nodiscard]] auto RecordsSizeQueryResult::debugInfo() const -> std::string
|
|
{
|
|
return "RecordsSizeQueryResult";
|
|
}
|