Realm C++ SDK版本 v 2.2.0

query.hpp

1
2//
3// 版权所有 2024 Realm Inc.
4//
5// 根据 Apache 许可证 2.0 版(“许可证”)获得许可;
6// 除非符合合规,否则不得使用此文件。
7// 您可以在以下网址获取许可证副本:
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// 除非适用法律要求或书面同意,否则软件
12// 根据许可证分发是按“原样”分发的,
13// 不提供任何类型的Express或暗示的保证或条件。
14// 请参阅管理权限的特定语言的许可证和
15// 许可证下的限制。
16//
18
19#ifndef CPPREALM_BRIDGE_QUERY_HPP
20#define CPPREALM_BRIDGE_QUERY_HPP
21
22#include <cpprealm/internal/bridge/col_key.hpp>
23#include <cpprealm/internal/bridge/obj.hpp>
24#include <cpprealm/internal/bridge/utils.hpp>
25
26#include<optional>
27#include <string_view>
28
29命名空间域 {
30 struct object_id;
31 struct十进制128 ;
32 struct uuid;
33 class LinkChain;
34 class Query;
35 class Subexpr;
36 }
37命名空间realm::internal::bridge {
38 结构表;
39 struct col_key;
40 struct timestamp;
41 struct binary;
42 struct object_id;
43 struct十进制128 ;
44 struct uuid;
45 结构体混合;
46
47 struct subexpr {
48 subexpr ( subexpr && other) = 默认 ;
49 subexpr & Operator=( subexpr && other) = default ;
50 ~subexpr () = default ;
51 subexpr (std::unique_ptr<Subexpr> other);
52
53 query equal( const std::Optional<int 64 _t>& rhs) const ;
54 query not_equal( const std::Optional<int 64 _t>& rhs) const ;
55 查询更大( const std::Optional<int 64 _t>& rhs) const ;
56 query less( const std::Optional<int 64 _t>& rhs) const ;
57 query more_equal( const std::Optional<int 64 _t>& rhs) const ;
58 query less_equal( const std::Optional<int 64 _t>& rhs) const ;
59
60 查询 equal( const std::Optional<bool>& rhs) const ;
61 query not_equal( const std::Optional<bool>& rhs) const ;
62
63 query equal( const std::Optional<double>& rhs) const ;
64 查询 not_equal( const std::Optional<double>& rhs) const ;
65 查询更大( const std::Optional<double>& rhs) const ;
66 查询 less( const std::Optional<double>& rhs) const ;
67 query more_equal( const std::Optional<double>& rhs) const ;
68 query less_equal( const std::Optional<double>& rhs) const ;
69
70 query equal( const std::Optional<binary>& rhs) const ;
71 query not_equal( const std::Optional<binary>& rhs) const ;
72
73 query equal( const std::Optional<timestamp>& rhs) const ;
74 查询 not_equal( const std::Optional<timestamp>& rhs) const ;
75 查询更大( const std::可选<timestamp>& rhs) const ;
76 查询 less( const std::Optional<timestamp>& rhs) const ;
77 query more_equal( const std::Optional<timestamp>& rhs) const ;
78 query less_equal( const std::Optional<timestamp>& rhs) const ;
79
80 query equal( const std::Optional<std::string>& rhs) const ;
81 query not_equal( const std::Optional<std::string>& rhs) const ;
82 查询contains( const std::Optional<std::string>& rhs, bool case_sensitive = true ) const ;
83
84 query equal( const std::Optional<internal::bridge::uuid>& rhs) const ;
85 query not_equal( const std::Optional<internal::bridge::uuid>& rhs) const ;
86
87 query equal( const std::Optional<internal::bridge::object_id>& rhs) const ;
88 query not_equal( const std::Optional<internal::bridge::object_id>& rhs) const ;
89
90 query equal( const std::Optional<internal::bridge::decimal 128 >& rhs) const ;
91 查询 not_equal( const std::Optional<internal::bridge::decimal 128 >& rhs) const ;
92 查询更大( const std::Optional<internal::bridge::decimal 128 >& rhs) const ;
93 query less( const std::Optional<internal::bridge::decimal 128 >& rhs) const ;
94 查询 more_equal( const std::Optional<internal::bridge::decimal 128 >& rhs) const ;
95 query less_equal( const std::Optional<internal::bridge::decimal 128 >& rhs) const ;
96
97 query Mixed_equal( constInternal ::bridge::mixed & rhs) const ;
98 query Mixed_not_equal( constInternal ::bridge::mixed & rhs) const ;
99
100 查询 equal( const std::Optional<obj>&) const ;
101 query not_equal( const std::Optional<obj>&) const ;
102
103 private :
104 std::shared_ptr<Subexpr> m_subexpr;
105 };
106
107 struct link_chain {
108 Link_Chain ();
109 Link_Chain ( const Link_Chain & other) ;
110 link_chain & 操作符=( const link_chain & other) ;
111 链接链链接链&& other);
112 链接链&操作符=(链接链&&其他);
113 ~link_chain () = default ;
114 link_chain ( const LinkChain& other);
115
116 link_chain & link( col_key );
117 link_chain & link(std::string col_name);
118 link_chain & backlink( consttable & origin , col_keyorigin_col_key );
119
120 template < typename >
122 subexpr field_mixed( col_key );
123
124 subexpr subquery( query subquery);
125 get_table();
126
127 private :
128 std::shared_ptr<LinkChain> m_link_chain;
129 };
130
131 struct 查询{
132 查询 ();
133 query ( const query & other) ;
134 query & Operator=( const query & other) ;
135 query ( query && other);
136 query & Operator=( query && other);
137 ~query ();
138 query ( const Table & Table ); //NOLINT(google-explicit-constructor)
139 get_table();
140 查询 and_query( const 查询 &);
141 query & negate();
142
143 query ( const Query&); //NOLINT(google-explicit-constructor)
144 Operator Query() const ; //NOLINT(google-explicit-constructor)
145
146 // 条件:null
147 query & equal( col_key colum_key, std::nullopt_t);
148 query & not_equal( col_key colum_key, std::nullopt_t);
149
150 query & equal( col_key colum_key, int 64 _t value);
151 查询 & not_equal( col_key colum_key, int 64 _t value);
152 查询& 更大( col_keycolumn_key ,int 64 _t value);
153 query & more_equal( col_key colum_key, int 64 _t value);
154 query & less( col_key colum_key, int 64 _t value);
155 query & less_equal( col_key colum_key, int 64 _t value);
156 query & between( col_key colum_key, int 64 _t from, int 64 _t to);
157
158 // 条件:double
159 query & equal( col_key colum_key, double value);
160 query & not_equal( col_key field_key, double value);
161 查询& 更大( col_keycolumn_key精度值);
162 查询 & more_equal( col_key field_key, double value);
163 查询 & less( col_key colum_key, double value);
164 query & less_equal( col_key field_key, double value);
165 query & between( col_key colum_key, double from, double to);
166
167 // 条件:时间戳
168 query & equal( col_key colum_key, timestamp value);
169 查询 & not_equal( col_key field_key, timestamp value);
170 查询和更大( col_keycolumn_key时间戳值);
171 query & more_equal( col_key field_key, timestamp value);
172 查询 & less_equal( col_key field_key, timestamp value);
173 query & less( col_key colum_key, timestamp value);
174
175 // 条件:UUID
176 query & equal( col_key colum_key, uuid value);
177 query & not_equal( col_key colum_key, uuid value);
178 查询和更大( col_keycolumn_keyuuid值);
179 query & more_equal( col_key field_key, uuid value);
180 查询 & less_equal( col_key colum_key, uuid value);
182
183 // 条件:ObjectId
184 查询 & equal( col_key colum_key, object_id value);
185 查询 & not_equal( col_key colum_key, object_id value);
186 查询& 更大( col_key列键, object_id值);
187 query & more_equal( col_key colum_key, object_id value);
188 query & less_equal( col_key colum_key, object_id value);
189 query & less( col_key colum_key, object_id value);
190
191 // 条件:十进制128
192 query & equal( col_key field_key, Decimal 128 value);
193 query & not_equal( col_key field_key, Decimal 128 value);
194 查询& 更大( col_keycolumn_key十进制128值);
195 query & more_equal( col_key field_key, Decimal 128 value);
196 query & less_equal( col_key field_key, Decimal 128 value);
197 query & less( col_key colum_key, Decimal 128 value);
198
199 // 条件: string
200 query & equal( col_key colum_key, std::string_view value, bool case_sensitive = true );
201 查询 & not_equal( col_key colum_key, std::string_view value, bool case_sensitive = true );
202 query &begins_with( col_keycolumn_key , const std::string&value, bool case_sensitive = true );
203 query &ends_with( col_keycolumn_key , const std::string&value, bool case_sensitive = true );
204 query & contains( col_key colum_key, std::string_view value, bool case_sensitive = true );
205 query & like( col_key colum_key, const std::string& value, bool case_sensitive = true );
206
207 // 条件:二进制
208 query & equal( col_key colum_key, binary value, bool case_sensitive = true );
209 query & not_equal( col_key colum_key, binary value, bool case_sensitive = true );
210 query & begins_with ( col_keycolumn_key ,binaryvalue, boolcase_sensitive = true );
211 query & ends_with ( col_keycolumn_key ,binaryvalue, boolcase_sensitive = true );
212 query & contains( col_key colum_key, binary value, bool case_sensitive = true );
213 query & like( col_key colum_key, binary b, bool case_sensitive = true );
214
215 // 条件:混合
216 查询 & equal( col_key colum_key,混合值, bool case_sensitive = true );
217 query & not_equal( col_key field_key,混合值, bool case_sensitive = true );
218 查询和更大( col_keycolumn_key混合值);
219 query & more_equal( col_key colum_key,混合值);
220 query & less( col_key colum_key,混合值);
221 query &less_equal( col_keycolumn_key ,混合值);
222 query &begins_with( col_keycolumn_key ,混合值, bool case_sensitive = true );
223 query &ends_with( col_keycolumn_key ,混合值, bool case_sensitive = true );
224 query & contains( col_key colum_key,混合值, bool case_sensitive = true );
225 查询 & like( col_key colum_key,混合值, bool case_sensitive = true );
226
227 // 条件:bool
228 query & equal( col_key colum_key, bool value);
229 查询 & not_equal( col_key field_key, bool value);
230
231 // 条件:链接
232 查询 &links_to( col_keycolumn_key , constinternal ::bridge::obj &o);
233 query & not_links_to( col_key colum_key, const inside ::bridge::obj & o);
234
235 查询 &dictionary_has_value_for_key_equals( col_keycolumn_key , const std::string& key, const Mixed & Value);
236 查询 &dictionary_has_value_for_key_not_equals( col_key colum_key, const std::string& key, const Mixed & Value);
237 查询 &dictionary_has_value_for_key_great_than( col_key colum_key, const std::string& key, const Mixed & Value);
238 查询 &dictionary_has_value_for_key_less_than( col_key colum_key, const std::string& key, const Mixed & Value);
239 查询 &dictionary_has_value_for_key_great_than_equals( col_keycolumn_key , const std::string& key, const Mixed & Value);
240 查询 &dictionary_has_value_for_key_less_than_equals( col_keycolumn_key , const std::string& key, const Mixed & Value);
241 查询 &dictionary_contains_string_for_key( col_key colum_key, const std::string& key, const std::string& value);
242 查询 &Dictionary_contains_key( col_keycolumn_key , const std::string&key);
244
245 // 表达式
246 静态 查询 falsepredicate();
247
248 std::string description() const
249 private :
250 inline Query* get_query();
251#ifdef CPPREALM_HAVE_GENERATED_BRIDGE_TYPES
252 storage::Query m_query[ 1 ];
253#else
254 std::shared_ptr<Query> m_query;
255#endif
256
257 };
258
259 查询操作符 || ( const query & lhs, const query & rhs);
260 }
261
262#endif //CPREALM_BRIDGE_QUERY_HPP
定义: binary.hpp: 30
定义: col_key.hpp: 28
定义:十进制128 .hpp: 30
定义: mixed.hpp:69
定义: obj.hpp:123
定义: object_id.hpp:31
定义: query.hpp: 131
定义: query.hpp: 47
定义: table.hpp:40
定义: timestamp.hpp: 30
定义: uuid.hpp:32