generated from userver-framework/service_template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6dc7b31
commit d187c5e
Showing
19 changed files
with
94 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,44 @@ | ||
#pragma once | ||
#include <chrono> | ||
#include <cstddef> | ||
#include <string> | ||
#include <type_traits> | ||
#include <userver/utils/strong_typedef.hpp> | ||
namespace legacy::models | ||
{ | ||
//расставляет % с обоих сторон строки, чтобы запросы в постгресе с | ||
//использованием ILIKE работали как поиск подстроки | ||
using SubString = | ||
userver::utils::StrongTypedef<struct SubStringTag, std::string>; | ||
class SubString{ | ||
public: | ||
using UnderlyingType = std::string; | ||
SubString() = default; | ||
SubString(const SubString&) = default; | ||
SubString(SubString&&) noexcept = default; | ||
SubString& operator=(const SubString&) = default; | ||
SubString& operator=(SubString&&) noexcept = default; | ||
template <typename... Args> | ||
SubString(Args&&... args) noexcept(std::is_nothrow_constructible_v<std::string, Args&&...>) : data_(std::forward<Args>(args)...){} | ||
|
||
template <typename Arg> | ||
SubString& operator=(Arg&& args) noexcept(std::is_nothrow_assignable_v<std::string, Arg>){ | ||
data_ = std::forward<Arg>(args); | ||
} | ||
|
||
std::string& GetUnderlying(){ | ||
return data_; | ||
} | ||
const std::string& GetUnderlying() const{ | ||
return data_; | ||
} | ||
|
||
std::size_t size() const{ | ||
return data_.size(); | ||
} | ||
auto data() const { | ||
return data_.data(); | ||
} | ||
auto operator<=>(const SubString&) const= default; | ||
|
||
private: | ||
std::string data_{}; | ||
}; | ||
} // namespace legacy::models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters