1#[derive(Debug, Clone, PartialEq)]
4pub struct ReflectPgAggregate {
5 pub aggfnoid: String,
6 pub aggkind: i8,
7 pub aggnumdirectargs: i16,
8 pub aggtransfn: String,
9 pub aggfinalfn: Option<String>,
10 pub aggcombinefn: Option<String>,
11 pub aggserialfn: Option<String>,
12 pub aggdeserialfn: Option<String>,
13 pub aggmtransfn: Option<String>,
14 pub aggminvtransfn: Option<String>,
15 pub aggmfinalfn: Option<String>,
16 pub aggfinalextra: bool,
17 pub aggmfinalextra: bool,
18 pub aggfinalmodify: i8,
19 pub aggmfinalmodify: i8,
20 pub aggsortop: Option<String>,
21 pub aggtranstype: String,
22 pub aggmtranstype: Option<String>,
23 pub agginitval: Option<String>,
24 pub aggminitval: Option<String>,
25}
26pub struct ReflectPgAggregateBorrowed<'a> {
27 pub aggfnoid: &'a str,
28 pub aggkind: i8,
29 pub aggnumdirectargs: i16,
30 pub aggtransfn: &'a str,
31 pub aggfinalfn: Option<&'a str>,
32 pub aggcombinefn: Option<&'a str>,
33 pub aggserialfn: Option<&'a str>,
34 pub aggdeserialfn: Option<&'a str>,
35 pub aggmtransfn: Option<&'a str>,
36 pub aggminvtransfn: Option<&'a str>,
37 pub aggmfinalfn: Option<&'a str>,
38 pub aggfinalextra: bool,
39 pub aggmfinalextra: bool,
40 pub aggfinalmodify: i8,
41 pub aggmfinalmodify: i8,
42 pub aggsortop: Option<&'a str>,
43 pub aggtranstype: &'a str,
44 pub aggmtranstype: Option<&'a str>,
45 pub agginitval: Option<&'a str>,
46 pub aggminitval: Option<&'a str>,
47}
48impl<'a> From<ReflectPgAggregateBorrowed<'a>> for ReflectPgAggregate {
49 fn from(
50 ReflectPgAggregateBorrowed {
51 aggfnoid,
52 aggkind,
53 aggnumdirectargs,
54 aggtransfn,
55 aggfinalfn,
56 aggcombinefn,
57 aggserialfn,
58 aggdeserialfn,
59 aggmtransfn,
60 aggminvtransfn,
61 aggmfinalfn,
62 aggfinalextra,
63 aggmfinalextra,
64 aggfinalmodify,
65 aggmfinalmodify,
66 aggsortop,
67 aggtranstype,
68 aggmtranstype,
69 agginitval,
70 aggminitval,
71 }: ReflectPgAggregateBorrowed<'a>,
72 ) -> Self {
73 Self {
74 aggfnoid: aggfnoid.into(),
75 aggkind,
76 aggnumdirectargs,
77 aggtransfn: aggtransfn.into(),
78 aggfinalfn: aggfinalfn.map(|v| v.into()),
79 aggcombinefn: aggcombinefn.map(|v| v.into()),
80 aggserialfn: aggserialfn.map(|v| v.into()),
81 aggdeserialfn: aggdeserialfn.map(|v| v.into()),
82 aggmtransfn: aggmtransfn.map(|v| v.into()),
83 aggminvtransfn: aggminvtransfn.map(|v| v.into()),
84 aggmfinalfn: aggmfinalfn.map(|v| v.into()),
85 aggfinalextra,
86 aggmfinalextra,
87 aggfinalmodify,
88 aggmfinalmodify,
89 aggsortop: aggsortop.map(|v| v.into()),
90 aggtranstype: aggtranstype.into(),
91 aggmtranstype: aggmtranstype.map(|v| v.into()),
92 agginitval: agginitval.map(|v| v.into()),
93 aggminitval: aggminitval.map(|v| v.into()),
94 }
95 }
96}
97#[derive(Debug, Clone, PartialEq)]
98pub struct ReflectPgAm {
99 pub amname: String,
100 pub amhandler: String,
101 pub amtype: i8,
102 pub description: Option<String>,
103}
104pub struct ReflectPgAmBorrowed<'a> {
105 pub amname: &'a str,
106 pub amhandler: &'a str,
107 pub amtype: i8,
108 pub description: Option<&'a str>,
109}
110impl<'a> From<ReflectPgAmBorrowed<'a>> for ReflectPgAm {
111 fn from(
112 ReflectPgAmBorrowed {
113 amname,
114 amhandler,
115 amtype,
116 description,
117 }: ReflectPgAmBorrowed<'a>,
118 ) -> Self {
119 Self {
120 amname: amname.into(),
121 amhandler: amhandler.into(),
122 amtype,
123 description: description.map(|v| v.into()),
124 }
125 }
126}
127#[derive(Debug, Clone, PartialEq)]
128pub struct ReflectPgAmop {
129 pub amopfamily: String,
130 pub amoplefttype: String,
131 pub amoprighttype: String,
132 pub amopstrategy: i16,
133 pub amoppurpose: i8,
134 pub amopopr: String,
135 pub amopmethod: String,
136 pub amopsortfamily: Option<String>,
137}
138pub struct ReflectPgAmopBorrowed<'a> {
139 pub amopfamily: &'a str,
140 pub amoplefttype: &'a str,
141 pub amoprighttype: &'a str,
142 pub amopstrategy: i16,
143 pub amoppurpose: i8,
144 pub amopopr: &'a str,
145 pub amopmethod: &'a str,
146 pub amopsortfamily: Option<&'a str>,
147}
148impl<'a> From<ReflectPgAmopBorrowed<'a>> for ReflectPgAmop {
149 fn from(
150 ReflectPgAmopBorrowed {
151 amopfamily,
152 amoplefttype,
153 amoprighttype,
154 amopstrategy,
155 amoppurpose,
156 amopopr,
157 amopmethod,
158 amopsortfamily,
159 }: ReflectPgAmopBorrowed<'a>,
160 ) -> Self {
161 Self {
162 amopfamily: amopfamily.into(),
163 amoplefttype: amoplefttype.into(),
164 amoprighttype: amoprighttype.into(),
165 amopstrategy,
166 amoppurpose,
167 amopopr: amopopr.into(),
168 amopmethod: amopmethod.into(),
169 amopsortfamily: amopsortfamily.map(|v| v.into()),
170 }
171 }
172}
173#[derive(Debug, Clone, PartialEq)]
174pub struct ReflectPgAmproc {
175 pub amprocfamily: String,
176 pub amproclefttype: String,
177 pub amprocrighttype: String,
178 pub amprocnum: i16,
179 pub amproc: String,
180}
181pub struct ReflectPgAmprocBorrowed<'a> {
182 pub amprocfamily: &'a str,
183 pub amproclefttype: &'a str,
184 pub amprocrighttype: &'a str,
185 pub amprocnum: i16,
186 pub amproc: &'a str,
187}
188impl<'a> From<ReflectPgAmprocBorrowed<'a>> for ReflectPgAmproc {
189 fn from(
190 ReflectPgAmprocBorrowed {
191 amprocfamily,
192 amproclefttype,
193 amprocrighttype,
194 amprocnum,
195 amproc,
196 }: ReflectPgAmprocBorrowed<'a>,
197 ) -> Self {
198 Self {
199 amprocfamily: amprocfamily.into(),
200 amproclefttype: amproclefttype.into(),
201 amprocrighttype: amprocrighttype.into(),
202 amprocnum,
203 amproc: amproc.into(),
204 }
205 }
206}
207#[derive(Debug, Clone, PartialEq)]
208pub struct ReflectPgAttrdef {
209 pub adrelid: String,
210 pub adnum: i16,
211 pub adbin: String,
212}
213pub struct ReflectPgAttrdefBorrowed<'a> {
214 pub adrelid: &'a str,
215 pub adnum: i16,
216 pub adbin: &'a str,
217}
218impl<'a> From<ReflectPgAttrdefBorrowed<'a>> for ReflectPgAttrdef {
219 fn from(
220 ReflectPgAttrdefBorrowed {
221 adrelid,
222 adnum,
223 adbin,
224 }: ReflectPgAttrdefBorrowed<'a>,
225 ) -> Self {
226 Self {
227 adrelid: adrelid.into(),
228 adnum,
229 adbin: adbin.into(),
230 }
231 }
232}
233#[derive(Debug, Clone, PartialEq)]
234pub struct ReflectPgAttribute {
235 pub attrelid: String,
236 pub attname: String,
237 pub atttypid: String,
238 pub attnum: i16,
239 pub atttypmod: Option<i32>,
240 pub attndims: i16,
241 pub attcompression: Option<i8>,
242 pub attnotnull: bool,
243 pub atthasdef: bool,
244 pub attidentity: Option<i8>,
245 pub attgenerated: Option<i8>,
246 pub attisdropped: bool,
247 pub attislocal: bool,
248 pub attinhcount: i16,
249 pub attcollation: Option<String>,
250 pub attstattarget: Option<i16>,
251 pub attacl: Option<Vec<crate::types::pg_temp_1::TablecolumnAclitem>>,
252 pub attoptions: Option<Vec<String>>,
253 pub attfdwoptions: Option<Vec<String>>,
254 pub description: Option<String>,
255 pub seclabel: Option<String>,
256 pub seclabel_provider: Option<String>,
257 pub initprivs: Option<Vec<crate::types::pg_temp_1::TablecolumnAclitem>>,
258 pub initprivs_type: Option<i8>,
259}
260pub struct ReflectPgAttributeBorrowed<'a> {
261 pub attrelid: &'a str,
262 pub attname: &'a str,
263 pub atttypid: &'a str,
264 pub attnum: i16,
265 pub atttypmod: Option<i32>,
266 pub attndims: i16,
267 pub attcompression: Option<i8>,
268 pub attnotnull: bool,
269 pub atthasdef: bool,
270 pub attidentity: Option<i8>,
271 pub attgenerated: Option<i8>,
272 pub attisdropped: bool,
273 pub attislocal: bool,
274 pub attinhcount: i16,
275 pub attcollation: Option<&'a str>,
276 pub attstattarget: Option<i16>,
277 pub attacl:
278 Option<crate::ArrayIterator<'a, crate::types::pg_temp_1::TablecolumnAclitemBorrowed<'a>>>,
279 pub attoptions: Option<crate::ArrayIterator<'a, &'a str>>,
280 pub attfdwoptions: Option<crate::ArrayIterator<'a, &'a str>>,
281 pub description: Option<&'a str>,
282 pub seclabel: Option<&'a str>,
283 pub seclabel_provider: Option<&'a str>,
284 pub initprivs:
285 Option<crate::ArrayIterator<'a, crate::types::pg_temp_1::TablecolumnAclitemBorrowed<'a>>>,
286 pub initprivs_type: Option<i8>,
287}
288impl<'a> From<ReflectPgAttributeBorrowed<'a>> for ReflectPgAttribute {
289 fn from(
290 ReflectPgAttributeBorrowed {
291 attrelid,
292 attname,
293 atttypid,
294 attnum,
295 atttypmod,
296 attndims,
297 attcompression,
298 attnotnull,
299 atthasdef,
300 attidentity,
301 attgenerated,
302 attisdropped,
303 attislocal,
304 attinhcount,
305 attcollation,
306 attstattarget,
307 attacl,
308 attoptions,
309 attfdwoptions,
310 description,
311 seclabel,
312 seclabel_provider,
313 initprivs,
314 initprivs_type,
315 }: ReflectPgAttributeBorrowed<'a>,
316 ) -> Self {
317 Self {
318 attrelid: attrelid.into(),
319 attname: attname.into(),
320 atttypid: atttypid.into(),
321 attnum,
322 atttypmod,
323 attndims,
324 attcompression,
325 attnotnull,
326 atthasdef,
327 attidentity,
328 attgenerated,
329 attisdropped,
330 attislocal,
331 attinhcount,
332 attcollation: attcollation.map(|v| v.into()),
333 attstattarget,
334 attacl: attacl.map(|v| v.map(|v| v.into()).collect()),
335 attoptions: attoptions.map(|v| v.map(|v| v.into()).collect()),
336 attfdwoptions: attfdwoptions.map(|v| v.map(|v| v.into()).collect()),
337 description: description.map(|v| v.into()),
338 seclabel: seclabel.map(|v| v.into()),
339 seclabel_provider: seclabel_provider.map(|v| v.into()),
340 initprivs: initprivs.map(|v| v.map(|v| v.into()).collect()),
341 initprivs_type,
342 }
343 }
344}
345#[derive(Debug, Clone, PartialEq)]
346pub struct ReflectPgRoles {
347 pub rolname: String,
348 pub rolsuper: bool,
349 pub rolinherit: bool,
350 pub rolcreaterole: bool,
351 pub rolcreatedb: bool,
352 pub rolcanlogin: bool,
353 pub rolreplication: bool,
354 pub rolconnlimit: Option<i32>,
355 pub rolvaliduntil: Option<chrono::DateTime<chrono::FixedOffset>>,
356 pub rolbypassrls: bool,
357 pub rolconfig: Option<Vec<String>>,
358 pub description: Option<String>,
359 pub seclabel: Option<String>,
360 pub seclabel_provider: Option<String>,
361}
362pub struct ReflectPgRolesBorrowed<'a> {
363 pub rolname: &'a str,
364 pub rolsuper: bool,
365 pub rolinherit: bool,
366 pub rolcreaterole: bool,
367 pub rolcreatedb: bool,
368 pub rolcanlogin: bool,
369 pub rolreplication: bool,
370 pub rolconnlimit: Option<i32>,
371 pub rolvaliduntil: Option<chrono::DateTime<chrono::FixedOffset>>,
372 pub rolbypassrls: bool,
373 pub rolconfig: Option<crate::ArrayIterator<'a, &'a str>>,
374 pub description: Option<&'a str>,
375 pub seclabel: Option<&'a str>,
376 pub seclabel_provider: Option<&'a str>,
377}
378impl<'a> From<ReflectPgRolesBorrowed<'a>> for ReflectPgRoles {
379 fn from(
380 ReflectPgRolesBorrowed {
381 rolname,
382 rolsuper,
383 rolinherit,
384 rolcreaterole,
385 rolcreatedb,
386 rolcanlogin,
387 rolreplication,
388 rolconnlimit,
389 rolvaliduntil,
390 rolbypassrls,
391 rolconfig,
392 description,
393 seclabel,
394 seclabel_provider,
395 }: ReflectPgRolesBorrowed<'a>,
396 ) -> Self {
397 Self {
398 rolname: rolname.into(),
399 rolsuper,
400 rolinherit,
401 rolcreaterole,
402 rolcreatedb,
403 rolcanlogin,
404 rolreplication,
405 rolconnlimit,
406 rolvaliduntil,
407 rolbypassrls,
408 rolconfig: rolconfig.map(|v| v.map(|v| v.into()).collect()),
409 description: description.map(|v| v.into()),
410 seclabel: seclabel.map(|v| v.into()),
411 seclabel_provider: seclabel_provider.map(|v| v.into()),
412 }
413 }
414}
415#[derive(Debug, Clone, PartialEq)]
416pub struct ReflectPgAuthMembers {
417 pub roleid: String,
418 pub member: String,
419 pub grantor: String,
420 pub admin_option: bool,
421 pub inherit_option: bool,
422 pub set_option: bool,
423}
424pub struct ReflectPgAuthMembersBorrowed<'a> {
425 pub roleid: &'a str,
426 pub member: &'a str,
427 pub grantor: &'a str,
428 pub admin_option: bool,
429 pub inherit_option: bool,
430 pub set_option: bool,
431}
432impl<'a> From<ReflectPgAuthMembersBorrowed<'a>> for ReflectPgAuthMembers {
433 fn from(
434 ReflectPgAuthMembersBorrowed {
435 roleid,
436 member,
437 grantor,
438 admin_option,
439 inherit_option,
440 set_option,
441 }: ReflectPgAuthMembersBorrowed<'a>,
442 ) -> Self {
443 Self {
444 roleid: roleid.into(),
445 member: member.into(),
446 grantor: grantor.into(),
447 admin_option,
448 inherit_option,
449 set_option,
450 }
451 }
452}
453#[derive(Debug, Clone, PartialEq)]
454pub struct ReflectPgCast {
455 pub castsource: String,
456 pub casttarget: String,
457 pub castfunc: Option<String>,
458 pub castcontext: i8,
459 pub castmethod: i8,
460 pub description: Option<String>,
461}
462pub struct ReflectPgCastBorrowed<'a> {
463 pub castsource: &'a str,
464 pub casttarget: &'a str,
465 pub castfunc: Option<&'a str>,
466 pub castcontext: i8,
467 pub castmethod: i8,
468 pub description: Option<&'a str>,
469}
470impl<'a> From<ReflectPgCastBorrowed<'a>> for ReflectPgCast {
471 fn from(
472 ReflectPgCastBorrowed {
473 castsource,
474 casttarget,
475 castfunc,
476 castcontext,
477 castmethod,
478 description,
479 }: ReflectPgCastBorrowed<'a>,
480 ) -> Self {
481 Self {
482 castsource: castsource.into(),
483 casttarget: casttarget.into(),
484 castfunc: castfunc.map(|v| v.into()),
485 castcontext,
486 castmethod,
487 description: description.map(|v| v.into()),
488 }
489 }
490}
491#[derive(Debug, Clone, PartialEq)]
492pub struct ReflectPgClass {
493 pub oid: String,
494 pub relname: String,
495 pub relnamespace: String,
496 pub reltype: Option<String>,
497 pub reloftype: Option<String>,
498 pub relowner: String,
499 pub relam: Option<String>,
500 pub relisshared: bool,
501 pub relpersistence: i8,
502 pub relkind: i8,
503 pub relnatts: i16,
504 pub relchecks: i16,
505 pub relrowsecurity: bool,
506 pub relforcerowsecurity: bool,
507 pub relreplident: i8,
508 pub relispartition: bool,
509 pub relacl: Option<Vec<crate::types::pg_temp_1::TableAclitem>>,
510 pub reloptions: Option<Vec<String>>,
511 pub relpartbound: Option<String>,
512 pub description: Option<String>,
513 pub seclabel: Option<String>,
514 pub seclabel_provider: Option<String>,
515 pub initprivs: Option<Vec<crate::types::pg_temp_1::TableAclitem>>,
516 pub initprivs_type: Option<i8>,
517}
518pub struct ReflectPgClassBorrowed<'a> {
519 pub oid: &'a str,
520 pub relname: &'a str,
521 pub relnamespace: &'a str,
522 pub reltype: Option<&'a str>,
523 pub reloftype: Option<&'a str>,
524 pub relowner: &'a str,
525 pub relam: Option<&'a str>,
526 pub relisshared: bool,
527 pub relpersistence: i8,
528 pub relkind: i8,
529 pub relnatts: i16,
530 pub relchecks: i16,
531 pub relrowsecurity: bool,
532 pub relforcerowsecurity: bool,
533 pub relreplident: i8,
534 pub relispartition: bool,
535 pub relacl: Option<crate::ArrayIterator<'a, crate::types::pg_temp_1::TableAclitemBorrowed<'a>>>,
536 pub reloptions: Option<crate::ArrayIterator<'a, &'a str>>,
537 pub relpartbound: Option<&'a str>,
538 pub description: Option<&'a str>,
539 pub seclabel: Option<&'a str>,
540 pub seclabel_provider: Option<&'a str>,
541 pub initprivs:
542 Option<crate::ArrayIterator<'a, crate::types::pg_temp_1::TableAclitemBorrowed<'a>>>,
543 pub initprivs_type: Option<i8>,
544}
545impl<'a> From<ReflectPgClassBorrowed<'a>> for ReflectPgClass {
546 fn from(
547 ReflectPgClassBorrowed {
548 oid,
549 relname,
550 relnamespace,
551 reltype,
552 reloftype,
553 relowner,
554 relam,
555 relisshared,
556 relpersistence,
557 relkind,
558 relnatts,
559 relchecks,
560 relrowsecurity,
561 relforcerowsecurity,
562 relreplident,
563 relispartition,
564 relacl,
565 reloptions,
566 relpartbound,
567 description,
568 seclabel,
569 seclabel_provider,
570 initprivs,
571 initprivs_type,
572 }: ReflectPgClassBorrowed<'a>,
573 ) -> Self {
574 Self {
575 oid: oid.into(),
576 relname: relname.into(),
577 relnamespace: relnamespace.into(),
578 reltype: reltype.map(|v| v.into()),
579 reloftype: reloftype.map(|v| v.into()),
580 relowner: relowner.into(),
581 relam: relam.map(|v| v.into()),
582 relisshared,
583 relpersistence,
584 relkind,
585 relnatts,
586 relchecks,
587 relrowsecurity,
588 relforcerowsecurity,
589 relreplident,
590 relispartition,
591 relacl: relacl.map(|v| v.map(|v| v.into()).collect()),
592 reloptions: reloptions.map(|v| v.map(|v| v.into()).collect()),
593 relpartbound: relpartbound.map(|v| v.into()),
594 description: description.map(|v| v.into()),
595 seclabel: seclabel.map(|v| v.into()),
596 seclabel_provider: seclabel_provider.map(|v| v.into()),
597 initprivs: initprivs.map(|v| v.map(|v| v.into()).collect()),
598 initprivs_type,
599 }
600 }
601}
602#[derive(Debug, Clone, PartialEq)]
603pub struct ReflectPgCollation {
604 pub oid: String,
605 pub collname: String,
606 pub collnamespace: String,
607 pub collowner: String,
608 pub collprovider: i8,
609 pub collisdeterministic: bool,
610 pub collencoding: Option<String>,
611 pub collcollate: Option<String>,
612 pub collctype: Option<String>,
613 pub colllocale: Option<String>,
614 pub collicurules: Option<String>,
615 pub description: Option<String>,
616}
617pub struct ReflectPgCollationBorrowed<'a> {
618 pub oid: &'a str,
619 pub collname: &'a str,
620 pub collnamespace: &'a str,
621 pub collowner: &'a str,
622 pub collprovider: i8,
623 pub collisdeterministic: bool,
624 pub collencoding: Option<&'a str>,
625 pub collcollate: Option<&'a str>,
626 pub collctype: Option<&'a str>,
627 pub colllocale: Option<&'a str>,
628 pub collicurules: Option<&'a str>,
629 pub description: Option<&'a str>,
630}
631impl<'a> From<ReflectPgCollationBorrowed<'a>> for ReflectPgCollation {
632 fn from(
633 ReflectPgCollationBorrowed {
634 oid,
635 collname,
636 collnamespace,
637 collowner,
638 collprovider,
639 collisdeterministic,
640 collencoding,
641 collcollate,
642 collctype,
643 colllocale,
644 collicurules,
645 description,
646 }: ReflectPgCollationBorrowed<'a>,
647 ) -> Self {
648 Self {
649 oid: oid.into(),
650 collname: collname.into(),
651 collnamespace: collnamespace.into(),
652 collowner: collowner.into(),
653 collprovider,
654 collisdeterministic,
655 collencoding: collencoding.map(|v| v.into()),
656 collcollate: collcollate.map(|v| v.into()),
657 collctype: collctype.map(|v| v.into()),
658 colllocale: colllocale.map(|v| v.into()),
659 collicurules: collicurules.map(|v| v.into()),
660 description: description.map(|v| v.into()),
661 }
662 }
663}
664#[derive(Debug, Clone, PartialEq)]
665pub struct ReflectPgConstraint {
666 pub conname: String,
667 pub connamespace: String,
668 pub contype: i8,
669 pub condeferrable: bool,
670 pub condeferred: bool,
671 pub convalidated: bool,
672 pub conrelid: Option<String>,
673 pub contypid: Option<String>,
674 pub conindid: Option<String>,
675 pub conparentid: Option<String>,
676 pub confrelid: Option<String>,
677 pub confupdtype: Option<i8>,
678 pub confdeltype: Option<i8>,
679 pub confmatchtype: Option<i8>,
680 pub conislocal: bool,
681 pub coninhcount: i16,
682 pub connoinherit: bool,
683 pub conkey: Option<Vec<i16>>,
684 pub confkey: Option<Vec<i16>>,
685 pub conpfeqop: Option<Vec<String>>,
686 pub conppeqop: Option<Vec<String>>,
687 pub conffeqop: Option<Vec<String>>,
688 pub confdelsetcols: Option<Vec<i16>>,
689 pub conexclop: Option<Vec<String>>,
690 pub conbin: Option<String>,
691 pub description: Option<String>,
692}
693pub struct ReflectPgConstraintBorrowed<'a> {
694 pub conname: &'a str,
695 pub connamespace: &'a str,
696 pub contype: i8,
697 pub condeferrable: bool,
698 pub condeferred: bool,
699 pub convalidated: bool,
700 pub conrelid: Option<&'a str>,
701 pub contypid: Option<&'a str>,
702 pub conindid: Option<&'a str>,
703 pub conparentid: Option<&'a str>,
704 pub confrelid: Option<&'a str>,
705 pub confupdtype: Option<i8>,
706 pub confdeltype: Option<i8>,
707 pub confmatchtype: Option<i8>,
708 pub conislocal: bool,
709 pub coninhcount: i16,
710 pub connoinherit: bool,
711 pub conkey: Option<crate::ArrayIterator<'a, i16>>,
712 pub confkey: Option<crate::ArrayIterator<'a, i16>>,
713 pub conpfeqop: Option<crate::ArrayIterator<'a, &'a str>>,
714 pub conppeqop: Option<crate::ArrayIterator<'a, &'a str>>,
715 pub conffeqop: Option<crate::ArrayIterator<'a, &'a str>>,
716 pub confdelsetcols: Option<crate::ArrayIterator<'a, i16>>,
717 pub conexclop: Option<crate::ArrayIterator<'a, &'a str>>,
718 pub conbin: Option<&'a str>,
719 pub description: Option<&'a str>,
720}
721impl<'a> From<ReflectPgConstraintBorrowed<'a>> for ReflectPgConstraint {
722 fn from(
723 ReflectPgConstraintBorrowed {
724 conname,
725 connamespace,
726 contype,
727 condeferrable,
728 condeferred,
729 convalidated,
730 conrelid,
731 contypid,
732 conindid,
733 conparentid,
734 confrelid,
735 confupdtype,
736 confdeltype,
737 confmatchtype,
738 conislocal,
739 coninhcount,
740 connoinherit,
741 conkey,
742 confkey,
743 conpfeqop,
744 conppeqop,
745 conffeqop,
746 confdelsetcols,
747 conexclop,
748 conbin,
749 description,
750 }: ReflectPgConstraintBorrowed<'a>,
751 ) -> Self {
752 Self {
753 conname: conname.into(),
754 connamespace: connamespace.into(),
755 contype,
756 condeferrable,
757 condeferred,
758 convalidated,
759 conrelid: conrelid.map(|v| v.into()),
760 contypid: contypid.map(|v| v.into()),
761 conindid: conindid.map(|v| v.into()),
762 conparentid: conparentid.map(|v| v.into()),
763 confrelid: confrelid.map(|v| v.into()),
764 confupdtype,
765 confdeltype,
766 confmatchtype,
767 conislocal,
768 coninhcount,
769 connoinherit,
770 conkey: conkey.map(|v| v.map(|v| v).collect()),
771 confkey: confkey.map(|v| v.map(|v| v).collect()),
772 conpfeqop: conpfeqop.map(|v| v.map(|v| v.into()).collect()),
773 conppeqop: conppeqop.map(|v| v.map(|v| v.into()).collect()),
774 conffeqop: conffeqop.map(|v| v.map(|v| v.into()).collect()),
775 confdelsetcols: confdelsetcols.map(|v| v.map(|v| v).collect()),
776 conexclop: conexclop.map(|v| v.map(|v| v.into()).collect()),
777 conbin: conbin.map(|v| v.into()),
778 description: description.map(|v| v.into()),
779 }
780 }
781}
782#[derive(Debug, Clone, PartialEq)]
783pub struct ReflectPgConversion {
784 pub conname: String,
785 pub connamespace: String,
786 pub conowner: String,
787 pub conforencoding: String,
788 pub contoencoding: String,
789 pub conproc: String,
790 pub condefault: bool,
791 pub description: Option<String>,
792}
793pub struct ReflectPgConversionBorrowed<'a> {
794 pub conname: &'a str,
795 pub connamespace: &'a str,
796 pub conowner: &'a str,
797 pub conforencoding: &'a str,
798 pub contoencoding: &'a str,
799 pub conproc: &'a str,
800 pub condefault: bool,
801 pub description: Option<&'a str>,
802}
803impl<'a> From<ReflectPgConversionBorrowed<'a>> for ReflectPgConversion {
804 fn from(
805 ReflectPgConversionBorrowed {
806 conname,
807 connamespace,
808 conowner,
809 conforencoding,
810 contoencoding,
811 conproc,
812 condefault,
813 description,
814 }: ReflectPgConversionBorrowed<'a>,
815 ) -> Self {
816 Self {
817 conname: conname.into(),
818 connamespace: connamespace.into(),
819 conowner: conowner.into(),
820 conforencoding: conforencoding.into(),
821 contoencoding: contoencoding.into(),
822 conproc: conproc.into(),
823 condefault,
824 description: description.map(|v| v.into()),
825 }
826 }
827}
828#[derive(Debug, Clone, PartialEq)]
829pub struct ReflectPgDatabase {
830 pub datname: String,
831 pub datdba: String,
832 pub encoding: String,
833 pub datlocprovider: i8,
834 pub datistemplate: bool,
835 pub datallowconn: bool,
836 pub datconnlimit: Option<i32>,
837 pub datcollate: Option<String>,
838 pub datctype: Option<String>,
839 pub datlocale: Option<String>,
840 pub daticurules: Option<String>,
841 pub datacl: Option<Vec<crate::types::pg_temp_1::DbAclitem>>,
842 pub description: Option<String>,
843 pub seclabel: Option<String>,
844 pub seclabel_provider: Option<String>,
845}
846pub struct ReflectPgDatabaseBorrowed<'a> {
847 pub datname: &'a str,
848 pub datdba: &'a str,
849 pub encoding: &'a str,
850 pub datlocprovider: i8,
851 pub datistemplate: bool,
852 pub datallowconn: bool,
853 pub datconnlimit: Option<i32>,
854 pub datcollate: Option<&'a str>,
855 pub datctype: Option<&'a str>,
856 pub datlocale: Option<&'a str>,
857 pub daticurules: Option<&'a str>,
858 pub datacl: Option<crate::ArrayIterator<'a, crate::types::pg_temp_1::DbAclitemBorrowed<'a>>>,
859 pub description: Option<&'a str>,
860 pub seclabel: Option<&'a str>,
861 pub seclabel_provider: Option<&'a str>,
862}
863impl<'a> From<ReflectPgDatabaseBorrowed<'a>> for ReflectPgDatabase {
864 fn from(
865 ReflectPgDatabaseBorrowed {
866 datname,
867 datdba,
868 encoding,
869 datlocprovider,
870 datistemplate,
871 datallowconn,
872 datconnlimit,
873 datcollate,
874 datctype,
875 datlocale,
876 daticurules,
877 datacl,
878 description,
879 seclabel,
880 seclabel_provider,
881 }: ReflectPgDatabaseBorrowed<'a>,
882 ) -> Self {
883 Self {
884 datname: datname.into(),
885 datdba: datdba.into(),
886 encoding: encoding.into(),
887 datlocprovider,
888 datistemplate,
889 datallowconn,
890 datconnlimit,
891 datcollate: datcollate.map(|v| v.into()),
892 datctype: datctype.map(|v| v.into()),
893 datlocale: datlocale.map(|v| v.into()),
894 daticurules: daticurules.map(|v| v.into()),
895 datacl: datacl.map(|v| v.map(|v| v.into()).collect()),
896 description: description.map(|v| v.into()),
897 seclabel: seclabel.map(|v| v.into()),
898 seclabel_provider: seclabel_provider.map(|v| v.into()),
899 }
900 }
901}
902#[derive(Debug, Clone, PartialEq)]
903pub struct ReflectPgDefaultAcl {
904 pub defaclrole: String,
905 pub defaclnamespace: Option<String>,
906 pub defaclobjtype: i8,
907 pub defaclacl: Option<Vec<crate::types::pg_temp_1::AcldefaultAclitem>>,
908}
909pub struct ReflectPgDefaultAclBorrowed<'a> {
910 pub defaclrole: &'a str,
911 pub defaclnamespace: Option<&'a str>,
912 pub defaclobjtype: i8,
913 pub defaclacl:
914 Option<crate::ArrayIterator<'a, crate::types::pg_temp_1::AcldefaultAclitemBorrowed<'a>>>,
915}
916impl<'a> From<ReflectPgDefaultAclBorrowed<'a>> for ReflectPgDefaultAcl {
917 fn from(
918 ReflectPgDefaultAclBorrowed {
919 defaclrole,
920 defaclnamespace,
921 defaclobjtype,
922 defaclacl,
923 }: ReflectPgDefaultAclBorrowed<'a>,
924 ) -> Self {
925 Self {
926 defaclrole: defaclrole.into(),
927 defaclnamespace: defaclnamespace.map(|v| v.into()),
928 defaclobjtype,
929 defaclacl: defaclacl.map(|v| v.map(|v| v.into()).collect()),
930 }
931 }
932}
933#[derive(Debug, Clone, PartialEq)]
934pub struct ReflectPgEventTrigger {
935 pub evtname: String,
936 pub evtevent: String,
937 pub evtowner: String,
938 pub evtfoid: String,
939 pub evtenabled: i8,
940 pub evttags: Option<Vec<String>>,
941 pub description: Option<String>,
942 pub seclabel: Option<String>,
943 pub seclabel_provider: Option<String>,
944}
945pub struct ReflectPgEventTriggerBorrowed<'a> {
946 pub evtname: &'a str,
947 pub evtevent: &'a str,
948 pub evtowner: &'a str,
949 pub evtfoid: &'a str,
950 pub evtenabled: i8,
951 pub evttags: Option<crate::ArrayIterator<'a, &'a str>>,
952 pub description: Option<&'a str>,
953 pub seclabel: Option<&'a str>,
954 pub seclabel_provider: Option<&'a str>,
955}
956impl<'a> From<ReflectPgEventTriggerBorrowed<'a>> for ReflectPgEventTrigger {
957 fn from(
958 ReflectPgEventTriggerBorrowed {
959 evtname,
960 evtevent,
961 evtowner,
962 evtfoid,
963 evtenabled,
964 evttags,
965 description,
966 seclabel,
967 seclabel_provider,
968 }: ReflectPgEventTriggerBorrowed<'a>,
969 ) -> Self {
970 Self {
971 evtname: evtname.into(),
972 evtevent: evtevent.into(),
973 evtowner: evtowner.into(),
974 evtfoid: evtfoid.into(),
975 evtenabled,
976 evttags: evttags.map(|v| v.map(|v| v.into()).collect()),
977 description: description.map(|v| v.into()),
978 seclabel: seclabel.map(|v| v.into()),
979 seclabel_provider: seclabel_provider.map(|v| v.into()),
980 }
981 }
982}
983#[derive(Debug, Clone, PartialEq)]
984pub struct ReflectPgExtension {
985 pub extname: String,
986 pub extowner: String,
987 pub extnamespace: String,
988 pub extrelocatable: bool,
989 pub extversion: String,
990 pub extconfig: Option<Vec<String>>,
991 pub extcondition: Option<Vec<String>>,
992 pub description: Option<String>,
993}
994pub struct ReflectPgExtensionBorrowed<'a> {
995 pub extname: &'a str,
996 pub extowner: &'a str,
997 pub extnamespace: &'a str,
998 pub extrelocatable: bool,
999 pub extversion: &'a str,
1000 pub extconfig: Option<crate::ArrayIterator<'a, &'a str>>,
1001 pub extcondition: Option<crate::ArrayIterator<'a, &'a str>>,
1002 pub description: Option<&'a str>,
1003}
1004impl<'a> From<ReflectPgExtensionBorrowed<'a>> for ReflectPgExtension {
1005 fn from(
1006 ReflectPgExtensionBorrowed {
1007 extname,
1008 extowner,
1009 extnamespace,
1010 extrelocatable,
1011 extversion,
1012 extconfig,
1013 extcondition,
1014 description,
1015 }: ReflectPgExtensionBorrowed<'a>,
1016 ) -> Self {
1017 Self {
1018 extname: extname.into(),
1019 extowner: extowner.into(),
1020 extnamespace: extnamespace.into(),
1021 extrelocatable,
1022 extversion: extversion.into(),
1023 extconfig: extconfig.map(|v| v.map(|v| v.into()).collect()),
1024 extcondition: extcondition.map(|v| v.map(|v| v.into()).collect()),
1025 description: description.map(|v| v.into()),
1026 }
1027 }
1028}
1029#[derive(Debug, Clone, PartialEq)]
1030pub struct ReflectPgForeignDataWrapper {
1031 pub fdwname: String,
1032 pub fdwowner: String,
1033 pub fdwhandler: Option<String>,
1034 pub fdwvalidator: Option<String>,
1035 pub fdwacl: Option<Vec<crate::types::pg_temp_1::ForeigndatawrapperAclitem>>,
1036 pub fdwoptions: Option<Vec<String>>,
1037 pub description: Option<String>,
1038 pub initprivs: Option<Vec<crate::types::pg_temp_1::ForeigndatawrapperAclitem>>,
1039 pub initprivs_type: Option<i8>,
1040}
1041pub struct ReflectPgForeignDataWrapperBorrowed<'a> {
1042 pub fdwname: &'a str,
1043 pub fdwowner: &'a str,
1044 pub fdwhandler: Option<&'a str>,
1045 pub fdwvalidator: Option<&'a str>,
1046 pub fdwacl: Option<
1047 crate::ArrayIterator<'a, crate::types::pg_temp_1::ForeigndatawrapperAclitemBorrowed<'a>>,
1048 >,
1049 pub fdwoptions: Option<crate::ArrayIterator<'a, &'a str>>,
1050 pub description: Option<&'a str>,
1051 pub initprivs: Option<
1052 crate::ArrayIterator<'a, crate::types::pg_temp_1::ForeigndatawrapperAclitemBorrowed<'a>>,
1053 >,
1054 pub initprivs_type: Option<i8>,
1055}
1056impl<'a> From<ReflectPgForeignDataWrapperBorrowed<'a>> for ReflectPgForeignDataWrapper {
1057 fn from(
1058 ReflectPgForeignDataWrapperBorrowed {
1059 fdwname,
1060 fdwowner,
1061 fdwhandler,
1062 fdwvalidator,
1063 fdwacl,
1064 fdwoptions,
1065 description,
1066 initprivs,
1067 initprivs_type,
1068 }: ReflectPgForeignDataWrapperBorrowed<'a>,
1069 ) -> Self {
1070 Self {
1071 fdwname: fdwname.into(),
1072 fdwowner: fdwowner.into(),
1073 fdwhandler: fdwhandler.map(|v| v.into()),
1074 fdwvalidator: fdwvalidator.map(|v| v.into()),
1075 fdwacl: fdwacl.map(|v| v.map(|v| v.into()).collect()),
1076 fdwoptions: fdwoptions.map(|v| v.map(|v| v.into()).collect()),
1077 description: description.map(|v| v.into()),
1078 initprivs: initprivs.map(|v| v.map(|v| v.into()).collect()),
1079 initprivs_type,
1080 }
1081 }
1082}
1083#[derive(Debug, Clone, PartialEq)]
1084pub struct ReflectPgForeignServer {
1085 pub srvname: String,
1086 pub srvowner: String,
1087 pub srvfdw: String,
1088 pub srvtype: Option<String>,
1089 pub srvversion: Option<String>,
1090 pub srvacl: Option<Vec<crate::types::pg_temp_1::ForeignserverAclitem>>,
1091 pub srvoptions: Option<Vec<String>>,
1092 pub description: Option<String>,
1093 pub initprivs: Option<Vec<crate::types::pg_temp_1::ForeignserverAclitem>>,
1094 pub initprivs_type: Option<i8>,
1095}
1096pub struct ReflectPgForeignServerBorrowed<'a> {
1097 pub srvname: &'a str,
1098 pub srvowner: &'a str,
1099 pub srvfdw: &'a str,
1100 pub srvtype: Option<&'a str>,
1101 pub srvversion: Option<&'a str>,
1102 pub srvacl:
1103 Option<crate::ArrayIterator<'a, crate::types::pg_temp_1::ForeignserverAclitemBorrowed<'a>>>,
1104 pub srvoptions: Option<crate::ArrayIterator<'a, &'a str>>,
1105 pub description: Option<&'a str>,
1106 pub initprivs:
1107 Option<crate::ArrayIterator<'a, crate::types::pg_temp_1::ForeignserverAclitemBorrowed<'a>>>,
1108 pub initprivs_type: Option<i8>,
1109}
1110impl<'a> From<ReflectPgForeignServerBorrowed<'a>> for ReflectPgForeignServer {
1111 fn from(
1112 ReflectPgForeignServerBorrowed {
1113 srvname,
1114 srvowner,
1115 srvfdw,
1116 srvtype,
1117 srvversion,
1118 srvacl,
1119 srvoptions,
1120 description,
1121 initprivs,
1122 initprivs_type,
1123 }: ReflectPgForeignServerBorrowed<'a>,
1124 ) -> Self {
1125 Self {
1126 srvname: srvname.into(),
1127 srvowner: srvowner.into(),
1128 srvfdw: srvfdw.into(),
1129 srvtype: srvtype.map(|v| v.into()),
1130 srvversion: srvversion.map(|v| v.into()),
1131 srvacl: srvacl.map(|v| v.map(|v| v.into()).collect()),
1132 srvoptions: srvoptions.map(|v| v.map(|v| v.into()).collect()),
1133 description: description.map(|v| v.into()),
1134 initprivs: initprivs.map(|v| v.map(|v| v.into()).collect()),
1135 initprivs_type,
1136 }
1137 }
1138}
1139#[derive(Debug, Clone, PartialEq)]
1140pub struct ReflectPgForeignTable {
1141 pub ftrelid: String,
1142 pub ftserver: String,
1143 pub ftoptions: Option<Vec<String>>,
1144}
1145pub struct ReflectPgForeignTableBorrowed<'a> {
1146 pub ftrelid: &'a str,
1147 pub ftserver: &'a str,
1148 pub ftoptions: Option<crate::ArrayIterator<'a, &'a str>>,
1149}
1150impl<'a> From<ReflectPgForeignTableBorrowed<'a>> for ReflectPgForeignTable {
1151 fn from(
1152 ReflectPgForeignTableBorrowed {
1153 ftrelid,
1154 ftserver,
1155 ftoptions,
1156 }: ReflectPgForeignTableBorrowed<'a>,
1157 ) -> Self {
1158 Self {
1159 ftrelid: ftrelid.into(),
1160 ftserver: ftserver.into(),
1161 ftoptions: ftoptions.map(|v| v.map(|v| v.into()).collect()),
1162 }
1163 }
1164}
1165#[derive(Debug, Clone, PartialEq)]
1166pub struct ReflectPgIndex {
1167 pub indexrelid: String,
1168 pub indrelid: String,
1169 pub indnatts: i16,
1170 pub indnkeyatts: i16,
1171 pub indisunique: bool,
1172 pub indnullsnotdistinct: bool,
1173 pub indisprimary: bool,
1174 pub indisexclusion: bool,
1175 pub indimmediate: bool,
1176 pub indisreplident: bool,
1177 pub indkey: Vec<i16>,
1178 pub indcollation: Vec<Option<String>>,
1179 pub indclass: Vec<String>,
1180 pub indoption: Vec<i16>,
1181 pub indexprs: Option<String>,
1182 pub indpred: Option<String>,
1183}
1184pub struct ReflectPgIndexBorrowed<'a> {
1185 pub indexrelid: &'a str,
1186 pub indrelid: &'a str,
1187 pub indnatts: i16,
1188 pub indnkeyatts: i16,
1189 pub indisunique: bool,
1190 pub indnullsnotdistinct: bool,
1191 pub indisprimary: bool,
1192 pub indisexclusion: bool,
1193 pub indimmediate: bool,
1194 pub indisreplident: bool,
1195 pub indkey: crate::ArrayIterator<'a, i16>,
1196 pub indcollation: crate::ArrayIterator<'a, Option<&'a str>>,
1197 pub indclass: crate::ArrayIterator<'a, &'a str>,
1198 pub indoption: crate::ArrayIterator<'a, i16>,
1199 pub indexprs: Option<&'a str>,
1200 pub indpred: Option<&'a str>,
1201}
1202impl<'a> From<ReflectPgIndexBorrowed<'a>> for ReflectPgIndex {
1203 fn from(
1204 ReflectPgIndexBorrowed {
1205 indexrelid,
1206 indrelid,
1207 indnatts,
1208 indnkeyatts,
1209 indisunique,
1210 indnullsnotdistinct,
1211 indisprimary,
1212 indisexclusion,
1213 indimmediate,
1214 indisreplident,
1215 indkey,
1216 indcollation,
1217 indclass,
1218 indoption,
1219 indexprs,
1220 indpred,
1221 }: ReflectPgIndexBorrowed<'a>,
1222 ) -> Self {
1223 Self {
1224 indexrelid: indexrelid.into(),
1225 indrelid: indrelid.into(),
1226 indnatts,
1227 indnkeyatts,
1228 indisunique,
1229 indnullsnotdistinct,
1230 indisprimary,
1231 indisexclusion,
1232 indimmediate,
1233 indisreplident,
1234 indkey: indkey.map(|v| v).collect(),
1235 indcollation: indcollation.map(|v| v.map(|v| v.into())).collect(),
1236 indclass: indclass.map(|v| v.into()).collect(),
1237 indoption: indoption.map(|v| v).collect(),
1238 indexprs: indexprs.map(|v| v.into()),
1239 indpred: indpred.map(|v| v.into()),
1240 }
1241 }
1242}
1243#[derive(Debug, Clone, PartialEq)]
1244pub struct ReflectPgInherits {
1245 pub inhrelid: String,
1246 pub inhparent: String,
1247 pub inhseqno: i32,
1248}
1249pub struct ReflectPgInheritsBorrowed<'a> {
1250 pub inhrelid: &'a str,
1251 pub inhparent: &'a str,
1252 pub inhseqno: i32,
1253}
1254impl<'a> From<ReflectPgInheritsBorrowed<'a>> for ReflectPgInherits {
1255 fn from(
1256 ReflectPgInheritsBorrowed {
1257 inhrelid,
1258 inhparent,
1259 inhseqno,
1260 }: ReflectPgInheritsBorrowed<'a>,
1261 ) -> Self {
1262 Self {
1263 inhrelid: inhrelid.into(),
1264 inhparent: inhparent.into(),
1265 inhseqno,
1266 }
1267 }
1268}
1269#[derive(Debug, Clone, PartialEq)]
1270pub struct ReflectPgLanguage {
1271 pub lanname: String,
1272 pub lanowner: String,
1273 pub lanispl: bool,
1274 pub lanpltrusted: bool,
1275 pub lanplcallfoid: Option<String>,
1276 pub laninline: Option<String>,
1277 pub lanvalidator: Option<String>,
1278 pub lanacl: Option<Vec<crate::types::pg_temp_1::LanguageAclitem>>,
1279 pub description: Option<String>,
1280 pub seclabel: Option<String>,
1281 pub seclabel_provider: Option<String>,
1282 pub initprivs: Option<Vec<crate::types::pg_temp_1::LanguageAclitem>>,
1283 pub initprivs_type: Option<i8>,
1284}
1285pub struct ReflectPgLanguageBorrowed<'a> {
1286 pub lanname: &'a str,
1287 pub lanowner: &'a str,
1288 pub lanispl: bool,
1289 pub lanpltrusted: bool,
1290 pub lanplcallfoid: Option<&'a str>,
1291 pub laninline: Option<&'a str>,
1292 pub lanvalidator: Option<&'a str>,
1293 pub lanacl:
1294 Option<crate::ArrayIterator<'a, crate::types::pg_temp_1::LanguageAclitemBorrowed<'a>>>,
1295 pub description: Option<&'a str>,
1296 pub seclabel: Option<&'a str>,
1297 pub seclabel_provider: Option<&'a str>,
1298 pub initprivs:
1299 Option<crate::ArrayIterator<'a, crate::types::pg_temp_1::LanguageAclitemBorrowed<'a>>>,
1300 pub initprivs_type: Option<i8>,
1301}
1302impl<'a> From<ReflectPgLanguageBorrowed<'a>> for ReflectPgLanguage {
1303 fn from(
1304 ReflectPgLanguageBorrowed {
1305 lanname,
1306 lanowner,
1307 lanispl,
1308 lanpltrusted,
1309 lanplcallfoid,
1310 laninline,
1311 lanvalidator,
1312 lanacl,
1313 description,
1314 seclabel,
1315 seclabel_provider,
1316 initprivs,
1317 initprivs_type,
1318 }: ReflectPgLanguageBorrowed<'a>,
1319 ) -> Self {
1320 Self {
1321 lanname: lanname.into(),
1322 lanowner: lanowner.into(),
1323 lanispl,
1324 lanpltrusted,
1325 lanplcallfoid: lanplcallfoid.map(|v| v.into()),
1326 laninline: laninline.map(|v| v.into()),
1327 lanvalidator: lanvalidator.map(|v| v.into()),
1328 lanacl: lanacl.map(|v| v.map(|v| v.into()).collect()),
1329 description: description.map(|v| v.into()),
1330 seclabel: seclabel.map(|v| v.into()),
1331 seclabel_provider: seclabel_provider.map(|v| v.into()),
1332 initprivs: initprivs.map(|v| v.map(|v| v.into()).collect()),
1333 initprivs_type,
1334 }
1335 }
1336}
1337#[derive(Debug, Clone, PartialEq)]
1338pub struct ReflectPgNamespace {
1339 pub nspname: String,
1340 pub nspowner: String,
1341 pub nspacl: Option<Vec<crate::types::pg_temp_1::SchemaAclitem>>,
1342 pub description: Option<String>,
1343 pub seclabel: Option<String>,
1344 pub seclabel_provider: Option<String>,
1345 pub initprivs: Option<Vec<crate::types::pg_temp_1::SchemaAclitem>>,
1346 pub initprivs_type: Option<i8>,
1347}
1348pub struct ReflectPgNamespaceBorrowed<'a> {
1349 pub nspname: &'a str,
1350 pub nspowner: &'a str,
1351 pub nspacl:
1352 Option<crate::ArrayIterator<'a, crate::types::pg_temp_1::SchemaAclitemBorrowed<'a>>>,
1353 pub description: Option<&'a str>,
1354 pub seclabel: Option<&'a str>,
1355 pub seclabel_provider: Option<&'a str>,
1356 pub initprivs:
1357 Option<crate::ArrayIterator<'a, crate::types::pg_temp_1::SchemaAclitemBorrowed<'a>>>,
1358 pub initprivs_type: Option<i8>,
1359}
1360impl<'a> From<ReflectPgNamespaceBorrowed<'a>> for ReflectPgNamespace {
1361 fn from(
1362 ReflectPgNamespaceBorrowed {
1363 nspname,
1364 nspowner,
1365 nspacl,
1366 description,
1367 seclabel,
1368 seclabel_provider,
1369 initprivs,
1370 initprivs_type,
1371 }: ReflectPgNamespaceBorrowed<'a>,
1372 ) -> Self {
1373 Self {
1374 nspname: nspname.into(),
1375 nspowner: nspowner.into(),
1376 nspacl: nspacl.map(|v| v.map(|v| v.into()).collect()),
1377 description: description.map(|v| v.into()),
1378 seclabel: seclabel.map(|v| v.into()),
1379 seclabel_provider: seclabel_provider.map(|v| v.into()),
1380 initprivs: initprivs.map(|v| v.map(|v| v.into()).collect()),
1381 initprivs_type,
1382 }
1383 }
1384}
1385#[derive(Debug, Clone, PartialEq)]
1386pub struct ReflectPgOpclass {
1387 pub opcmethod: String,
1388 pub opcname: String,
1389 pub opcnamespace: String,
1390 pub opcowner: String,
1391 pub opcfamily: String,
1392 pub opcintype: String,
1393 pub opcdefault: bool,
1394 pub opckeytype: Option<String>,
1395 pub description: Option<String>,
1396}
1397pub struct ReflectPgOpclassBorrowed<'a> {
1398 pub opcmethod: &'a str,
1399 pub opcname: &'a str,
1400 pub opcnamespace: &'a str,
1401 pub opcowner: &'a str,
1402 pub opcfamily: &'a str,
1403 pub opcintype: &'a str,
1404 pub opcdefault: bool,
1405 pub opckeytype: Option<&'a str>,
1406 pub description: Option<&'a str>,
1407}
1408impl<'a> From<ReflectPgOpclassBorrowed<'a>> for ReflectPgOpclass {
1409 fn from(
1410 ReflectPgOpclassBorrowed {
1411 opcmethod,
1412 opcname,
1413 opcnamespace,
1414 opcowner,
1415 opcfamily,
1416 opcintype,
1417 opcdefault,
1418 opckeytype,
1419 description,
1420 }: ReflectPgOpclassBorrowed<'a>,
1421 ) -> Self {
1422 Self {
1423 opcmethod: opcmethod.into(),
1424 opcname: opcname.into(),
1425 opcnamespace: opcnamespace.into(),
1426 opcowner: opcowner.into(),
1427 opcfamily: opcfamily.into(),
1428 opcintype: opcintype.into(),
1429 opcdefault,
1430 opckeytype: opckeytype.map(|v| v.into()),
1431 description: description.map(|v| v.into()),
1432 }
1433 }
1434}
1435#[derive(Debug, Clone, PartialEq)]
1436pub struct ReflectPgOperator {
1437 pub oid: String,
1438 pub oprname: String,
1439 pub oprnamespace: String,
1440 pub oprowner: String,
1441 pub oprkind: i8,
1442 pub oprcanmerge: bool,
1443 pub oprcanhash: bool,
1444 pub oprleft: Option<String>,
1445 pub oprright: String,
1446 pub oprresult: Option<String>,
1447 pub oprcom: Option<String>,
1448 pub oprnegate: Option<String>,
1449 pub oprcode: Option<String>,
1450 pub oprrest: Option<String>,
1451 pub oprjoin: Option<String>,
1452 pub description: Option<String>,
1453}
1454pub struct ReflectPgOperatorBorrowed<'a> {
1455 pub oid: &'a str,
1456 pub oprname: &'a str,
1457 pub oprnamespace: &'a str,
1458 pub oprowner: &'a str,
1459 pub oprkind: i8,
1460 pub oprcanmerge: bool,
1461 pub oprcanhash: bool,
1462 pub oprleft: Option<&'a str>,
1463 pub oprright: &'a str,
1464 pub oprresult: Option<&'a str>,
1465 pub oprcom: Option<&'a str>,
1466 pub oprnegate: Option<&'a str>,
1467 pub oprcode: Option<&'a str>,
1468 pub oprrest: Option<&'a str>,
1469 pub oprjoin: Option<&'a str>,
1470 pub description: Option<&'a str>,
1471}
1472impl<'a> From<ReflectPgOperatorBorrowed<'a>> for ReflectPgOperator {
1473 fn from(
1474 ReflectPgOperatorBorrowed {
1475 oid,
1476 oprname,
1477 oprnamespace,
1478 oprowner,
1479 oprkind,
1480 oprcanmerge,
1481 oprcanhash,
1482 oprleft,
1483 oprright,
1484 oprresult,
1485 oprcom,
1486 oprnegate,
1487 oprcode,
1488 oprrest,
1489 oprjoin,
1490 description,
1491 }: ReflectPgOperatorBorrowed<'a>,
1492 ) -> Self {
1493 Self {
1494 oid: oid.into(),
1495 oprname: oprname.into(),
1496 oprnamespace: oprnamespace.into(),
1497 oprowner: oprowner.into(),
1498 oprkind,
1499 oprcanmerge,
1500 oprcanhash,
1501 oprleft: oprleft.map(|v| v.into()),
1502 oprright: oprright.into(),
1503 oprresult: oprresult.map(|v| v.into()),
1504 oprcom: oprcom.map(|v| v.into()),
1505 oprnegate: oprnegate.map(|v| v.into()),
1506 oprcode: oprcode.map(|v| v.into()),
1507 oprrest: oprrest.map(|v| v.into()),
1508 oprjoin: oprjoin.map(|v| v.into()),
1509 description: description.map(|v| v.into()),
1510 }
1511 }
1512}
1513#[derive(Debug, Clone, PartialEq)]
1514pub struct ReflectPgOpfamily {
1515 pub opfmethod: String,
1516 pub opfname: String,
1517 pub opfnamespace: String,
1518 pub opfowner: String,
1519 pub description: Option<String>,
1520}
1521pub struct ReflectPgOpfamilyBorrowed<'a> {
1522 pub opfmethod: &'a str,
1523 pub opfname: &'a str,
1524 pub opfnamespace: &'a str,
1525 pub opfowner: &'a str,
1526 pub description: Option<&'a str>,
1527}
1528impl<'a> From<ReflectPgOpfamilyBorrowed<'a>> for ReflectPgOpfamily {
1529 fn from(
1530 ReflectPgOpfamilyBorrowed {
1531 opfmethod,
1532 opfname,
1533 opfnamespace,
1534 opfowner,
1535 description,
1536 }: ReflectPgOpfamilyBorrowed<'a>,
1537 ) -> Self {
1538 Self {
1539 opfmethod: opfmethod.into(),
1540 opfname: opfname.into(),
1541 opfnamespace: opfnamespace.into(),
1542 opfowner: opfowner.into(),
1543 description: description.map(|v| v.into()),
1544 }
1545 }
1546}
1547#[derive(Debug, Clone, PartialEq)]
1548pub struct ReflectPgParameterAcl {
1549 pub parname: String,
1550 pub paracl: Option<Vec<crate::types::pg_temp_1::ParameterAclitem>>,
1551 pub initprivs: Option<Vec<crate::types::pg_temp_1::ParameterAclitem>>,
1552 pub initprivs_type: Option<i8>,
1553}
1554pub struct ReflectPgParameterAclBorrowed<'a> {
1555 pub parname: &'a str,
1556 pub paracl:
1557 Option<crate::ArrayIterator<'a, crate::types::pg_temp_1::ParameterAclitemBorrowed<'a>>>,
1558 pub initprivs:
1559 Option<crate::ArrayIterator<'a, crate::types::pg_temp_1::ParameterAclitemBorrowed<'a>>>,
1560 pub initprivs_type: Option<i8>,
1561}
1562impl<'a> From<ReflectPgParameterAclBorrowed<'a>> for ReflectPgParameterAcl {
1563 fn from(
1564 ReflectPgParameterAclBorrowed {
1565 parname,
1566 paracl,
1567 initprivs,
1568 initprivs_type,
1569 }: ReflectPgParameterAclBorrowed<'a>,
1570 ) -> Self {
1571 Self {
1572 parname: parname.into(),
1573 paracl: paracl.map(|v| v.map(|v| v.into()).collect()),
1574 initprivs: initprivs.map(|v| v.map(|v| v.into()).collect()),
1575 initprivs_type,
1576 }
1577 }
1578}
1579#[derive(Debug, Clone, PartialEq)]
1580pub struct ReflectPgPartitionedTable {
1581 pub partrelid: String,
1582 pub partstrat: i8,
1583 pub partnatts: i16,
1584 pub partdefid: Option<String>,
1585 pub partattrs: Vec<i16>,
1586 pub partclass: Vec<String>,
1587 pub partcollation: Vec<Option<String>>,
1588 pub partexprs: Option<String>,
1589}
1590pub struct ReflectPgPartitionedTableBorrowed<'a> {
1591 pub partrelid: &'a str,
1592 pub partstrat: i8,
1593 pub partnatts: i16,
1594 pub partdefid: Option<&'a str>,
1595 pub partattrs: crate::ArrayIterator<'a, i16>,
1596 pub partclass: crate::ArrayIterator<'a, &'a str>,
1597 pub partcollation: crate::ArrayIterator<'a, Option<&'a str>>,
1598 pub partexprs: Option<&'a str>,
1599}
1600impl<'a> From<ReflectPgPartitionedTableBorrowed<'a>> for ReflectPgPartitionedTable {
1601 fn from(
1602 ReflectPgPartitionedTableBorrowed {
1603 partrelid,
1604 partstrat,
1605 partnatts,
1606 partdefid,
1607 partattrs,
1608 partclass,
1609 partcollation,
1610 partexprs,
1611 }: ReflectPgPartitionedTableBorrowed<'a>,
1612 ) -> Self {
1613 Self {
1614 partrelid: partrelid.into(),
1615 partstrat,
1616 partnatts,
1617 partdefid: partdefid.map(|v| v.into()),
1618 partattrs: partattrs.map(|v| v).collect(),
1619 partclass: partclass.map(|v| v.into()).collect(),
1620 partcollation: partcollation.map(|v| v.map(|v| v.into())).collect(),
1621 partexprs: partexprs.map(|v| v.into()),
1622 }
1623 }
1624}
1625#[derive(Debug, Clone, PartialEq)]
1626pub struct ReflectPgPolicy {
1627 pub polname: String,
1628 pub polrelid: String,
1629 pub polcmd: i8,
1630 pub polpermissive: bool,
1631 pub polroles: Vec<Option<String>>,
1632 pub polqual: Option<String>,
1633 pub polwithcheck: Option<String>,
1634 pub description: Option<String>,
1635}
1636pub struct ReflectPgPolicyBorrowed<'a> {
1637 pub polname: &'a str,
1638 pub polrelid: &'a str,
1639 pub polcmd: i8,
1640 pub polpermissive: bool,
1641 pub polroles: crate::ArrayIterator<'a, Option<&'a str>>,
1642 pub polqual: Option<&'a str>,
1643 pub polwithcheck: Option<&'a str>,
1644 pub description: Option<&'a str>,
1645}
1646impl<'a> From<ReflectPgPolicyBorrowed<'a>> for ReflectPgPolicy {
1647 fn from(
1648 ReflectPgPolicyBorrowed {
1649 polname,
1650 polrelid,
1651 polcmd,
1652 polpermissive,
1653 polroles,
1654 polqual,
1655 polwithcheck,
1656 description,
1657 }: ReflectPgPolicyBorrowed<'a>,
1658 ) -> Self {
1659 Self {
1660 polname: polname.into(),
1661 polrelid: polrelid.into(),
1662 polcmd,
1663 polpermissive,
1664 polroles: polroles.map(|v| v.map(|v| v.into())).collect(),
1665 polqual: polqual.map(|v| v.into()),
1666 polwithcheck: polwithcheck.map(|v| v.into()),
1667 description: description.map(|v| v.into()),
1668 }
1669 }
1670}
1671#[derive(Debug, Clone, PartialEq)]
1672pub struct ReflectPgPublication {
1673 pub pubname: String,
1674 pub pubowner: String,
1675 pub puballtables: bool,
1676 pub pubinsert: bool,
1677 pub pubupdate: bool,
1678 pub pubdelete: bool,
1679 pub pubtruncate: bool,
1680 pub pubviaroot: bool,
1681 pub description: Option<String>,
1682 pub seclabel: Option<String>,
1683 pub seclabel_provider: Option<String>,
1684}
1685pub struct ReflectPgPublicationBorrowed<'a> {
1686 pub pubname: &'a str,
1687 pub pubowner: &'a str,
1688 pub puballtables: bool,
1689 pub pubinsert: bool,
1690 pub pubupdate: bool,
1691 pub pubdelete: bool,
1692 pub pubtruncate: bool,
1693 pub pubviaroot: bool,
1694 pub description: Option<&'a str>,
1695 pub seclabel: Option<&'a str>,
1696 pub seclabel_provider: Option<&'a str>,
1697}
1698impl<'a> From<ReflectPgPublicationBorrowed<'a>> for ReflectPgPublication {
1699 fn from(
1700 ReflectPgPublicationBorrowed {
1701 pubname,
1702 pubowner,
1703 puballtables,
1704 pubinsert,
1705 pubupdate,
1706 pubdelete,
1707 pubtruncate,
1708 pubviaroot,
1709 description,
1710 seclabel,
1711 seclabel_provider,
1712 }: ReflectPgPublicationBorrowed<'a>,
1713 ) -> Self {
1714 Self {
1715 pubname: pubname.into(),
1716 pubowner: pubowner.into(),
1717 puballtables,
1718 pubinsert,
1719 pubupdate,
1720 pubdelete,
1721 pubtruncate,
1722 pubviaroot,
1723 description: description.map(|v| v.into()),
1724 seclabel: seclabel.map(|v| v.into()),
1725 seclabel_provider: seclabel_provider.map(|v| v.into()),
1726 }
1727 }
1728}
1729#[derive(Debug, Clone, PartialEq)]
1730pub struct ReflectPgPublicationNamespace {
1731 pub pnpubid: String,
1732 pub pnnspid: String,
1733}
1734pub struct ReflectPgPublicationNamespaceBorrowed<'a> {
1735 pub pnpubid: &'a str,
1736 pub pnnspid: &'a str,
1737}
1738impl<'a> From<ReflectPgPublicationNamespaceBorrowed<'a>> for ReflectPgPublicationNamespace {
1739 fn from(
1740 ReflectPgPublicationNamespaceBorrowed {
1741 pnpubid,
1742 pnnspid,
1743 }: ReflectPgPublicationNamespaceBorrowed<'a>,
1744 ) -> Self {
1745 Self {
1746 pnpubid: pnpubid.into(),
1747 pnnspid: pnnspid.into(),
1748 }
1749 }
1750}
1751#[derive(Debug, Clone, PartialEq)]
1752pub struct ReflectPgPublicationRel {
1753 pub prpubid: String,
1754 pub prrelid: String,
1755 pub prqual: Option<String>,
1756 pub prattrs: Option<Vec<i16>>,
1757}
1758pub struct ReflectPgPublicationRelBorrowed<'a> {
1759 pub prpubid: &'a str,
1760 pub prrelid: &'a str,
1761 pub prqual: Option<&'a str>,
1762 pub prattrs: Option<crate::ArrayIterator<'a, i16>>,
1763}
1764impl<'a> From<ReflectPgPublicationRelBorrowed<'a>> for ReflectPgPublicationRel {
1765 fn from(
1766 ReflectPgPublicationRelBorrowed {
1767 prpubid,
1768 prrelid,
1769 prqual,
1770 prattrs,
1771 }: ReflectPgPublicationRelBorrowed<'a>,
1772 ) -> Self {
1773 Self {
1774 prpubid: prpubid.into(),
1775 prrelid: prrelid.into(),
1776 prqual: prqual.map(|v| v.into()),
1777 prattrs: prattrs.map(|v| v.map(|v| v).collect()),
1778 }
1779 }
1780}
1781#[derive(Debug, Clone, PartialEq)]
1782pub struct ReflectPgRange {
1783 pub rngtypid: String,
1784 pub rngsubtype: String,
1785 pub rngmultitypid: String,
1786 pub rngcollation: Option<String>,
1787 pub rngsubopc: String,
1788 pub rngcanonical: Option<String>,
1789 pub rngsubdiff: Option<String>,
1790}
1791pub struct ReflectPgRangeBorrowed<'a> {
1792 pub rngtypid: &'a str,
1793 pub rngsubtype: &'a str,
1794 pub rngmultitypid: &'a str,
1795 pub rngcollation: Option<&'a str>,
1796 pub rngsubopc: &'a str,
1797 pub rngcanonical: Option<&'a str>,
1798 pub rngsubdiff: Option<&'a str>,
1799}
1800impl<'a> From<ReflectPgRangeBorrowed<'a>> for ReflectPgRange {
1801 fn from(
1802 ReflectPgRangeBorrowed {
1803 rngtypid,
1804 rngsubtype,
1805 rngmultitypid,
1806 rngcollation,
1807 rngsubopc,
1808 rngcanonical,
1809 rngsubdiff,
1810 }: ReflectPgRangeBorrowed<'a>,
1811 ) -> Self {
1812 Self {
1813 rngtypid: rngtypid.into(),
1814 rngsubtype: rngsubtype.into(),
1815 rngmultitypid: rngmultitypid.into(),
1816 rngcollation: rngcollation.map(|v| v.into()),
1817 rngsubopc: rngsubopc.into(),
1818 rngcanonical: rngcanonical.map(|v| v.into()),
1819 rngsubdiff: rngsubdiff.map(|v| v.into()),
1820 }
1821 }
1822}
1823#[derive(Debug, Clone, PartialEq)]
1824pub struct ReflectPgRules {
1825 pub schemaname: String,
1826 pub tablename: String,
1827 pub rulename: String,
1828 pub definition: String,
1829 pub description: Option<String>,
1830}
1831pub struct ReflectPgRulesBorrowed<'a> {
1832 pub schemaname: &'a str,
1833 pub tablename: &'a str,
1834 pub rulename: &'a str,
1835 pub definition: &'a str,
1836 pub description: Option<&'a str>,
1837}
1838impl<'a> From<ReflectPgRulesBorrowed<'a>> for ReflectPgRules {
1839 fn from(
1840 ReflectPgRulesBorrowed {
1841 schemaname,
1842 tablename,
1843 rulename,
1844 definition,
1845 description,
1846 }: ReflectPgRulesBorrowed<'a>,
1847 ) -> Self {
1848 Self {
1849 schemaname: schemaname.into(),
1850 tablename: tablename.into(),
1851 rulename: rulename.into(),
1852 definition: definition.into(),
1853 description: description.map(|v| v.into()),
1854 }
1855 }
1856}
1857#[derive(Debug, Clone, PartialEq)]
1858pub struct ReflectPgViews {
1859 pub schemaname: String,
1860 pub viewname: String,
1861 pub viewowner: String,
1862 pub definition: String,
1863}
1864pub struct ReflectPgViewsBorrowed<'a> {
1865 pub schemaname: &'a str,
1866 pub viewname: &'a str,
1867 pub viewowner: &'a str,
1868 pub definition: &'a str,
1869}
1870impl<'a> From<ReflectPgViewsBorrowed<'a>> for ReflectPgViews {
1871 fn from(
1872 ReflectPgViewsBorrowed {
1873 schemaname,
1874 viewname,
1875 viewowner,
1876 definition,
1877 }: ReflectPgViewsBorrowed<'a>,
1878 ) -> Self {
1879 Self {
1880 schemaname: schemaname.into(),
1881 viewname: viewname.into(),
1882 viewowner: viewowner.into(),
1883 definition: definition.into(),
1884 }
1885 }
1886}
1887#[derive(Debug, Clone, PartialEq)]
1888pub struct ReflectPgMatviews {
1889 pub schemaname: String,
1890 pub matviewname: String,
1891 pub matviewowner: String,
1892 pub definition: String,
1893}
1894pub struct ReflectPgMatviewsBorrowed<'a> {
1895 pub schemaname: &'a str,
1896 pub matviewname: &'a str,
1897 pub matviewowner: &'a str,
1898 pub definition: &'a str,
1899}
1900impl<'a> From<ReflectPgMatviewsBorrowed<'a>> for ReflectPgMatviews {
1901 fn from(
1902 ReflectPgMatviewsBorrowed {
1903 schemaname,
1904 matviewname,
1905 matviewowner,
1906 definition,
1907 }: ReflectPgMatviewsBorrowed<'a>,
1908 ) -> Self {
1909 Self {
1910 schemaname: schemaname.into(),
1911 matviewname: matviewname.into(),
1912 matviewowner: matviewowner.into(),
1913 definition: definition.into(),
1914 }
1915 }
1916}
1917#[derive(Debug, Clone, PartialEq)]
1918pub struct ReflectPgSequence {
1919 pub seqrelid: String,
1920 pub seqtypid: String,
1921 pub seqstart: i64,
1922 pub seqincrement: i64,
1923 pub seqmax: i64,
1924 pub seqmin: i64,
1925 pub seqcache: i64,
1926 pub seqcycle: bool,
1927}
1928pub struct ReflectPgSequenceBorrowed<'a> {
1929 pub seqrelid: &'a str,
1930 pub seqtypid: &'a str,
1931 pub seqstart: i64,
1932 pub seqincrement: i64,
1933 pub seqmax: i64,
1934 pub seqmin: i64,
1935 pub seqcache: i64,
1936 pub seqcycle: bool,
1937}
1938impl<'a> From<ReflectPgSequenceBorrowed<'a>> for ReflectPgSequence {
1939 fn from(
1940 ReflectPgSequenceBorrowed {
1941 seqrelid,
1942 seqtypid,
1943 seqstart,
1944 seqincrement,
1945 seqmax,
1946 seqmin,
1947 seqcache,
1948 seqcycle,
1949 }: ReflectPgSequenceBorrowed<'a>,
1950 ) -> Self {
1951 Self {
1952 seqrelid: seqrelid.into(),
1953 seqtypid: seqtypid.into(),
1954 seqstart,
1955 seqincrement,
1956 seqmax,
1957 seqmin,
1958 seqcache,
1959 seqcycle,
1960 }
1961 }
1962}
1963#[derive(Debug, Clone, PartialEq)]
1964pub struct ReflectPgStatisticExt {
1965 pub stxrelid: String,
1966 pub stxname: String,
1967 pub stxnamespace: String,
1968 pub stxowner: String,
1969 pub stxkeys: Vec<i16>,
1970 pub stxstattarget: Option<i16>,
1971 pub stxkind: Vec<i8>,
1972 pub stxexprs: Option<String>,
1973 pub description: Option<String>,
1974}
1975pub struct ReflectPgStatisticExtBorrowed<'a> {
1976 pub stxrelid: &'a str,
1977 pub stxname: &'a str,
1978 pub stxnamespace: &'a str,
1979 pub stxowner: &'a str,
1980 pub stxkeys: crate::ArrayIterator<'a, i16>,
1981 pub stxstattarget: Option<i16>,
1982 pub stxkind: crate::ArrayIterator<'a, i8>,
1983 pub stxexprs: Option<&'a str>,
1984 pub description: Option<&'a str>,
1985}
1986impl<'a> From<ReflectPgStatisticExtBorrowed<'a>> for ReflectPgStatisticExt {
1987 fn from(
1988 ReflectPgStatisticExtBorrowed {
1989 stxrelid,
1990 stxname,
1991 stxnamespace,
1992 stxowner,
1993 stxkeys,
1994 stxstattarget,
1995 stxkind,
1996 stxexprs,
1997 description,
1998 }: ReflectPgStatisticExtBorrowed<'a>,
1999 ) -> Self {
2000 Self {
2001 stxrelid: stxrelid.into(),
2002 stxname: stxname.into(),
2003 stxnamespace: stxnamespace.into(),
2004 stxowner: stxowner.into(),
2005 stxkeys: stxkeys.map(|v| v).collect(),
2006 stxstattarget,
2007 stxkind: stxkind.map(|v| v).collect(),
2008 stxexprs: stxexprs.map(|v| v.into()),
2009 description: description.map(|v| v.into()),
2010 }
2011 }
2012}
2013#[derive(Debug, Clone, PartialEq)]
2014pub struct ReflectPgSubscription {
2015 pub subname: String,
2016 pub subowner: String,
2017 pub subenabled: bool,
2018 pub subbinary: bool,
2019 pub substream: i8,
2020 pub subtwophasestate: i8,
2021 pub subdisableonerr: bool,
2022 pub subpasswordrequired: bool,
2023 pub subrunasowner: bool,
2024 pub subfailover: bool,
2025 pub subconninfo: String,
2026 pub subslotname: Option<String>,
2027 pub subsynccommit: String,
2028 pub subpublications: Vec<String>,
2029 pub suborigin: Option<String>,
2030 pub description: Option<String>,
2031 pub seclabel: Option<String>,
2032 pub seclabel_provider: Option<String>,
2033}
2034pub struct ReflectPgSubscriptionBorrowed<'a> {
2035 pub subname: &'a str,
2036 pub subowner: &'a str,
2037 pub subenabled: bool,
2038 pub subbinary: bool,
2039 pub substream: i8,
2040 pub subtwophasestate: i8,
2041 pub subdisableonerr: bool,
2042 pub subpasswordrequired: bool,
2043 pub subrunasowner: bool,
2044 pub subfailover: bool,
2045 pub subconninfo: &'a str,
2046 pub subslotname: Option<&'a str>,
2047 pub subsynccommit: &'a str,
2048 pub subpublications: crate::ArrayIterator<'a, &'a str>,
2049 pub suborigin: Option<&'a str>,
2050 pub description: Option<&'a str>,
2051 pub seclabel: Option<&'a str>,
2052 pub seclabel_provider: Option<&'a str>,
2053}
2054impl<'a> From<ReflectPgSubscriptionBorrowed<'a>> for ReflectPgSubscription {
2055 fn from(
2056 ReflectPgSubscriptionBorrowed {
2057 subname,
2058 subowner,
2059 subenabled,
2060 subbinary,
2061 substream,
2062 subtwophasestate,
2063 subdisableonerr,
2064 subpasswordrequired,
2065 subrunasowner,
2066 subfailover,
2067 subconninfo,
2068 subslotname,
2069 subsynccommit,
2070 subpublications,
2071 suborigin,
2072 description,
2073 seclabel,
2074 seclabel_provider,
2075 }: ReflectPgSubscriptionBorrowed<'a>,
2076 ) -> Self {
2077 Self {
2078 subname: subname.into(),
2079 subowner: subowner.into(),
2080 subenabled,
2081 subbinary,
2082 substream,
2083 subtwophasestate,
2084 subdisableonerr,
2085 subpasswordrequired,
2086 subrunasowner,
2087 subfailover,
2088 subconninfo: subconninfo.into(),
2089 subslotname: subslotname.map(|v| v.into()),
2090 subsynccommit: subsynccommit.into(),
2091 subpublications: subpublications.map(|v| v.into()).collect(),
2092 suborigin: suborigin.map(|v| v.into()),
2093 description: description.map(|v| v.into()),
2094 seclabel: seclabel.map(|v| v.into()),
2095 seclabel_provider: seclabel_provider.map(|v| v.into()),
2096 }
2097 }
2098}
2099#[derive(Debug, Clone, PartialEq)]
2100pub struct ReflectPgTransform {
2101 pub trftype: String,
2102 pub trflang: String,
2103 pub trffromsql: Option<String>,
2104 pub trftosql: Option<String>,
2105}
2106pub struct ReflectPgTransformBorrowed<'a> {
2107 pub trftype: &'a str,
2108 pub trflang: &'a str,
2109 pub trffromsql: Option<&'a str>,
2110 pub trftosql: Option<&'a str>,
2111}
2112impl<'a> From<ReflectPgTransformBorrowed<'a>> for ReflectPgTransform {
2113 fn from(
2114 ReflectPgTransformBorrowed {
2115 trftype,
2116 trflang,
2117 trffromsql,
2118 trftosql,
2119 }: ReflectPgTransformBorrowed<'a>,
2120 ) -> Self {
2121 Self {
2122 trftype: trftype.into(),
2123 trflang: trflang.into(),
2124 trffromsql: trffromsql.map(|v| v.into()),
2125 trftosql: trftosql.map(|v| v.into()),
2126 }
2127 }
2128}
2129#[derive(Debug, Clone, PartialEq)]
2130pub struct ReflectPgTrigger {
2131 pub tgrelid: String,
2132 pub tgparentid: Option<String>,
2133 pub tgname: String,
2134 pub tgfoid: String,
2135 pub tgtype: i16,
2136 pub tgenabled: i8,
2137 pub tgisinternal: bool,
2138 pub tgconstrrelid: Option<String>,
2139 pub tgconstrindid: Option<String>,
2140 pub tgconstraint: Option<String>,
2141 pub tgdeferrable: bool,
2142 pub tginitdeferred: bool,
2143 pub tgnargs: i16,
2144 pub tgattr: Vec<i16>,
2145 pub tgargs: Vec<u8>,
2146 pub tgqual: Option<String>,
2147 pub tgoldtable: Option<String>,
2148 pub tgnewtable: Option<String>,
2149 pub description: Option<String>,
2150 pub seclabel: Option<String>,
2151 pub seclabel_provider: Option<String>,
2152}
2153pub struct ReflectPgTriggerBorrowed<'a> {
2154 pub tgrelid: &'a str,
2155 pub tgparentid: Option<&'a str>,
2156 pub tgname: &'a str,
2157 pub tgfoid: &'a str,
2158 pub tgtype: i16,
2159 pub tgenabled: i8,
2160 pub tgisinternal: bool,
2161 pub tgconstrrelid: Option<&'a str>,
2162 pub tgconstrindid: Option<&'a str>,
2163 pub tgconstraint: Option<&'a str>,
2164 pub tgdeferrable: bool,
2165 pub tginitdeferred: bool,
2166 pub tgnargs: i16,
2167 pub tgattr: crate::ArrayIterator<'a, i16>,
2168 pub tgargs: &'a [u8],
2169 pub tgqual: Option<&'a str>,
2170 pub tgoldtable: Option<&'a str>,
2171 pub tgnewtable: Option<&'a str>,
2172 pub description: Option<&'a str>,
2173 pub seclabel: Option<&'a str>,
2174 pub seclabel_provider: Option<&'a str>,
2175}
2176impl<'a> From<ReflectPgTriggerBorrowed<'a>> for ReflectPgTrigger {
2177 fn from(
2178 ReflectPgTriggerBorrowed {
2179 tgrelid,
2180 tgparentid,
2181 tgname,
2182 tgfoid,
2183 tgtype,
2184 tgenabled,
2185 tgisinternal,
2186 tgconstrrelid,
2187 tgconstrindid,
2188 tgconstraint,
2189 tgdeferrable,
2190 tginitdeferred,
2191 tgnargs,
2192 tgattr,
2193 tgargs,
2194 tgqual,
2195 tgoldtable,
2196 tgnewtable,
2197 description,
2198 seclabel,
2199 seclabel_provider,
2200 }: ReflectPgTriggerBorrowed<'a>,
2201 ) -> Self {
2202 Self {
2203 tgrelid: tgrelid.into(),
2204 tgparentid: tgparentid.map(|v| v.into()),
2205 tgname: tgname.into(),
2206 tgfoid: tgfoid.into(),
2207 tgtype,
2208 tgenabled,
2209 tgisinternal,
2210 tgconstrrelid: tgconstrrelid.map(|v| v.into()),
2211 tgconstrindid: tgconstrindid.map(|v| v.into()),
2212 tgconstraint: tgconstraint.map(|v| v.into()),
2213 tgdeferrable,
2214 tginitdeferred,
2215 tgnargs,
2216 tgattr: tgattr.map(|v| v).collect(),
2217 tgargs: tgargs.into(),
2218 tgqual: tgqual.map(|v| v.into()),
2219 tgoldtable: tgoldtable.map(|v| v.into()),
2220 tgnewtable: tgnewtable.map(|v| v.into()),
2221 description: description.map(|v| v.into()),
2222 seclabel: seclabel.map(|v| v.into()),
2223 seclabel_provider: seclabel_provider.map(|v| v.into()),
2224 }
2225 }
2226}
2227#[derive(Debug, Clone, PartialEq)]
2228pub struct ReflectPgTsConfig {
2229 pub oid: String,
2230 pub cfgname: String,
2231 pub cfgnamespace: String,
2232 pub cfgowner: String,
2233 pub description: Option<String>,
2234 pub seclabel: Option<String>,
2235 pub seclabel_provider: Option<String>,
2236}
2237pub struct ReflectPgTsConfigBorrowed<'a> {
2238 pub oid: &'a str,
2239 pub cfgname: &'a str,
2240 pub cfgnamespace: &'a str,
2241 pub cfgowner: &'a str,
2242 pub description: Option<&'a str>,
2243 pub seclabel: Option<&'a str>,
2244 pub seclabel_provider: Option<&'a str>,
2245}
2246impl<'a> From<ReflectPgTsConfigBorrowed<'a>> for ReflectPgTsConfig {
2247 fn from(
2248 ReflectPgTsConfigBorrowed {
2249 oid,
2250 cfgname,
2251 cfgnamespace,
2252 cfgowner,
2253 description,
2254 seclabel,
2255 seclabel_provider,
2256 }: ReflectPgTsConfigBorrowed<'a>,
2257 ) -> Self {
2258 Self {
2259 oid: oid.into(),
2260 cfgname: cfgname.into(),
2261 cfgnamespace: cfgnamespace.into(),
2262 cfgowner: cfgowner.into(),
2263 description: description.map(|v| v.into()),
2264 seclabel: seclabel.map(|v| v.into()),
2265 seclabel_provider: seclabel_provider.map(|v| v.into()),
2266 }
2267 }
2268}
2269#[derive(Debug, Clone, PartialEq)]
2270pub struct ReflectPgTsConfigMap {
2271 pub mapcfg: String,
2272 pub maptokentype: i32,
2273 pub mapseqno: i32,
2274 pub mapdict: String,
2275}
2276pub struct ReflectPgTsConfigMapBorrowed<'a> {
2277 pub mapcfg: &'a str,
2278 pub maptokentype: i32,
2279 pub mapseqno: i32,
2280 pub mapdict: &'a str,
2281}
2282impl<'a> From<ReflectPgTsConfigMapBorrowed<'a>> for ReflectPgTsConfigMap {
2283 fn from(
2284 ReflectPgTsConfigMapBorrowed {
2285 mapcfg,
2286 maptokentype,
2287 mapseqno,
2288 mapdict,
2289 }: ReflectPgTsConfigMapBorrowed<'a>,
2290 ) -> Self {
2291 Self {
2292 mapcfg: mapcfg.into(),
2293 maptokentype,
2294 mapseqno,
2295 mapdict: mapdict.into(),
2296 }
2297 }
2298}
2299#[derive(Debug, Clone, PartialEq)]
2300pub struct ReflectPgTsDict {
2301 pub oid: String,
2302 pub dictname: String,
2303 pub dictnamespace: String,
2304 pub dictowner: String,
2305 pub dictinitoption: Option<String>,
2306 pub description: Option<String>,
2307 pub seclabel: Option<String>,
2308 pub seclabel_provider: Option<String>,
2309}
2310pub struct ReflectPgTsDictBorrowed<'a> {
2311 pub oid: &'a str,
2312 pub dictname: &'a str,
2313 pub dictnamespace: &'a str,
2314 pub dictowner: &'a str,
2315 pub dictinitoption: Option<&'a str>,
2316 pub description: Option<&'a str>,
2317 pub seclabel: Option<&'a str>,
2318 pub seclabel_provider: Option<&'a str>,
2319}
2320impl<'a> From<ReflectPgTsDictBorrowed<'a>> for ReflectPgTsDict {
2321 fn from(
2322 ReflectPgTsDictBorrowed {
2323 oid,
2324 dictname,
2325 dictnamespace,
2326 dictowner,
2327 dictinitoption,
2328 description,
2329 seclabel,
2330 seclabel_provider,
2331 }: ReflectPgTsDictBorrowed<'a>,
2332 ) -> Self {
2333 Self {
2334 oid: oid.into(),
2335 dictname: dictname.into(),
2336 dictnamespace: dictnamespace.into(),
2337 dictowner: dictowner.into(),
2338 dictinitoption: dictinitoption.map(|v| v.into()),
2339 description: description.map(|v| v.into()),
2340 seclabel: seclabel.map(|v| v.into()),
2341 seclabel_provider: seclabel_provider.map(|v| v.into()),
2342 }
2343 }
2344}
2345#[derive(Debug, Clone, PartialEq)]
2346pub struct ReflectPgTsParser {
2347 pub prsname: String,
2348 pub prsnamespace: String,
2349 pub prsstart: String,
2350 pub prstoken: String,
2351 pub prsend: String,
2352 pub prsheadline: Option<String>,
2353 pub prslextype: String,
2354}
2355pub struct ReflectPgTsParserBorrowed<'a> {
2356 pub prsname: &'a str,
2357 pub prsnamespace: &'a str,
2358 pub prsstart: &'a str,
2359 pub prstoken: &'a str,
2360 pub prsend: &'a str,
2361 pub prsheadline: Option<&'a str>,
2362 pub prslextype: &'a str,
2363}
2364impl<'a> From<ReflectPgTsParserBorrowed<'a>> for ReflectPgTsParser {
2365 fn from(
2366 ReflectPgTsParserBorrowed {
2367 prsname,
2368 prsnamespace,
2369 prsstart,
2370 prstoken,
2371 prsend,
2372 prsheadline,
2373 prslextype,
2374 }: ReflectPgTsParserBorrowed<'a>,
2375 ) -> Self {
2376 Self {
2377 prsname: prsname.into(),
2378 prsnamespace: prsnamespace.into(),
2379 prsstart: prsstart.into(),
2380 prstoken: prstoken.into(),
2381 prsend: prsend.into(),
2382 prsheadline: prsheadline.map(|v| v.into()),
2383 prslextype: prslextype.into(),
2384 }
2385 }
2386}
2387#[derive(Debug, Clone, PartialEq)]
2388pub struct ReflectPgTsTemplate {
2389 pub tmplname: String,
2390 pub tmplnamespace: String,
2391 pub tmplinit: Option<String>,
2392 pub tmpllexize: String,
2393}
2394pub struct ReflectPgTsTemplateBorrowed<'a> {
2395 pub tmplname: &'a str,
2396 pub tmplnamespace: &'a str,
2397 pub tmplinit: Option<&'a str>,
2398 pub tmpllexize: &'a str,
2399}
2400impl<'a> From<ReflectPgTsTemplateBorrowed<'a>> for ReflectPgTsTemplate {
2401 fn from(
2402 ReflectPgTsTemplateBorrowed {
2403 tmplname,
2404 tmplnamespace,
2405 tmplinit,
2406 tmpllexize,
2407 }: ReflectPgTsTemplateBorrowed<'a>,
2408 ) -> Self {
2409 Self {
2410 tmplname: tmplname.into(),
2411 tmplnamespace: tmplnamespace.into(),
2412 tmplinit: tmplinit.map(|v| v.into()),
2413 tmpllexize: tmpllexize.into(),
2414 }
2415 }
2416}
2417#[derive(Debug, Clone, PartialEq)]
2418pub struct ReflectPgType {
2419 pub oid: String,
2420 pub typname: String,
2421 pub typnamespace: String,
2422 pub typowner: String,
2423 pub typlen: i16,
2424 pub typbyval: bool,
2425 pub typtype: i8,
2426 pub typispreferred: bool,
2427 pub typisdefined: bool,
2428 pub typdelim: i8,
2429 pub typrelid: Option<String>,
2430 pub typsubscript: Option<String>,
2431 pub typelem: Option<String>,
2432 pub typarray: Option<String>,
2433 pub typinput: String,
2434 pub typoutput: String,
2435 pub typreceive: Option<String>,
2436 pub typsend: Option<String>,
2437 pub typmodin: Option<String>,
2438 pub typmodout: Option<String>,
2439 pub typanalyze: Option<String>,
2440 pub typalign: i8,
2441 pub typstorage: i8,
2442 pub typnotnull: bool,
2443 pub typbasetype: Option<String>,
2444 pub typtypmod: Option<i32>,
2445 pub typndims: i32,
2446 pub typcollation: Option<String>,
2447 pub typdefaultbin: Option<String>,
2448 pub typdefault: Option<String>,
2449 pub typacl: Option<Vec<crate::types::pg_temp_1::TypeAclitem>>,
2450 pub description: Option<String>,
2451 pub seclabel: Option<String>,
2452 pub seclabel_provider: Option<String>,
2453 pub initprivs: Option<Vec<crate::types::pg_temp_1::TypeAclitem>>,
2454 pub initprivs_type: Option<i8>,
2455}
2456pub struct ReflectPgTypeBorrowed<'a> {
2457 pub oid: &'a str,
2458 pub typname: &'a str,
2459 pub typnamespace: &'a str,
2460 pub typowner: &'a str,
2461 pub typlen: i16,
2462 pub typbyval: bool,
2463 pub typtype: i8,
2464 pub typispreferred: bool,
2465 pub typisdefined: bool,
2466 pub typdelim: i8,
2467 pub typrelid: Option<&'a str>,
2468 pub typsubscript: Option<&'a str>,
2469 pub typelem: Option<&'a str>,
2470 pub typarray: Option<&'a str>,
2471 pub typinput: &'a str,
2472 pub typoutput: &'a str,
2473 pub typreceive: Option<&'a str>,
2474 pub typsend: Option<&'a str>,
2475 pub typmodin: Option<&'a str>,
2476 pub typmodout: Option<&'a str>,
2477 pub typanalyze: Option<&'a str>,
2478 pub typalign: i8,
2479 pub typstorage: i8,
2480 pub typnotnull: bool,
2481 pub typbasetype: Option<&'a str>,
2482 pub typtypmod: Option<i32>,
2483 pub typndims: i32,
2484 pub typcollation: Option<&'a str>,
2485 pub typdefaultbin: Option<&'a str>,
2486 pub typdefault: Option<&'a str>,
2487 pub typacl: Option<crate::ArrayIterator<'a, crate::types::pg_temp_1::TypeAclitemBorrowed<'a>>>,
2488 pub description: Option<&'a str>,
2489 pub seclabel: Option<&'a str>,
2490 pub seclabel_provider: Option<&'a str>,
2491 pub initprivs:
2492 Option<crate::ArrayIterator<'a, crate::types::pg_temp_1::TypeAclitemBorrowed<'a>>>,
2493 pub initprivs_type: Option<i8>,
2494}
2495impl<'a> From<ReflectPgTypeBorrowed<'a>> for ReflectPgType {
2496 fn from(
2497 ReflectPgTypeBorrowed {
2498 oid,
2499 typname,
2500 typnamespace,
2501 typowner,
2502 typlen,
2503 typbyval,
2504 typtype,
2505 typispreferred,
2506 typisdefined,
2507 typdelim,
2508 typrelid,
2509 typsubscript,
2510 typelem,
2511 typarray,
2512 typinput,
2513 typoutput,
2514 typreceive,
2515 typsend,
2516 typmodin,
2517 typmodout,
2518 typanalyze,
2519 typalign,
2520 typstorage,
2521 typnotnull,
2522 typbasetype,
2523 typtypmod,
2524 typndims,
2525 typcollation,
2526 typdefaultbin,
2527 typdefault,
2528 typacl,
2529 description,
2530 seclabel,
2531 seclabel_provider,
2532 initprivs,
2533 initprivs_type,
2534 }: ReflectPgTypeBorrowed<'a>,
2535 ) -> Self {
2536 Self {
2537 oid: oid.into(),
2538 typname: typname.into(),
2539 typnamespace: typnamespace.into(),
2540 typowner: typowner.into(),
2541 typlen,
2542 typbyval,
2543 typtype,
2544 typispreferred,
2545 typisdefined,
2546 typdelim,
2547 typrelid: typrelid.map(|v| v.into()),
2548 typsubscript: typsubscript.map(|v| v.into()),
2549 typelem: typelem.map(|v| v.into()),
2550 typarray: typarray.map(|v| v.into()),
2551 typinput: typinput.into(),
2552 typoutput: typoutput.into(),
2553 typreceive: typreceive.map(|v| v.into()),
2554 typsend: typsend.map(|v| v.into()),
2555 typmodin: typmodin.map(|v| v.into()),
2556 typmodout: typmodout.map(|v| v.into()),
2557 typanalyze: typanalyze.map(|v| v.into()),
2558 typalign,
2559 typstorage,
2560 typnotnull,
2561 typbasetype: typbasetype.map(|v| v.into()),
2562 typtypmod,
2563 typndims,
2564 typcollation: typcollation.map(|v| v.into()),
2565 typdefaultbin: typdefaultbin.map(|v| v.into()),
2566 typdefault: typdefault.map(|v| v.into()),
2567 typacl: typacl.map(|v| v.map(|v| v.into()).collect()),
2568 description: description.map(|v| v.into()),
2569 seclabel: seclabel.map(|v| v.into()),
2570 seclabel_provider: seclabel_provider.map(|v| v.into()),
2571 initprivs: initprivs.map(|v| v.map(|v| v.into()).collect()),
2572 initprivs_type,
2573 }
2574 }
2575}
2576#[derive(Debug, Clone, PartialEq)]
2577pub struct ReflectPgUserMappings {
2578 pub srvname: String,
2579 pub umuser: Option<String>,
2580 pub usename: String,
2581 pub umoptions: Option<Vec<String>>,
2582}
2583pub struct ReflectPgUserMappingsBorrowed<'a> {
2584 pub srvname: &'a str,
2585 pub umuser: Option<&'a str>,
2586 pub usename: &'a str,
2587 pub umoptions: Option<crate::ArrayIterator<'a, &'a str>>,
2588}
2589impl<'a> From<ReflectPgUserMappingsBorrowed<'a>> for ReflectPgUserMappings {
2590 fn from(
2591 ReflectPgUserMappingsBorrowed {
2592 srvname,
2593 umuser,
2594 usename,
2595 umoptions,
2596 }: ReflectPgUserMappingsBorrowed<'a>,
2597 ) -> Self {
2598 Self {
2599 srvname: srvname.into(),
2600 umuser: umuser.map(|v| v.into()),
2601 usename: usename.into(),
2602 umoptions: umoptions.map(|v| v.map(|v| v.into()).collect()),
2603 }
2604 }
2605}
2606use crate::client::async_::GenericClient;
2607use futures::{self, StreamExt, TryStreamExt};
2608pub struct ReflectPgAggregateQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
2609 client: &'c C,
2610 params: [&'a (dyn postgres_types::ToSql + Sync); N],
2611 query: &'static str,
2612 cached: Option<&'s tokio_postgres::Statement>,
2613 extractor:
2614 fn(&tokio_postgres::Row) -> Result<ReflectPgAggregateBorrowed, tokio_postgres::Error>,
2615 mapper: fn(ReflectPgAggregateBorrowed) -> T,
2616}
2617impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgAggregateQuery<'c, 'a, 's, C, T, N>
2618where
2619 C: GenericClient,
2620{
2621 pub fn map<R>(
2622 self,
2623 mapper: fn(ReflectPgAggregateBorrowed) -> R,
2624 ) -> ReflectPgAggregateQuery<'c, 'a, 's, C, R, N> {
2625 ReflectPgAggregateQuery {
2626 client: self.client,
2627 params: self.params,
2628 query: self.query,
2629 cached: self.cached,
2630 extractor: self.extractor,
2631 mapper,
2632 }
2633 }
2634 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
2635 let row =
2636 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
2637 Ok((self.mapper)((self.extractor)(&row)?))
2638 }
2639 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
2640 self.iter().await?.try_collect().await
2641 }
2642 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
2643 let opt_row =
2644 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
2645 Ok(opt_row
2646 .map(|row| {
2647 let extracted = (self.extractor)(&row)?;
2648 Ok((self.mapper)(extracted))
2649 })
2650 .transpose()?)
2651 }
2652 pub async fn iter(
2653 self,
2654 ) -> Result<
2655 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
2656 tokio_postgres::Error,
2657 > {
2658 let stream = crate::client::async_::raw(
2659 self.client,
2660 self.query,
2661 crate::slice_iter(&self.params),
2662 self.cached,
2663 )
2664 .await?;
2665 let mapped = stream
2666 .map(move |res| {
2667 res.and_then(|row| {
2668 let extracted = (self.extractor)(&row)?;
2669 Ok((self.mapper)(extracted))
2670 })
2671 })
2672 .into_stream();
2673 Ok(mapped)
2674 }
2675}
2676pub struct ReflectPgAmQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
2677 client: &'c C,
2678 params: [&'a (dyn postgres_types::ToSql + Sync); N],
2679 query: &'static str,
2680 cached: Option<&'s tokio_postgres::Statement>,
2681 extractor: fn(&tokio_postgres::Row) -> Result<ReflectPgAmBorrowed, tokio_postgres::Error>,
2682 mapper: fn(ReflectPgAmBorrowed) -> T,
2683}
2684impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgAmQuery<'c, 'a, 's, C, T, N>
2685where
2686 C: GenericClient,
2687{
2688 pub fn map<R>(
2689 self,
2690 mapper: fn(ReflectPgAmBorrowed) -> R,
2691 ) -> ReflectPgAmQuery<'c, 'a, 's, C, R, N> {
2692 ReflectPgAmQuery {
2693 client: self.client,
2694 params: self.params,
2695 query: self.query,
2696 cached: self.cached,
2697 extractor: self.extractor,
2698 mapper,
2699 }
2700 }
2701 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
2702 let row =
2703 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
2704 Ok((self.mapper)((self.extractor)(&row)?))
2705 }
2706 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
2707 self.iter().await?.try_collect().await
2708 }
2709 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
2710 let opt_row =
2711 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
2712 Ok(opt_row
2713 .map(|row| {
2714 let extracted = (self.extractor)(&row)?;
2715 Ok((self.mapper)(extracted))
2716 })
2717 .transpose()?)
2718 }
2719 pub async fn iter(
2720 self,
2721 ) -> Result<
2722 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
2723 tokio_postgres::Error,
2724 > {
2725 let stream = crate::client::async_::raw(
2726 self.client,
2727 self.query,
2728 crate::slice_iter(&self.params),
2729 self.cached,
2730 )
2731 .await?;
2732 let mapped = stream
2733 .map(move |res| {
2734 res.and_then(|row| {
2735 let extracted = (self.extractor)(&row)?;
2736 Ok((self.mapper)(extracted))
2737 })
2738 })
2739 .into_stream();
2740 Ok(mapped)
2741 }
2742}
2743pub struct ReflectPgAmopQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
2744 client: &'c C,
2745 params: [&'a (dyn postgres_types::ToSql + Sync); N],
2746 query: &'static str,
2747 cached: Option<&'s tokio_postgres::Statement>,
2748 extractor: fn(&tokio_postgres::Row) -> Result<ReflectPgAmopBorrowed, tokio_postgres::Error>,
2749 mapper: fn(ReflectPgAmopBorrowed) -> T,
2750}
2751impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgAmopQuery<'c, 'a, 's, C, T, N>
2752where
2753 C: GenericClient,
2754{
2755 pub fn map<R>(
2756 self,
2757 mapper: fn(ReflectPgAmopBorrowed) -> R,
2758 ) -> ReflectPgAmopQuery<'c, 'a, 's, C, R, N> {
2759 ReflectPgAmopQuery {
2760 client: self.client,
2761 params: self.params,
2762 query: self.query,
2763 cached: self.cached,
2764 extractor: self.extractor,
2765 mapper,
2766 }
2767 }
2768 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
2769 let row =
2770 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
2771 Ok((self.mapper)((self.extractor)(&row)?))
2772 }
2773 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
2774 self.iter().await?.try_collect().await
2775 }
2776 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
2777 let opt_row =
2778 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
2779 Ok(opt_row
2780 .map(|row| {
2781 let extracted = (self.extractor)(&row)?;
2782 Ok((self.mapper)(extracted))
2783 })
2784 .transpose()?)
2785 }
2786 pub async fn iter(
2787 self,
2788 ) -> Result<
2789 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
2790 tokio_postgres::Error,
2791 > {
2792 let stream = crate::client::async_::raw(
2793 self.client,
2794 self.query,
2795 crate::slice_iter(&self.params),
2796 self.cached,
2797 )
2798 .await?;
2799 let mapped = stream
2800 .map(move |res| {
2801 res.and_then(|row| {
2802 let extracted = (self.extractor)(&row)?;
2803 Ok((self.mapper)(extracted))
2804 })
2805 })
2806 .into_stream();
2807 Ok(mapped)
2808 }
2809}
2810pub struct ReflectPgAmprocQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
2811 client: &'c C,
2812 params: [&'a (dyn postgres_types::ToSql + Sync); N],
2813 query: &'static str,
2814 cached: Option<&'s tokio_postgres::Statement>,
2815 extractor: fn(&tokio_postgres::Row) -> Result<ReflectPgAmprocBorrowed, tokio_postgres::Error>,
2816 mapper: fn(ReflectPgAmprocBorrowed) -> T,
2817}
2818impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgAmprocQuery<'c, 'a, 's, C, T, N>
2819where
2820 C: GenericClient,
2821{
2822 pub fn map<R>(
2823 self,
2824 mapper: fn(ReflectPgAmprocBorrowed) -> R,
2825 ) -> ReflectPgAmprocQuery<'c, 'a, 's, C, R, N> {
2826 ReflectPgAmprocQuery {
2827 client: self.client,
2828 params: self.params,
2829 query: self.query,
2830 cached: self.cached,
2831 extractor: self.extractor,
2832 mapper,
2833 }
2834 }
2835 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
2836 let row =
2837 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
2838 Ok((self.mapper)((self.extractor)(&row)?))
2839 }
2840 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
2841 self.iter().await?.try_collect().await
2842 }
2843 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
2844 let opt_row =
2845 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
2846 Ok(opt_row
2847 .map(|row| {
2848 let extracted = (self.extractor)(&row)?;
2849 Ok((self.mapper)(extracted))
2850 })
2851 .transpose()?)
2852 }
2853 pub async fn iter(
2854 self,
2855 ) -> Result<
2856 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
2857 tokio_postgres::Error,
2858 > {
2859 let stream = crate::client::async_::raw(
2860 self.client,
2861 self.query,
2862 crate::slice_iter(&self.params),
2863 self.cached,
2864 )
2865 .await?;
2866 let mapped = stream
2867 .map(move |res| {
2868 res.and_then(|row| {
2869 let extracted = (self.extractor)(&row)?;
2870 Ok((self.mapper)(extracted))
2871 })
2872 })
2873 .into_stream();
2874 Ok(mapped)
2875 }
2876}
2877pub struct ReflectPgAttrdefQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
2878 client: &'c C,
2879 params: [&'a (dyn postgres_types::ToSql + Sync); N],
2880 query: &'static str,
2881 cached: Option<&'s tokio_postgres::Statement>,
2882 extractor: fn(&tokio_postgres::Row) -> Result<ReflectPgAttrdefBorrowed, tokio_postgres::Error>,
2883 mapper: fn(ReflectPgAttrdefBorrowed) -> T,
2884}
2885impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgAttrdefQuery<'c, 'a, 's, C, T, N>
2886where
2887 C: GenericClient,
2888{
2889 pub fn map<R>(
2890 self,
2891 mapper: fn(ReflectPgAttrdefBorrowed) -> R,
2892 ) -> ReflectPgAttrdefQuery<'c, 'a, 's, C, R, N> {
2893 ReflectPgAttrdefQuery {
2894 client: self.client,
2895 params: self.params,
2896 query: self.query,
2897 cached: self.cached,
2898 extractor: self.extractor,
2899 mapper,
2900 }
2901 }
2902 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
2903 let row =
2904 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
2905 Ok((self.mapper)((self.extractor)(&row)?))
2906 }
2907 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
2908 self.iter().await?.try_collect().await
2909 }
2910 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
2911 let opt_row =
2912 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
2913 Ok(opt_row
2914 .map(|row| {
2915 let extracted = (self.extractor)(&row)?;
2916 Ok((self.mapper)(extracted))
2917 })
2918 .transpose()?)
2919 }
2920 pub async fn iter(
2921 self,
2922 ) -> Result<
2923 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
2924 tokio_postgres::Error,
2925 > {
2926 let stream = crate::client::async_::raw(
2927 self.client,
2928 self.query,
2929 crate::slice_iter(&self.params),
2930 self.cached,
2931 )
2932 .await?;
2933 let mapped = stream
2934 .map(move |res| {
2935 res.and_then(|row| {
2936 let extracted = (self.extractor)(&row)?;
2937 Ok((self.mapper)(extracted))
2938 })
2939 })
2940 .into_stream();
2941 Ok(mapped)
2942 }
2943}
2944pub struct ReflectPgAttributeQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
2945 client: &'c C,
2946 params: [&'a (dyn postgres_types::ToSql + Sync); N],
2947 query: &'static str,
2948 cached: Option<&'s tokio_postgres::Statement>,
2949 extractor:
2950 fn(&tokio_postgres::Row) -> Result<ReflectPgAttributeBorrowed, tokio_postgres::Error>,
2951 mapper: fn(ReflectPgAttributeBorrowed) -> T,
2952}
2953impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgAttributeQuery<'c, 'a, 's, C, T, N>
2954where
2955 C: GenericClient,
2956{
2957 pub fn map<R>(
2958 self,
2959 mapper: fn(ReflectPgAttributeBorrowed) -> R,
2960 ) -> ReflectPgAttributeQuery<'c, 'a, 's, C, R, N> {
2961 ReflectPgAttributeQuery {
2962 client: self.client,
2963 params: self.params,
2964 query: self.query,
2965 cached: self.cached,
2966 extractor: self.extractor,
2967 mapper,
2968 }
2969 }
2970 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
2971 let row =
2972 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
2973 Ok((self.mapper)((self.extractor)(&row)?))
2974 }
2975 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
2976 self.iter().await?.try_collect().await
2977 }
2978 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
2979 let opt_row =
2980 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
2981 Ok(opt_row
2982 .map(|row| {
2983 let extracted = (self.extractor)(&row)?;
2984 Ok((self.mapper)(extracted))
2985 })
2986 .transpose()?)
2987 }
2988 pub async fn iter(
2989 self,
2990 ) -> Result<
2991 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
2992 tokio_postgres::Error,
2993 > {
2994 let stream = crate::client::async_::raw(
2995 self.client,
2996 self.query,
2997 crate::slice_iter(&self.params),
2998 self.cached,
2999 )
3000 .await?;
3001 let mapped = stream
3002 .map(move |res| {
3003 res.and_then(|row| {
3004 let extracted = (self.extractor)(&row)?;
3005 Ok((self.mapper)(extracted))
3006 })
3007 })
3008 .into_stream();
3009 Ok(mapped)
3010 }
3011}
3012pub struct ReflectPgRolesQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
3013 client: &'c C,
3014 params: [&'a (dyn postgres_types::ToSql + Sync); N],
3015 query: &'static str,
3016 cached: Option<&'s tokio_postgres::Statement>,
3017 extractor: fn(&tokio_postgres::Row) -> Result<ReflectPgRolesBorrowed, tokio_postgres::Error>,
3018 mapper: fn(ReflectPgRolesBorrowed) -> T,
3019}
3020impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgRolesQuery<'c, 'a, 's, C, T, N>
3021where
3022 C: GenericClient,
3023{
3024 pub fn map<R>(
3025 self,
3026 mapper: fn(ReflectPgRolesBorrowed) -> R,
3027 ) -> ReflectPgRolesQuery<'c, 'a, 's, C, R, N> {
3028 ReflectPgRolesQuery {
3029 client: self.client,
3030 params: self.params,
3031 query: self.query,
3032 cached: self.cached,
3033 extractor: self.extractor,
3034 mapper,
3035 }
3036 }
3037 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
3038 let row =
3039 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
3040 Ok((self.mapper)((self.extractor)(&row)?))
3041 }
3042 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
3043 self.iter().await?.try_collect().await
3044 }
3045 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
3046 let opt_row =
3047 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
3048 Ok(opt_row
3049 .map(|row| {
3050 let extracted = (self.extractor)(&row)?;
3051 Ok((self.mapper)(extracted))
3052 })
3053 .transpose()?)
3054 }
3055 pub async fn iter(
3056 self,
3057 ) -> Result<
3058 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
3059 tokio_postgres::Error,
3060 > {
3061 let stream = crate::client::async_::raw(
3062 self.client,
3063 self.query,
3064 crate::slice_iter(&self.params),
3065 self.cached,
3066 )
3067 .await?;
3068 let mapped = stream
3069 .map(move |res| {
3070 res.and_then(|row| {
3071 let extracted = (self.extractor)(&row)?;
3072 Ok((self.mapper)(extracted))
3073 })
3074 })
3075 .into_stream();
3076 Ok(mapped)
3077 }
3078}
3079pub struct ReflectPgAuthMembersQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
3080 client: &'c C,
3081 params: [&'a (dyn postgres_types::ToSql + Sync); N],
3082 query: &'static str,
3083 cached: Option<&'s tokio_postgres::Statement>,
3084 extractor:
3085 fn(&tokio_postgres::Row) -> Result<ReflectPgAuthMembersBorrowed, tokio_postgres::Error>,
3086 mapper: fn(ReflectPgAuthMembersBorrowed) -> T,
3087}
3088impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgAuthMembersQuery<'c, 'a, 's, C, T, N>
3089where
3090 C: GenericClient,
3091{
3092 pub fn map<R>(
3093 self,
3094 mapper: fn(ReflectPgAuthMembersBorrowed) -> R,
3095 ) -> ReflectPgAuthMembersQuery<'c, 'a, 's, C, R, N> {
3096 ReflectPgAuthMembersQuery {
3097 client: self.client,
3098 params: self.params,
3099 query: self.query,
3100 cached: self.cached,
3101 extractor: self.extractor,
3102 mapper,
3103 }
3104 }
3105 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
3106 let row =
3107 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
3108 Ok((self.mapper)((self.extractor)(&row)?))
3109 }
3110 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
3111 self.iter().await?.try_collect().await
3112 }
3113 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
3114 let opt_row =
3115 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
3116 Ok(opt_row
3117 .map(|row| {
3118 let extracted = (self.extractor)(&row)?;
3119 Ok((self.mapper)(extracted))
3120 })
3121 .transpose()?)
3122 }
3123 pub async fn iter(
3124 self,
3125 ) -> Result<
3126 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
3127 tokio_postgres::Error,
3128 > {
3129 let stream = crate::client::async_::raw(
3130 self.client,
3131 self.query,
3132 crate::slice_iter(&self.params),
3133 self.cached,
3134 )
3135 .await?;
3136 let mapped = stream
3137 .map(move |res| {
3138 res.and_then(|row| {
3139 let extracted = (self.extractor)(&row)?;
3140 Ok((self.mapper)(extracted))
3141 })
3142 })
3143 .into_stream();
3144 Ok(mapped)
3145 }
3146}
3147pub struct ReflectPgCastQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
3148 client: &'c C,
3149 params: [&'a (dyn postgres_types::ToSql + Sync); N],
3150 query: &'static str,
3151 cached: Option<&'s tokio_postgres::Statement>,
3152 extractor: fn(&tokio_postgres::Row) -> Result<ReflectPgCastBorrowed, tokio_postgres::Error>,
3153 mapper: fn(ReflectPgCastBorrowed) -> T,
3154}
3155impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgCastQuery<'c, 'a, 's, C, T, N>
3156where
3157 C: GenericClient,
3158{
3159 pub fn map<R>(
3160 self,
3161 mapper: fn(ReflectPgCastBorrowed) -> R,
3162 ) -> ReflectPgCastQuery<'c, 'a, 's, C, R, N> {
3163 ReflectPgCastQuery {
3164 client: self.client,
3165 params: self.params,
3166 query: self.query,
3167 cached: self.cached,
3168 extractor: self.extractor,
3169 mapper,
3170 }
3171 }
3172 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
3173 let row =
3174 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
3175 Ok((self.mapper)((self.extractor)(&row)?))
3176 }
3177 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
3178 self.iter().await?.try_collect().await
3179 }
3180 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
3181 let opt_row =
3182 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
3183 Ok(opt_row
3184 .map(|row| {
3185 let extracted = (self.extractor)(&row)?;
3186 Ok((self.mapper)(extracted))
3187 })
3188 .transpose()?)
3189 }
3190 pub async fn iter(
3191 self,
3192 ) -> Result<
3193 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
3194 tokio_postgres::Error,
3195 > {
3196 let stream = crate::client::async_::raw(
3197 self.client,
3198 self.query,
3199 crate::slice_iter(&self.params),
3200 self.cached,
3201 )
3202 .await?;
3203 let mapped = stream
3204 .map(move |res| {
3205 res.and_then(|row| {
3206 let extracted = (self.extractor)(&row)?;
3207 Ok((self.mapper)(extracted))
3208 })
3209 })
3210 .into_stream();
3211 Ok(mapped)
3212 }
3213}
3214pub struct ReflectPgClassQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
3215 client: &'c C,
3216 params: [&'a (dyn postgres_types::ToSql + Sync); N],
3217 query: &'static str,
3218 cached: Option<&'s tokio_postgres::Statement>,
3219 extractor: fn(&tokio_postgres::Row) -> Result<ReflectPgClassBorrowed, tokio_postgres::Error>,
3220 mapper: fn(ReflectPgClassBorrowed) -> T,
3221}
3222impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgClassQuery<'c, 'a, 's, C, T, N>
3223where
3224 C: GenericClient,
3225{
3226 pub fn map<R>(
3227 self,
3228 mapper: fn(ReflectPgClassBorrowed) -> R,
3229 ) -> ReflectPgClassQuery<'c, 'a, 's, C, R, N> {
3230 ReflectPgClassQuery {
3231 client: self.client,
3232 params: self.params,
3233 query: self.query,
3234 cached: self.cached,
3235 extractor: self.extractor,
3236 mapper,
3237 }
3238 }
3239 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
3240 let row =
3241 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
3242 Ok((self.mapper)((self.extractor)(&row)?))
3243 }
3244 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
3245 self.iter().await?.try_collect().await
3246 }
3247 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
3248 let opt_row =
3249 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
3250 Ok(opt_row
3251 .map(|row| {
3252 let extracted = (self.extractor)(&row)?;
3253 Ok((self.mapper)(extracted))
3254 })
3255 .transpose()?)
3256 }
3257 pub async fn iter(
3258 self,
3259 ) -> Result<
3260 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
3261 tokio_postgres::Error,
3262 > {
3263 let stream = crate::client::async_::raw(
3264 self.client,
3265 self.query,
3266 crate::slice_iter(&self.params),
3267 self.cached,
3268 )
3269 .await?;
3270 let mapped = stream
3271 .map(move |res| {
3272 res.and_then(|row| {
3273 let extracted = (self.extractor)(&row)?;
3274 Ok((self.mapper)(extracted))
3275 })
3276 })
3277 .into_stream();
3278 Ok(mapped)
3279 }
3280}
3281pub struct ReflectPgCollationQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
3282 client: &'c C,
3283 params: [&'a (dyn postgres_types::ToSql + Sync); N],
3284 query: &'static str,
3285 cached: Option<&'s tokio_postgres::Statement>,
3286 extractor:
3287 fn(&tokio_postgres::Row) -> Result<ReflectPgCollationBorrowed, tokio_postgres::Error>,
3288 mapper: fn(ReflectPgCollationBorrowed) -> T,
3289}
3290impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgCollationQuery<'c, 'a, 's, C, T, N>
3291where
3292 C: GenericClient,
3293{
3294 pub fn map<R>(
3295 self,
3296 mapper: fn(ReflectPgCollationBorrowed) -> R,
3297 ) -> ReflectPgCollationQuery<'c, 'a, 's, C, R, N> {
3298 ReflectPgCollationQuery {
3299 client: self.client,
3300 params: self.params,
3301 query: self.query,
3302 cached: self.cached,
3303 extractor: self.extractor,
3304 mapper,
3305 }
3306 }
3307 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
3308 let row =
3309 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
3310 Ok((self.mapper)((self.extractor)(&row)?))
3311 }
3312 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
3313 self.iter().await?.try_collect().await
3314 }
3315 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
3316 let opt_row =
3317 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
3318 Ok(opt_row
3319 .map(|row| {
3320 let extracted = (self.extractor)(&row)?;
3321 Ok((self.mapper)(extracted))
3322 })
3323 .transpose()?)
3324 }
3325 pub async fn iter(
3326 self,
3327 ) -> Result<
3328 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
3329 tokio_postgres::Error,
3330 > {
3331 let stream = crate::client::async_::raw(
3332 self.client,
3333 self.query,
3334 crate::slice_iter(&self.params),
3335 self.cached,
3336 )
3337 .await?;
3338 let mapped = stream
3339 .map(move |res| {
3340 res.and_then(|row| {
3341 let extracted = (self.extractor)(&row)?;
3342 Ok((self.mapper)(extracted))
3343 })
3344 })
3345 .into_stream();
3346 Ok(mapped)
3347 }
3348}
3349pub struct ReflectPgConstraintQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
3350 client: &'c C,
3351 params: [&'a (dyn postgres_types::ToSql + Sync); N],
3352 query: &'static str,
3353 cached: Option<&'s tokio_postgres::Statement>,
3354 extractor:
3355 fn(&tokio_postgres::Row) -> Result<ReflectPgConstraintBorrowed, tokio_postgres::Error>,
3356 mapper: fn(ReflectPgConstraintBorrowed) -> T,
3357}
3358impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgConstraintQuery<'c, 'a, 's, C, T, N>
3359where
3360 C: GenericClient,
3361{
3362 pub fn map<R>(
3363 self,
3364 mapper: fn(ReflectPgConstraintBorrowed) -> R,
3365 ) -> ReflectPgConstraintQuery<'c, 'a, 's, C, R, N> {
3366 ReflectPgConstraintQuery {
3367 client: self.client,
3368 params: self.params,
3369 query: self.query,
3370 cached: self.cached,
3371 extractor: self.extractor,
3372 mapper,
3373 }
3374 }
3375 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
3376 let row =
3377 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
3378 Ok((self.mapper)((self.extractor)(&row)?))
3379 }
3380 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
3381 self.iter().await?.try_collect().await
3382 }
3383 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
3384 let opt_row =
3385 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
3386 Ok(opt_row
3387 .map(|row| {
3388 let extracted = (self.extractor)(&row)?;
3389 Ok((self.mapper)(extracted))
3390 })
3391 .transpose()?)
3392 }
3393 pub async fn iter(
3394 self,
3395 ) -> Result<
3396 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
3397 tokio_postgres::Error,
3398 > {
3399 let stream = crate::client::async_::raw(
3400 self.client,
3401 self.query,
3402 crate::slice_iter(&self.params),
3403 self.cached,
3404 )
3405 .await?;
3406 let mapped = stream
3407 .map(move |res| {
3408 res.and_then(|row| {
3409 let extracted = (self.extractor)(&row)?;
3410 Ok((self.mapper)(extracted))
3411 })
3412 })
3413 .into_stream();
3414 Ok(mapped)
3415 }
3416}
3417pub struct ReflectPgConversionQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
3418 client: &'c C,
3419 params: [&'a (dyn postgres_types::ToSql + Sync); N],
3420 query: &'static str,
3421 cached: Option<&'s tokio_postgres::Statement>,
3422 extractor:
3423 fn(&tokio_postgres::Row) -> Result<ReflectPgConversionBorrowed, tokio_postgres::Error>,
3424 mapper: fn(ReflectPgConversionBorrowed) -> T,
3425}
3426impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgConversionQuery<'c, 'a, 's, C, T, N>
3427where
3428 C: GenericClient,
3429{
3430 pub fn map<R>(
3431 self,
3432 mapper: fn(ReflectPgConversionBorrowed) -> R,
3433 ) -> ReflectPgConversionQuery<'c, 'a, 's, C, R, N> {
3434 ReflectPgConversionQuery {
3435 client: self.client,
3436 params: self.params,
3437 query: self.query,
3438 cached: self.cached,
3439 extractor: self.extractor,
3440 mapper,
3441 }
3442 }
3443 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
3444 let row =
3445 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
3446 Ok((self.mapper)((self.extractor)(&row)?))
3447 }
3448 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
3449 self.iter().await?.try_collect().await
3450 }
3451 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
3452 let opt_row =
3453 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
3454 Ok(opt_row
3455 .map(|row| {
3456 let extracted = (self.extractor)(&row)?;
3457 Ok((self.mapper)(extracted))
3458 })
3459 .transpose()?)
3460 }
3461 pub async fn iter(
3462 self,
3463 ) -> Result<
3464 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
3465 tokio_postgres::Error,
3466 > {
3467 let stream = crate::client::async_::raw(
3468 self.client,
3469 self.query,
3470 crate::slice_iter(&self.params),
3471 self.cached,
3472 )
3473 .await?;
3474 let mapped = stream
3475 .map(move |res| {
3476 res.and_then(|row| {
3477 let extracted = (self.extractor)(&row)?;
3478 Ok((self.mapper)(extracted))
3479 })
3480 })
3481 .into_stream();
3482 Ok(mapped)
3483 }
3484}
3485pub struct ReflectPgDatabaseQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
3486 client: &'c C,
3487 params: [&'a (dyn postgres_types::ToSql + Sync); N],
3488 query: &'static str,
3489 cached: Option<&'s tokio_postgres::Statement>,
3490 extractor: fn(&tokio_postgres::Row) -> Result<ReflectPgDatabaseBorrowed, tokio_postgres::Error>,
3491 mapper: fn(ReflectPgDatabaseBorrowed) -> T,
3492}
3493impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgDatabaseQuery<'c, 'a, 's, C, T, N>
3494where
3495 C: GenericClient,
3496{
3497 pub fn map<R>(
3498 self,
3499 mapper: fn(ReflectPgDatabaseBorrowed) -> R,
3500 ) -> ReflectPgDatabaseQuery<'c, 'a, 's, C, R, N> {
3501 ReflectPgDatabaseQuery {
3502 client: self.client,
3503 params: self.params,
3504 query: self.query,
3505 cached: self.cached,
3506 extractor: self.extractor,
3507 mapper,
3508 }
3509 }
3510 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
3511 let row =
3512 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
3513 Ok((self.mapper)((self.extractor)(&row)?))
3514 }
3515 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
3516 self.iter().await?.try_collect().await
3517 }
3518 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
3519 let opt_row =
3520 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
3521 Ok(opt_row
3522 .map(|row| {
3523 let extracted = (self.extractor)(&row)?;
3524 Ok((self.mapper)(extracted))
3525 })
3526 .transpose()?)
3527 }
3528 pub async fn iter(
3529 self,
3530 ) -> Result<
3531 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
3532 tokio_postgres::Error,
3533 > {
3534 let stream = crate::client::async_::raw(
3535 self.client,
3536 self.query,
3537 crate::slice_iter(&self.params),
3538 self.cached,
3539 )
3540 .await?;
3541 let mapped = stream
3542 .map(move |res| {
3543 res.and_then(|row| {
3544 let extracted = (self.extractor)(&row)?;
3545 Ok((self.mapper)(extracted))
3546 })
3547 })
3548 .into_stream();
3549 Ok(mapped)
3550 }
3551}
3552pub struct ReflectPgDefaultAclQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
3553 client: &'c C,
3554 params: [&'a (dyn postgres_types::ToSql + Sync); N],
3555 query: &'static str,
3556 cached: Option<&'s tokio_postgres::Statement>,
3557 extractor:
3558 fn(&tokio_postgres::Row) -> Result<ReflectPgDefaultAclBorrowed, tokio_postgres::Error>,
3559 mapper: fn(ReflectPgDefaultAclBorrowed) -> T,
3560}
3561impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgDefaultAclQuery<'c, 'a, 's, C, T, N>
3562where
3563 C: GenericClient,
3564{
3565 pub fn map<R>(
3566 self,
3567 mapper: fn(ReflectPgDefaultAclBorrowed) -> R,
3568 ) -> ReflectPgDefaultAclQuery<'c, 'a, 's, C, R, N> {
3569 ReflectPgDefaultAclQuery {
3570 client: self.client,
3571 params: self.params,
3572 query: self.query,
3573 cached: self.cached,
3574 extractor: self.extractor,
3575 mapper,
3576 }
3577 }
3578 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
3579 let row =
3580 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
3581 Ok((self.mapper)((self.extractor)(&row)?))
3582 }
3583 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
3584 self.iter().await?.try_collect().await
3585 }
3586 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
3587 let opt_row =
3588 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
3589 Ok(opt_row
3590 .map(|row| {
3591 let extracted = (self.extractor)(&row)?;
3592 Ok((self.mapper)(extracted))
3593 })
3594 .transpose()?)
3595 }
3596 pub async fn iter(
3597 self,
3598 ) -> Result<
3599 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
3600 tokio_postgres::Error,
3601 > {
3602 let stream = crate::client::async_::raw(
3603 self.client,
3604 self.query,
3605 crate::slice_iter(&self.params),
3606 self.cached,
3607 )
3608 .await?;
3609 let mapped = stream
3610 .map(move |res| {
3611 res.and_then(|row| {
3612 let extracted = (self.extractor)(&row)?;
3613 Ok((self.mapper)(extracted))
3614 })
3615 })
3616 .into_stream();
3617 Ok(mapped)
3618 }
3619}
3620pub struct ReflectPgEventTriggerQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
3621 client: &'c C,
3622 params: [&'a (dyn postgres_types::ToSql + Sync); N],
3623 query: &'static str,
3624 cached: Option<&'s tokio_postgres::Statement>,
3625 extractor:
3626 fn(&tokio_postgres::Row) -> Result<ReflectPgEventTriggerBorrowed, tokio_postgres::Error>,
3627 mapper: fn(ReflectPgEventTriggerBorrowed) -> T,
3628}
3629impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgEventTriggerQuery<'c, 'a, 's, C, T, N>
3630where
3631 C: GenericClient,
3632{
3633 pub fn map<R>(
3634 self,
3635 mapper: fn(ReflectPgEventTriggerBorrowed) -> R,
3636 ) -> ReflectPgEventTriggerQuery<'c, 'a, 's, C, R, N> {
3637 ReflectPgEventTriggerQuery {
3638 client: self.client,
3639 params: self.params,
3640 query: self.query,
3641 cached: self.cached,
3642 extractor: self.extractor,
3643 mapper,
3644 }
3645 }
3646 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
3647 let row =
3648 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
3649 Ok((self.mapper)((self.extractor)(&row)?))
3650 }
3651 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
3652 self.iter().await?.try_collect().await
3653 }
3654 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
3655 let opt_row =
3656 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
3657 Ok(opt_row
3658 .map(|row| {
3659 let extracted = (self.extractor)(&row)?;
3660 Ok((self.mapper)(extracted))
3661 })
3662 .transpose()?)
3663 }
3664 pub async fn iter(
3665 self,
3666 ) -> Result<
3667 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
3668 tokio_postgres::Error,
3669 > {
3670 let stream = crate::client::async_::raw(
3671 self.client,
3672 self.query,
3673 crate::slice_iter(&self.params),
3674 self.cached,
3675 )
3676 .await?;
3677 let mapped = stream
3678 .map(move |res| {
3679 res.and_then(|row| {
3680 let extracted = (self.extractor)(&row)?;
3681 Ok((self.mapper)(extracted))
3682 })
3683 })
3684 .into_stream();
3685 Ok(mapped)
3686 }
3687}
3688pub struct ReflectPgExtensionQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
3689 client: &'c C,
3690 params: [&'a (dyn postgres_types::ToSql + Sync); N],
3691 query: &'static str,
3692 cached: Option<&'s tokio_postgres::Statement>,
3693 extractor:
3694 fn(&tokio_postgres::Row) -> Result<ReflectPgExtensionBorrowed, tokio_postgres::Error>,
3695 mapper: fn(ReflectPgExtensionBorrowed) -> T,
3696}
3697impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgExtensionQuery<'c, 'a, 's, C, T, N>
3698where
3699 C: GenericClient,
3700{
3701 pub fn map<R>(
3702 self,
3703 mapper: fn(ReflectPgExtensionBorrowed) -> R,
3704 ) -> ReflectPgExtensionQuery<'c, 'a, 's, C, R, N> {
3705 ReflectPgExtensionQuery {
3706 client: self.client,
3707 params: self.params,
3708 query: self.query,
3709 cached: self.cached,
3710 extractor: self.extractor,
3711 mapper,
3712 }
3713 }
3714 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
3715 let row =
3716 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
3717 Ok((self.mapper)((self.extractor)(&row)?))
3718 }
3719 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
3720 self.iter().await?.try_collect().await
3721 }
3722 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
3723 let opt_row =
3724 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
3725 Ok(opt_row
3726 .map(|row| {
3727 let extracted = (self.extractor)(&row)?;
3728 Ok((self.mapper)(extracted))
3729 })
3730 .transpose()?)
3731 }
3732 pub async fn iter(
3733 self,
3734 ) -> Result<
3735 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
3736 tokio_postgres::Error,
3737 > {
3738 let stream = crate::client::async_::raw(
3739 self.client,
3740 self.query,
3741 crate::slice_iter(&self.params),
3742 self.cached,
3743 )
3744 .await?;
3745 let mapped = stream
3746 .map(move |res| {
3747 res.and_then(|row| {
3748 let extracted = (self.extractor)(&row)?;
3749 Ok((self.mapper)(extracted))
3750 })
3751 })
3752 .into_stream();
3753 Ok(mapped)
3754 }
3755}
3756pub struct ReflectPgForeignDataWrapperQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
3757 client: &'c C,
3758 params: [&'a (dyn postgres_types::ToSql + Sync); N],
3759 query: &'static str,
3760 cached: Option<&'s tokio_postgres::Statement>,
3761 extractor: fn(
3762 &tokio_postgres::Row,
3763 ) -> Result<ReflectPgForeignDataWrapperBorrowed, tokio_postgres::Error>,
3764 mapper: fn(ReflectPgForeignDataWrapperBorrowed) -> T,
3765}
3766impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgForeignDataWrapperQuery<'c, 'a, 's, C, T, N>
3767where
3768 C: GenericClient,
3769{
3770 pub fn map<R>(
3771 self,
3772 mapper: fn(ReflectPgForeignDataWrapperBorrowed) -> R,
3773 ) -> ReflectPgForeignDataWrapperQuery<'c, 'a, 's, C, R, N> {
3774 ReflectPgForeignDataWrapperQuery {
3775 client: self.client,
3776 params: self.params,
3777 query: self.query,
3778 cached: self.cached,
3779 extractor: self.extractor,
3780 mapper,
3781 }
3782 }
3783 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
3784 let row =
3785 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
3786 Ok((self.mapper)((self.extractor)(&row)?))
3787 }
3788 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
3789 self.iter().await?.try_collect().await
3790 }
3791 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
3792 let opt_row =
3793 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
3794 Ok(opt_row
3795 .map(|row| {
3796 let extracted = (self.extractor)(&row)?;
3797 Ok((self.mapper)(extracted))
3798 })
3799 .transpose()?)
3800 }
3801 pub async fn iter(
3802 self,
3803 ) -> Result<
3804 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
3805 tokio_postgres::Error,
3806 > {
3807 let stream = crate::client::async_::raw(
3808 self.client,
3809 self.query,
3810 crate::slice_iter(&self.params),
3811 self.cached,
3812 )
3813 .await?;
3814 let mapped = stream
3815 .map(move |res| {
3816 res.and_then(|row| {
3817 let extracted = (self.extractor)(&row)?;
3818 Ok((self.mapper)(extracted))
3819 })
3820 })
3821 .into_stream();
3822 Ok(mapped)
3823 }
3824}
3825pub struct ReflectPgForeignServerQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
3826 client: &'c C,
3827 params: [&'a (dyn postgres_types::ToSql + Sync); N],
3828 query: &'static str,
3829 cached: Option<&'s tokio_postgres::Statement>,
3830 extractor:
3831 fn(&tokio_postgres::Row) -> Result<ReflectPgForeignServerBorrowed, tokio_postgres::Error>,
3832 mapper: fn(ReflectPgForeignServerBorrowed) -> T,
3833}
3834impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgForeignServerQuery<'c, 'a, 's, C, T, N>
3835where
3836 C: GenericClient,
3837{
3838 pub fn map<R>(
3839 self,
3840 mapper: fn(ReflectPgForeignServerBorrowed) -> R,
3841 ) -> ReflectPgForeignServerQuery<'c, 'a, 's, C, R, N> {
3842 ReflectPgForeignServerQuery {
3843 client: self.client,
3844 params: self.params,
3845 query: self.query,
3846 cached: self.cached,
3847 extractor: self.extractor,
3848 mapper,
3849 }
3850 }
3851 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
3852 let row =
3853 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
3854 Ok((self.mapper)((self.extractor)(&row)?))
3855 }
3856 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
3857 self.iter().await?.try_collect().await
3858 }
3859 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
3860 let opt_row =
3861 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
3862 Ok(opt_row
3863 .map(|row| {
3864 let extracted = (self.extractor)(&row)?;
3865 Ok((self.mapper)(extracted))
3866 })
3867 .transpose()?)
3868 }
3869 pub async fn iter(
3870 self,
3871 ) -> Result<
3872 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
3873 tokio_postgres::Error,
3874 > {
3875 let stream = crate::client::async_::raw(
3876 self.client,
3877 self.query,
3878 crate::slice_iter(&self.params),
3879 self.cached,
3880 )
3881 .await?;
3882 let mapped = stream
3883 .map(move |res| {
3884 res.and_then(|row| {
3885 let extracted = (self.extractor)(&row)?;
3886 Ok((self.mapper)(extracted))
3887 })
3888 })
3889 .into_stream();
3890 Ok(mapped)
3891 }
3892}
3893pub struct ReflectPgForeignTableQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
3894 client: &'c C,
3895 params: [&'a (dyn postgres_types::ToSql + Sync); N],
3896 query: &'static str,
3897 cached: Option<&'s tokio_postgres::Statement>,
3898 extractor:
3899 fn(&tokio_postgres::Row) -> Result<ReflectPgForeignTableBorrowed, tokio_postgres::Error>,
3900 mapper: fn(ReflectPgForeignTableBorrowed) -> T,
3901}
3902impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgForeignTableQuery<'c, 'a, 's, C, T, N>
3903where
3904 C: GenericClient,
3905{
3906 pub fn map<R>(
3907 self,
3908 mapper: fn(ReflectPgForeignTableBorrowed) -> R,
3909 ) -> ReflectPgForeignTableQuery<'c, 'a, 's, C, R, N> {
3910 ReflectPgForeignTableQuery {
3911 client: self.client,
3912 params: self.params,
3913 query: self.query,
3914 cached: self.cached,
3915 extractor: self.extractor,
3916 mapper,
3917 }
3918 }
3919 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
3920 let row =
3921 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
3922 Ok((self.mapper)((self.extractor)(&row)?))
3923 }
3924 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
3925 self.iter().await?.try_collect().await
3926 }
3927 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
3928 let opt_row =
3929 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
3930 Ok(opt_row
3931 .map(|row| {
3932 let extracted = (self.extractor)(&row)?;
3933 Ok((self.mapper)(extracted))
3934 })
3935 .transpose()?)
3936 }
3937 pub async fn iter(
3938 self,
3939 ) -> Result<
3940 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
3941 tokio_postgres::Error,
3942 > {
3943 let stream = crate::client::async_::raw(
3944 self.client,
3945 self.query,
3946 crate::slice_iter(&self.params),
3947 self.cached,
3948 )
3949 .await?;
3950 let mapped = stream
3951 .map(move |res| {
3952 res.and_then(|row| {
3953 let extracted = (self.extractor)(&row)?;
3954 Ok((self.mapper)(extracted))
3955 })
3956 })
3957 .into_stream();
3958 Ok(mapped)
3959 }
3960}
3961pub struct ReflectPgIndexQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
3962 client: &'c C,
3963 params: [&'a (dyn postgres_types::ToSql + Sync); N],
3964 query: &'static str,
3965 cached: Option<&'s tokio_postgres::Statement>,
3966 extractor: fn(&tokio_postgres::Row) -> Result<ReflectPgIndexBorrowed, tokio_postgres::Error>,
3967 mapper: fn(ReflectPgIndexBorrowed) -> T,
3968}
3969impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgIndexQuery<'c, 'a, 's, C, T, N>
3970where
3971 C: GenericClient,
3972{
3973 pub fn map<R>(
3974 self,
3975 mapper: fn(ReflectPgIndexBorrowed) -> R,
3976 ) -> ReflectPgIndexQuery<'c, 'a, 's, C, R, N> {
3977 ReflectPgIndexQuery {
3978 client: self.client,
3979 params: self.params,
3980 query: self.query,
3981 cached: self.cached,
3982 extractor: self.extractor,
3983 mapper,
3984 }
3985 }
3986 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
3987 let row =
3988 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
3989 Ok((self.mapper)((self.extractor)(&row)?))
3990 }
3991 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
3992 self.iter().await?.try_collect().await
3993 }
3994 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
3995 let opt_row =
3996 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
3997 Ok(opt_row
3998 .map(|row| {
3999 let extracted = (self.extractor)(&row)?;
4000 Ok((self.mapper)(extracted))
4001 })
4002 .transpose()?)
4003 }
4004 pub async fn iter(
4005 self,
4006 ) -> Result<
4007 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
4008 tokio_postgres::Error,
4009 > {
4010 let stream = crate::client::async_::raw(
4011 self.client,
4012 self.query,
4013 crate::slice_iter(&self.params),
4014 self.cached,
4015 )
4016 .await?;
4017 let mapped = stream
4018 .map(move |res| {
4019 res.and_then(|row| {
4020 let extracted = (self.extractor)(&row)?;
4021 Ok((self.mapper)(extracted))
4022 })
4023 })
4024 .into_stream();
4025 Ok(mapped)
4026 }
4027}
4028pub struct ReflectPgInheritsQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
4029 client: &'c C,
4030 params: [&'a (dyn postgres_types::ToSql + Sync); N],
4031 query: &'static str,
4032 cached: Option<&'s tokio_postgres::Statement>,
4033 extractor: fn(&tokio_postgres::Row) -> Result<ReflectPgInheritsBorrowed, tokio_postgres::Error>,
4034 mapper: fn(ReflectPgInheritsBorrowed) -> T,
4035}
4036impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgInheritsQuery<'c, 'a, 's, C, T, N>
4037where
4038 C: GenericClient,
4039{
4040 pub fn map<R>(
4041 self,
4042 mapper: fn(ReflectPgInheritsBorrowed) -> R,
4043 ) -> ReflectPgInheritsQuery<'c, 'a, 's, C, R, N> {
4044 ReflectPgInheritsQuery {
4045 client: self.client,
4046 params: self.params,
4047 query: self.query,
4048 cached: self.cached,
4049 extractor: self.extractor,
4050 mapper,
4051 }
4052 }
4053 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
4054 let row =
4055 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
4056 Ok((self.mapper)((self.extractor)(&row)?))
4057 }
4058 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
4059 self.iter().await?.try_collect().await
4060 }
4061 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
4062 let opt_row =
4063 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
4064 Ok(opt_row
4065 .map(|row| {
4066 let extracted = (self.extractor)(&row)?;
4067 Ok((self.mapper)(extracted))
4068 })
4069 .transpose()?)
4070 }
4071 pub async fn iter(
4072 self,
4073 ) -> Result<
4074 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
4075 tokio_postgres::Error,
4076 > {
4077 let stream = crate::client::async_::raw(
4078 self.client,
4079 self.query,
4080 crate::slice_iter(&self.params),
4081 self.cached,
4082 )
4083 .await?;
4084 let mapped = stream
4085 .map(move |res| {
4086 res.and_then(|row| {
4087 let extracted = (self.extractor)(&row)?;
4088 Ok((self.mapper)(extracted))
4089 })
4090 })
4091 .into_stream();
4092 Ok(mapped)
4093 }
4094}
4095pub struct ReflectPgLanguageQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
4096 client: &'c C,
4097 params: [&'a (dyn postgres_types::ToSql + Sync); N],
4098 query: &'static str,
4099 cached: Option<&'s tokio_postgres::Statement>,
4100 extractor: fn(&tokio_postgres::Row) -> Result<ReflectPgLanguageBorrowed, tokio_postgres::Error>,
4101 mapper: fn(ReflectPgLanguageBorrowed) -> T,
4102}
4103impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgLanguageQuery<'c, 'a, 's, C, T, N>
4104where
4105 C: GenericClient,
4106{
4107 pub fn map<R>(
4108 self,
4109 mapper: fn(ReflectPgLanguageBorrowed) -> R,
4110 ) -> ReflectPgLanguageQuery<'c, 'a, 's, C, R, N> {
4111 ReflectPgLanguageQuery {
4112 client: self.client,
4113 params: self.params,
4114 query: self.query,
4115 cached: self.cached,
4116 extractor: self.extractor,
4117 mapper,
4118 }
4119 }
4120 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
4121 let row =
4122 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
4123 Ok((self.mapper)((self.extractor)(&row)?))
4124 }
4125 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
4126 self.iter().await?.try_collect().await
4127 }
4128 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
4129 let opt_row =
4130 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
4131 Ok(opt_row
4132 .map(|row| {
4133 let extracted = (self.extractor)(&row)?;
4134 Ok((self.mapper)(extracted))
4135 })
4136 .transpose()?)
4137 }
4138 pub async fn iter(
4139 self,
4140 ) -> Result<
4141 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
4142 tokio_postgres::Error,
4143 > {
4144 let stream = crate::client::async_::raw(
4145 self.client,
4146 self.query,
4147 crate::slice_iter(&self.params),
4148 self.cached,
4149 )
4150 .await?;
4151 let mapped = stream
4152 .map(move |res| {
4153 res.and_then(|row| {
4154 let extracted = (self.extractor)(&row)?;
4155 Ok((self.mapper)(extracted))
4156 })
4157 })
4158 .into_stream();
4159 Ok(mapped)
4160 }
4161}
4162pub struct ReflectPgNamespaceQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
4163 client: &'c C,
4164 params: [&'a (dyn postgres_types::ToSql + Sync); N],
4165 query: &'static str,
4166 cached: Option<&'s tokio_postgres::Statement>,
4167 extractor:
4168 fn(&tokio_postgres::Row) -> Result<ReflectPgNamespaceBorrowed, tokio_postgres::Error>,
4169 mapper: fn(ReflectPgNamespaceBorrowed) -> T,
4170}
4171impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgNamespaceQuery<'c, 'a, 's, C, T, N>
4172where
4173 C: GenericClient,
4174{
4175 pub fn map<R>(
4176 self,
4177 mapper: fn(ReflectPgNamespaceBorrowed) -> R,
4178 ) -> ReflectPgNamespaceQuery<'c, 'a, 's, C, R, N> {
4179 ReflectPgNamespaceQuery {
4180 client: self.client,
4181 params: self.params,
4182 query: self.query,
4183 cached: self.cached,
4184 extractor: self.extractor,
4185 mapper,
4186 }
4187 }
4188 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
4189 let row =
4190 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
4191 Ok((self.mapper)((self.extractor)(&row)?))
4192 }
4193 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
4194 self.iter().await?.try_collect().await
4195 }
4196 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
4197 let opt_row =
4198 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
4199 Ok(opt_row
4200 .map(|row| {
4201 let extracted = (self.extractor)(&row)?;
4202 Ok((self.mapper)(extracted))
4203 })
4204 .transpose()?)
4205 }
4206 pub async fn iter(
4207 self,
4208 ) -> Result<
4209 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
4210 tokio_postgres::Error,
4211 > {
4212 let stream = crate::client::async_::raw(
4213 self.client,
4214 self.query,
4215 crate::slice_iter(&self.params),
4216 self.cached,
4217 )
4218 .await?;
4219 let mapped = stream
4220 .map(move |res| {
4221 res.and_then(|row| {
4222 let extracted = (self.extractor)(&row)?;
4223 Ok((self.mapper)(extracted))
4224 })
4225 })
4226 .into_stream();
4227 Ok(mapped)
4228 }
4229}
4230pub struct ReflectPgOpclassQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
4231 client: &'c C,
4232 params: [&'a (dyn postgres_types::ToSql + Sync); N],
4233 query: &'static str,
4234 cached: Option<&'s tokio_postgres::Statement>,
4235 extractor: fn(&tokio_postgres::Row) -> Result<ReflectPgOpclassBorrowed, tokio_postgres::Error>,
4236 mapper: fn(ReflectPgOpclassBorrowed) -> T,
4237}
4238impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgOpclassQuery<'c, 'a, 's, C, T, N>
4239where
4240 C: GenericClient,
4241{
4242 pub fn map<R>(
4243 self,
4244 mapper: fn(ReflectPgOpclassBorrowed) -> R,
4245 ) -> ReflectPgOpclassQuery<'c, 'a, 's, C, R, N> {
4246 ReflectPgOpclassQuery {
4247 client: self.client,
4248 params: self.params,
4249 query: self.query,
4250 cached: self.cached,
4251 extractor: self.extractor,
4252 mapper,
4253 }
4254 }
4255 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
4256 let row =
4257 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
4258 Ok((self.mapper)((self.extractor)(&row)?))
4259 }
4260 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
4261 self.iter().await?.try_collect().await
4262 }
4263 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
4264 let opt_row =
4265 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
4266 Ok(opt_row
4267 .map(|row| {
4268 let extracted = (self.extractor)(&row)?;
4269 Ok((self.mapper)(extracted))
4270 })
4271 .transpose()?)
4272 }
4273 pub async fn iter(
4274 self,
4275 ) -> Result<
4276 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
4277 tokio_postgres::Error,
4278 > {
4279 let stream = crate::client::async_::raw(
4280 self.client,
4281 self.query,
4282 crate::slice_iter(&self.params),
4283 self.cached,
4284 )
4285 .await?;
4286 let mapped = stream
4287 .map(move |res| {
4288 res.and_then(|row| {
4289 let extracted = (self.extractor)(&row)?;
4290 Ok((self.mapper)(extracted))
4291 })
4292 })
4293 .into_stream();
4294 Ok(mapped)
4295 }
4296}
4297pub struct ReflectPgOperatorQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
4298 client: &'c C,
4299 params: [&'a (dyn postgres_types::ToSql + Sync); N],
4300 query: &'static str,
4301 cached: Option<&'s tokio_postgres::Statement>,
4302 extractor: fn(&tokio_postgres::Row) -> Result<ReflectPgOperatorBorrowed, tokio_postgres::Error>,
4303 mapper: fn(ReflectPgOperatorBorrowed) -> T,
4304}
4305impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgOperatorQuery<'c, 'a, 's, C, T, N>
4306where
4307 C: GenericClient,
4308{
4309 pub fn map<R>(
4310 self,
4311 mapper: fn(ReflectPgOperatorBorrowed) -> R,
4312 ) -> ReflectPgOperatorQuery<'c, 'a, 's, C, R, N> {
4313 ReflectPgOperatorQuery {
4314 client: self.client,
4315 params: self.params,
4316 query: self.query,
4317 cached: self.cached,
4318 extractor: self.extractor,
4319 mapper,
4320 }
4321 }
4322 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
4323 let row =
4324 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
4325 Ok((self.mapper)((self.extractor)(&row)?))
4326 }
4327 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
4328 self.iter().await?.try_collect().await
4329 }
4330 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
4331 let opt_row =
4332 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
4333 Ok(opt_row
4334 .map(|row| {
4335 let extracted = (self.extractor)(&row)?;
4336 Ok((self.mapper)(extracted))
4337 })
4338 .transpose()?)
4339 }
4340 pub async fn iter(
4341 self,
4342 ) -> Result<
4343 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
4344 tokio_postgres::Error,
4345 > {
4346 let stream = crate::client::async_::raw(
4347 self.client,
4348 self.query,
4349 crate::slice_iter(&self.params),
4350 self.cached,
4351 )
4352 .await?;
4353 let mapped = stream
4354 .map(move |res| {
4355 res.and_then(|row| {
4356 let extracted = (self.extractor)(&row)?;
4357 Ok((self.mapper)(extracted))
4358 })
4359 })
4360 .into_stream();
4361 Ok(mapped)
4362 }
4363}
4364pub struct ReflectPgOpfamilyQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
4365 client: &'c C,
4366 params: [&'a (dyn postgres_types::ToSql + Sync); N],
4367 query: &'static str,
4368 cached: Option<&'s tokio_postgres::Statement>,
4369 extractor: fn(&tokio_postgres::Row) -> Result<ReflectPgOpfamilyBorrowed, tokio_postgres::Error>,
4370 mapper: fn(ReflectPgOpfamilyBorrowed) -> T,
4371}
4372impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgOpfamilyQuery<'c, 'a, 's, C, T, N>
4373where
4374 C: GenericClient,
4375{
4376 pub fn map<R>(
4377 self,
4378 mapper: fn(ReflectPgOpfamilyBorrowed) -> R,
4379 ) -> ReflectPgOpfamilyQuery<'c, 'a, 's, C, R, N> {
4380 ReflectPgOpfamilyQuery {
4381 client: self.client,
4382 params: self.params,
4383 query: self.query,
4384 cached: self.cached,
4385 extractor: self.extractor,
4386 mapper,
4387 }
4388 }
4389 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
4390 let row =
4391 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
4392 Ok((self.mapper)((self.extractor)(&row)?))
4393 }
4394 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
4395 self.iter().await?.try_collect().await
4396 }
4397 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
4398 let opt_row =
4399 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
4400 Ok(opt_row
4401 .map(|row| {
4402 let extracted = (self.extractor)(&row)?;
4403 Ok((self.mapper)(extracted))
4404 })
4405 .transpose()?)
4406 }
4407 pub async fn iter(
4408 self,
4409 ) -> Result<
4410 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
4411 tokio_postgres::Error,
4412 > {
4413 let stream = crate::client::async_::raw(
4414 self.client,
4415 self.query,
4416 crate::slice_iter(&self.params),
4417 self.cached,
4418 )
4419 .await?;
4420 let mapped = stream
4421 .map(move |res| {
4422 res.and_then(|row| {
4423 let extracted = (self.extractor)(&row)?;
4424 Ok((self.mapper)(extracted))
4425 })
4426 })
4427 .into_stream();
4428 Ok(mapped)
4429 }
4430}
4431pub struct ReflectPgParameterAclQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
4432 client: &'c C,
4433 params: [&'a (dyn postgres_types::ToSql + Sync); N],
4434 query: &'static str,
4435 cached: Option<&'s tokio_postgres::Statement>,
4436 extractor:
4437 fn(&tokio_postgres::Row) -> Result<ReflectPgParameterAclBorrowed, tokio_postgres::Error>,
4438 mapper: fn(ReflectPgParameterAclBorrowed) -> T,
4439}
4440impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgParameterAclQuery<'c, 'a, 's, C, T, N>
4441where
4442 C: GenericClient,
4443{
4444 pub fn map<R>(
4445 self,
4446 mapper: fn(ReflectPgParameterAclBorrowed) -> R,
4447 ) -> ReflectPgParameterAclQuery<'c, 'a, 's, C, R, N> {
4448 ReflectPgParameterAclQuery {
4449 client: self.client,
4450 params: self.params,
4451 query: self.query,
4452 cached: self.cached,
4453 extractor: self.extractor,
4454 mapper,
4455 }
4456 }
4457 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
4458 let row =
4459 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
4460 Ok((self.mapper)((self.extractor)(&row)?))
4461 }
4462 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
4463 self.iter().await?.try_collect().await
4464 }
4465 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
4466 let opt_row =
4467 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
4468 Ok(opt_row
4469 .map(|row| {
4470 let extracted = (self.extractor)(&row)?;
4471 Ok((self.mapper)(extracted))
4472 })
4473 .transpose()?)
4474 }
4475 pub async fn iter(
4476 self,
4477 ) -> Result<
4478 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
4479 tokio_postgres::Error,
4480 > {
4481 let stream = crate::client::async_::raw(
4482 self.client,
4483 self.query,
4484 crate::slice_iter(&self.params),
4485 self.cached,
4486 )
4487 .await?;
4488 let mapped = stream
4489 .map(move |res| {
4490 res.and_then(|row| {
4491 let extracted = (self.extractor)(&row)?;
4492 Ok((self.mapper)(extracted))
4493 })
4494 })
4495 .into_stream();
4496 Ok(mapped)
4497 }
4498}
4499pub struct ReflectPgPartitionedTableQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
4500 client: &'c C,
4501 params: [&'a (dyn postgres_types::ToSql + Sync); N],
4502 query: &'static str,
4503 cached: Option<&'s tokio_postgres::Statement>,
4504 extractor: fn(
4505 &tokio_postgres::Row,
4506 ) -> Result<ReflectPgPartitionedTableBorrowed, tokio_postgres::Error>,
4507 mapper: fn(ReflectPgPartitionedTableBorrowed) -> T,
4508}
4509impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgPartitionedTableQuery<'c, 'a, 's, C, T, N>
4510where
4511 C: GenericClient,
4512{
4513 pub fn map<R>(
4514 self,
4515 mapper: fn(ReflectPgPartitionedTableBorrowed) -> R,
4516 ) -> ReflectPgPartitionedTableQuery<'c, 'a, 's, C, R, N> {
4517 ReflectPgPartitionedTableQuery {
4518 client: self.client,
4519 params: self.params,
4520 query: self.query,
4521 cached: self.cached,
4522 extractor: self.extractor,
4523 mapper,
4524 }
4525 }
4526 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
4527 let row =
4528 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
4529 Ok((self.mapper)((self.extractor)(&row)?))
4530 }
4531 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
4532 self.iter().await?.try_collect().await
4533 }
4534 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
4535 let opt_row =
4536 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
4537 Ok(opt_row
4538 .map(|row| {
4539 let extracted = (self.extractor)(&row)?;
4540 Ok((self.mapper)(extracted))
4541 })
4542 .transpose()?)
4543 }
4544 pub async fn iter(
4545 self,
4546 ) -> Result<
4547 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
4548 tokio_postgres::Error,
4549 > {
4550 let stream = crate::client::async_::raw(
4551 self.client,
4552 self.query,
4553 crate::slice_iter(&self.params),
4554 self.cached,
4555 )
4556 .await?;
4557 let mapped = stream
4558 .map(move |res| {
4559 res.and_then(|row| {
4560 let extracted = (self.extractor)(&row)?;
4561 Ok((self.mapper)(extracted))
4562 })
4563 })
4564 .into_stream();
4565 Ok(mapped)
4566 }
4567}
4568pub struct ReflectPgPolicyQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
4569 client: &'c C,
4570 params: [&'a (dyn postgres_types::ToSql + Sync); N],
4571 query: &'static str,
4572 cached: Option<&'s tokio_postgres::Statement>,
4573 extractor: fn(&tokio_postgres::Row) -> Result<ReflectPgPolicyBorrowed, tokio_postgres::Error>,
4574 mapper: fn(ReflectPgPolicyBorrowed) -> T,
4575}
4576impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgPolicyQuery<'c, 'a, 's, C, T, N>
4577where
4578 C: GenericClient,
4579{
4580 pub fn map<R>(
4581 self,
4582 mapper: fn(ReflectPgPolicyBorrowed) -> R,
4583 ) -> ReflectPgPolicyQuery<'c, 'a, 's, C, R, N> {
4584 ReflectPgPolicyQuery {
4585 client: self.client,
4586 params: self.params,
4587 query: self.query,
4588 cached: self.cached,
4589 extractor: self.extractor,
4590 mapper,
4591 }
4592 }
4593 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
4594 let row =
4595 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
4596 Ok((self.mapper)((self.extractor)(&row)?))
4597 }
4598 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
4599 self.iter().await?.try_collect().await
4600 }
4601 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
4602 let opt_row =
4603 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
4604 Ok(opt_row
4605 .map(|row| {
4606 let extracted = (self.extractor)(&row)?;
4607 Ok((self.mapper)(extracted))
4608 })
4609 .transpose()?)
4610 }
4611 pub async fn iter(
4612 self,
4613 ) -> Result<
4614 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
4615 tokio_postgres::Error,
4616 > {
4617 let stream = crate::client::async_::raw(
4618 self.client,
4619 self.query,
4620 crate::slice_iter(&self.params),
4621 self.cached,
4622 )
4623 .await?;
4624 let mapped = stream
4625 .map(move |res| {
4626 res.and_then(|row| {
4627 let extracted = (self.extractor)(&row)?;
4628 Ok((self.mapper)(extracted))
4629 })
4630 })
4631 .into_stream();
4632 Ok(mapped)
4633 }
4634}
4635pub struct ReflectPgPublicationQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
4636 client: &'c C,
4637 params: [&'a (dyn postgres_types::ToSql + Sync); N],
4638 query: &'static str,
4639 cached: Option<&'s tokio_postgres::Statement>,
4640 extractor:
4641 fn(&tokio_postgres::Row) -> Result<ReflectPgPublicationBorrowed, tokio_postgres::Error>,
4642 mapper: fn(ReflectPgPublicationBorrowed) -> T,
4643}
4644impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgPublicationQuery<'c, 'a, 's, C, T, N>
4645where
4646 C: GenericClient,
4647{
4648 pub fn map<R>(
4649 self,
4650 mapper: fn(ReflectPgPublicationBorrowed) -> R,
4651 ) -> ReflectPgPublicationQuery<'c, 'a, 's, C, R, N> {
4652 ReflectPgPublicationQuery {
4653 client: self.client,
4654 params: self.params,
4655 query: self.query,
4656 cached: self.cached,
4657 extractor: self.extractor,
4658 mapper,
4659 }
4660 }
4661 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
4662 let row =
4663 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
4664 Ok((self.mapper)((self.extractor)(&row)?))
4665 }
4666 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
4667 self.iter().await?.try_collect().await
4668 }
4669 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
4670 let opt_row =
4671 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
4672 Ok(opt_row
4673 .map(|row| {
4674 let extracted = (self.extractor)(&row)?;
4675 Ok((self.mapper)(extracted))
4676 })
4677 .transpose()?)
4678 }
4679 pub async fn iter(
4680 self,
4681 ) -> Result<
4682 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
4683 tokio_postgres::Error,
4684 > {
4685 let stream = crate::client::async_::raw(
4686 self.client,
4687 self.query,
4688 crate::slice_iter(&self.params),
4689 self.cached,
4690 )
4691 .await?;
4692 let mapped = stream
4693 .map(move |res| {
4694 res.and_then(|row| {
4695 let extracted = (self.extractor)(&row)?;
4696 Ok((self.mapper)(extracted))
4697 })
4698 })
4699 .into_stream();
4700 Ok(mapped)
4701 }
4702}
4703pub struct ReflectPgPublicationNamespaceQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
4704 client: &'c C,
4705 params: [&'a (dyn postgres_types::ToSql + Sync); N],
4706 query: &'static str,
4707 cached: Option<&'s tokio_postgres::Statement>,
4708 extractor: fn(
4709 &tokio_postgres::Row,
4710 ) -> Result<ReflectPgPublicationNamespaceBorrowed, tokio_postgres::Error>,
4711 mapper: fn(ReflectPgPublicationNamespaceBorrowed) -> T,
4712}
4713impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgPublicationNamespaceQuery<'c, 'a, 's, C, T, N>
4714where
4715 C: GenericClient,
4716{
4717 pub fn map<R>(
4718 self,
4719 mapper: fn(ReflectPgPublicationNamespaceBorrowed) -> R,
4720 ) -> ReflectPgPublicationNamespaceQuery<'c, 'a, 's, C, R, N> {
4721 ReflectPgPublicationNamespaceQuery {
4722 client: self.client,
4723 params: self.params,
4724 query: self.query,
4725 cached: self.cached,
4726 extractor: self.extractor,
4727 mapper,
4728 }
4729 }
4730 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
4731 let row =
4732 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
4733 Ok((self.mapper)((self.extractor)(&row)?))
4734 }
4735 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
4736 self.iter().await?.try_collect().await
4737 }
4738 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
4739 let opt_row =
4740 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
4741 Ok(opt_row
4742 .map(|row| {
4743 let extracted = (self.extractor)(&row)?;
4744 Ok((self.mapper)(extracted))
4745 })
4746 .transpose()?)
4747 }
4748 pub async fn iter(
4749 self,
4750 ) -> Result<
4751 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
4752 tokio_postgres::Error,
4753 > {
4754 let stream = crate::client::async_::raw(
4755 self.client,
4756 self.query,
4757 crate::slice_iter(&self.params),
4758 self.cached,
4759 )
4760 .await?;
4761 let mapped = stream
4762 .map(move |res| {
4763 res.and_then(|row| {
4764 let extracted = (self.extractor)(&row)?;
4765 Ok((self.mapper)(extracted))
4766 })
4767 })
4768 .into_stream();
4769 Ok(mapped)
4770 }
4771}
4772pub struct ReflectPgPublicationRelQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
4773 client: &'c C,
4774 params: [&'a (dyn postgres_types::ToSql + Sync); N],
4775 query: &'static str,
4776 cached: Option<&'s tokio_postgres::Statement>,
4777 extractor:
4778 fn(&tokio_postgres::Row) -> Result<ReflectPgPublicationRelBorrowed, tokio_postgres::Error>,
4779 mapper: fn(ReflectPgPublicationRelBorrowed) -> T,
4780}
4781impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgPublicationRelQuery<'c, 'a, 's, C, T, N>
4782where
4783 C: GenericClient,
4784{
4785 pub fn map<R>(
4786 self,
4787 mapper: fn(ReflectPgPublicationRelBorrowed) -> R,
4788 ) -> ReflectPgPublicationRelQuery<'c, 'a, 's, C, R, N> {
4789 ReflectPgPublicationRelQuery {
4790 client: self.client,
4791 params: self.params,
4792 query: self.query,
4793 cached: self.cached,
4794 extractor: self.extractor,
4795 mapper,
4796 }
4797 }
4798 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
4799 let row =
4800 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
4801 Ok((self.mapper)((self.extractor)(&row)?))
4802 }
4803 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
4804 self.iter().await?.try_collect().await
4805 }
4806 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
4807 let opt_row =
4808 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
4809 Ok(opt_row
4810 .map(|row| {
4811 let extracted = (self.extractor)(&row)?;
4812 Ok((self.mapper)(extracted))
4813 })
4814 .transpose()?)
4815 }
4816 pub async fn iter(
4817 self,
4818 ) -> Result<
4819 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
4820 tokio_postgres::Error,
4821 > {
4822 let stream = crate::client::async_::raw(
4823 self.client,
4824 self.query,
4825 crate::slice_iter(&self.params),
4826 self.cached,
4827 )
4828 .await?;
4829 let mapped = stream
4830 .map(move |res| {
4831 res.and_then(|row| {
4832 let extracted = (self.extractor)(&row)?;
4833 Ok((self.mapper)(extracted))
4834 })
4835 })
4836 .into_stream();
4837 Ok(mapped)
4838 }
4839}
4840pub struct ReflectPgRangeQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
4841 client: &'c C,
4842 params: [&'a (dyn postgres_types::ToSql + Sync); N],
4843 query: &'static str,
4844 cached: Option<&'s tokio_postgres::Statement>,
4845 extractor: fn(&tokio_postgres::Row) -> Result<ReflectPgRangeBorrowed, tokio_postgres::Error>,
4846 mapper: fn(ReflectPgRangeBorrowed) -> T,
4847}
4848impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgRangeQuery<'c, 'a, 's, C, T, N>
4849where
4850 C: GenericClient,
4851{
4852 pub fn map<R>(
4853 self,
4854 mapper: fn(ReflectPgRangeBorrowed) -> R,
4855 ) -> ReflectPgRangeQuery<'c, 'a, 's, C, R, N> {
4856 ReflectPgRangeQuery {
4857 client: self.client,
4858 params: self.params,
4859 query: self.query,
4860 cached: self.cached,
4861 extractor: self.extractor,
4862 mapper,
4863 }
4864 }
4865 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
4866 let row =
4867 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
4868 Ok((self.mapper)((self.extractor)(&row)?))
4869 }
4870 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
4871 self.iter().await?.try_collect().await
4872 }
4873 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
4874 let opt_row =
4875 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
4876 Ok(opt_row
4877 .map(|row| {
4878 let extracted = (self.extractor)(&row)?;
4879 Ok((self.mapper)(extracted))
4880 })
4881 .transpose()?)
4882 }
4883 pub async fn iter(
4884 self,
4885 ) -> Result<
4886 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
4887 tokio_postgres::Error,
4888 > {
4889 let stream = crate::client::async_::raw(
4890 self.client,
4891 self.query,
4892 crate::slice_iter(&self.params),
4893 self.cached,
4894 )
4895 .await?;
4896 let mapped = stream
4897 .map(move |res| {
4898 res.and_then(|row| {
4899 let extracted = (self.extractor)(&row)?;
4900 Ok((self.mapper)(extracted))
4901 })
4902 })
4903 .into_stream();
4904 Ok(mapped)
4905 }
4906}
4907pub struct ReflectPgRulesQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
4908 client: &'c C,
4909 params: [&'a (dyn postgres_types::ToSql + Sync); N],
4910 query: &'static str,
4911 cached: Option<&'s tokio_postgres::Statement>,
4912 extractor: fn(&tokio_postgres::Row) -> Result<ReflectPgRulesBorrowed, tokio_postgres::Error>,
4913 mapper: fn(ReflectPgRulesBorrowed) -> T,
4914}
4915impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgRulesQuery<'c, 'a, 's, C, T, N>
4916where
4917 C: GenericClient,
4918{
4919 pub fn map<R>(
4920 self,
4921 mapper: fn(ReflectPgRulesBorrowed) -> R,
4922 ) -> ReflectPgRulesQuery<'c, 'a, 's, C, R, N> {
4923 ReflectPgRulesQuery {
4924 client: self.client,
4925 params: self.params,
4926 query: self.query,
4927 cached: self.cached,
4928 extractor: self.extractor,
4929 mapper,
4930 }
4931 }
4932 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
4933 let row =
4934 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
4935 Ok((self.mapper)((self.extractor)(&row)?))
4936 }
4937 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
4938 self.iter().await?.try_collect().await
4939 }
4940 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
4941 let opt_row =
4942 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
4943 Ok(opt_row
4944 .map(|row| {
4945 let extracted = (self.extractor)(&row)?;
4946 Ok((self.mapper)(extracted))
4947 })
4948 .transpose()?)
4949 }
4950 pub async fn iter(
4951 self,
4952 ) -> Result<
4953 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
4954 tokio_postgres::Error,
4955 > {
4956 let stream = crate::client::async_::raw(
4957 self.client,
4958 self.query,
4959 crate::slice_iter(&self.params),
4960 self.cached,
4961 )
4962 .await?;
4963 let mapped = stream
4964 .map(move |res| {
4965 res.and_then(|row| {
4966 let extracted = (self.extractor)(&row)?;
4967 Ok((self.mapper)(extracted))
4968 })
4969 })
4970 .into_stream();
4971 Ok(mapped)
4972 }
4973}
4974pub struct ReflectPgViewsQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
4975 client: &'c C,
4976 params: [&'a (dyn postgres_types::ToSql + Sync); N],
4977 query: &'static str,
4978 cached: Option<&'s tokio_postgres::Statement>,
4979 extractor: fn(&tokio_postgres::Row) -> Result<ReflectPgViewsBorrowed, tokio_postgres::Error>,
4980 mapper: fn(ReflectPgViewsBorrowed) -> T,
4981}
4982impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgViewsQuery<'c, 'a, 's, C, T, N>
4983where
4984 C: GenericClient,
4985{
4986 pub fn map<R>(
4987 self,
4988 mapper: fn(ReflectPgViewsBorrowed) -> R,
4989 ) -> ReflectPgViewsQuery<'c, 'a, 's, C, R, N> {
4990 ReflectPgViewsQuery {
4991 client: self.client,
4992 params: self.params,
4993 query: self.query,
4994 cached: self.cached,
4995 extractor: self.extractor,
4996 mapper,
4997 }
4998 }
4999 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
5000 let row =
5001 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
5002 Ok((self.mapper)((self.extractor)(&row)?))
5003 }
5004 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
5005 self.iter().await?.try_collect().await
5006 }
5007 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
5008 let opt_row =
5009 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
5010 Ok(opt_row
5011 .map(|row| {
5012 let extracted = (self.extractor)(&row)?;
5013 Ok((self.mapper)(extracted))
5014 })
5015 .transpose()?)
5016 }
5017 pub async fn iter(
5018 self,
5019 ) -> Result<
5020 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
5021 tokio_postgres::Error,
5022 > {
5023 let stream = crate::client::async_::raw(
5024 self.client,
5025 self.query,
5026 crate::slice_iter(&self.params),
5027 self.cached,
5028 )
5029 .await?;
5030 let mapped = stream
5031 .map(move |res| {
5032 res.and_then(|row| {
5033 let extracted = (self.extractor)(&row)?;
5034 Ok((self.mapper)(extracted))
5035 })
5036 })
5037 .into_stream();
5038 Ok(mapped)
5039 }
5040}
5041pub struct ReflectPgMatviewsQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
5042 client: &'c C,
5043 params: [&'a (dyn postgres_types::ToSql + Sync); N],
5044 query: &'static str,
5045 cached: Option<&'s tokio_postgres::Statement>,
5046 extractor: fn(&tokio_postgres::Row) -> Result<ReflectPgMatviewsBorrowed, tokio_postgres::Error>,
5047 mapper: fn(ReflectPgMatviewsBorrowed) -> T,
5048}
5049impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgMatviewsQuery<'c, 'a, 's, C, T, N>
5050where
5051 C: GenericClient,
5052{
5053 pub fn map<R>(
5054 self,
5055 mapper: fn(ReflectPgMatviewsBorrowed) -> R,
5056 ) -> ReflectPgMatviewsQuery<'c, 'a, 's, C, R, N> {
5057 ReflectPgMatviewsQuery {
5058 client: self.client,
5059 params: self.params,
5060 query: self.query,
5061 cached: self.cached,
5062 extractor: self.extractor,
5063 mapper,
5064 }
5065 }
5066 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
5067 let row =
5068 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
5069 Ok((self.mapper)((self.extractor)(&row)?))
5070 }
5071 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
5072 self.iter().await?.try_collect().await
5073 }
5074 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
5075 let opt_row =
5076 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
5077 Ok(opt_row
5078 .map(|row| {
5079 let extracted = (self.extractor)(&row)?;
5080 Ok((self.mapper)(extracted))
5081 })
5082 .transpose()?)
5083 }
5084 pub async fn iter(
5085 self,
5086 ) -> Result<
5087 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
5088 tokio_postgres::Error,
5089 > {
5090 let stream = crate::client::async_::raw(
5091 self.client,
5092 self.query,
5093 crate::slice_iter(&self.params),
5094 self.cached,
5095 )
5096 .await?;
5097 let mapped = stream
5098 .map(move |res| {
5099 res.and_then(|row| {
5100 let extracted = (self.extractor)(&row)?;
5101 Ok((self.mapper)(extracted))
5102 })
5103 })
5104 .into_stream();
5105 Ok(mapped)
5106 }
5107}
5108pub struct ReflectPgSequenceQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
5109 client: &'c C,
5110 params: [&'a (dyn postgres_types::ToSql + Sync); N],
5111 query: &'static str,
5112 cached: Option<&'s tokio_postgres::Statement>,
5113 extractor: fn(&tokio_postgres::Row) -> Result<ReflectPgSequenceBorrowed, tokio_postgres::Error>,
5114 mapper: fn(ReflectPgSequenceBorrowed) -> T,
5115}
5116impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgSequenceQuery<'c, 'a, 's, C, T, N>
5117where
5118 C: GenericClient,
5119{
5120 pub fn map<R>(
5121 self,
5122 mapper: fn(ReflectPgSequenceBorrowed) -> R,
5123 ) -> ReflectPgSequenceQuery<'c, 'a, 's, C, R, N> {
5124 ReflectPgSequenceQuery {
5125 client: self.client,
5126 params: self.params,
5127 query: self.query,
5128 cached: self.cached,
5129 extractor: self.extractor,
5130 mapper,
5131 }
5132 }
5133 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
5134 let row =
5135 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
5136 Ok((self.mapper)((self.extractor)(&row)?))
5137 }
5138 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
5139 self.iter().await?.try_collect().await
5140 }
5141 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
5142 let opt_row =
5143 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
5144 Ok(opt_row
5145 .map(|row| {
5146 let extracted = (self.extractor)(&row)?;
5147 Ok((self.mapper)(extracted))
5148 })
5149 .transpose()?)
5150 }
5151 pub async fn iter(
5152 self,
5153 ) -> Result<
5154 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
5155 tokio_postgres::Error,
5156 > {
5157 let stream = crate::client::async_::raw(
5158 self.client,
5159 self.query,
5160 crate::slice_iter(&self.params),
5161 self.cached,
5162 )
5163 .await?;
5164 let mapped = stream
5165 .map(move |res| {
5166 res.and_then(|row| {
5167 let extracted = (self.extractor)(&row)?;
5168 Ok((self.mapper)(extracted))
5169 })
5170 })
5171 .into_stream();
5172 Ok(mapped)
5173 }
5174}
5175pub struct ReflectPgStatisticExtQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
5176 client: &'c C,
5177 params: [&'a (dyn postgres_types::ToSql + Sync); N],
5178 query: &'static str,
5179 cached: Option<&'s tokio_postgres::Statement>,
5180 extractor:
5181 fn(&tokio_postgres::Row) -> Result<ReflectPgStatisticExtBorrowed, tokio_postgres::Error>,
5182 mapper: fn(ReflectPgStatisticExtBorrowed) -> T,
5183}
5184impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgStatisticExtQuery<'c, 'a, 's, C, T, N>
5185where
5186 C: GenericClient,
5187{
5188 pub fn map<R>(
5189 self,
5190 mapper: fn(ReflectPgStatisticExtBorrowed) -> R,
5191 ) -> ReflectPgStatisticExtQuery<'c, 'a, 's, C, R, N> {
5192 ReflectPgStatisticExtQuery {
5193 client: self.client,
5194 params: self.params,
5195 query: self.query,
5196 cached: self.cached,
5197 extractor: self.extractor,
5198 mapper,
5199 }
5200 }
5201 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
5202 let row =
5203 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
5204 Ok((self.mapper)((self.extractor)(&row)?))
5205 }
5206 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
5207 self.iter().await?.try_collect().await
5208 }
5209 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
5210 let opt_row =
5211 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
5212 Ok(opt_row
5213 .map(|row| {
5214 let extracted = (self.extractor)(&row)?;
5215 Ok((self.mapper)(extracted))
5216 })
5217 .transpose()?)
5218 }
5219 pub async fn iter(
5220 self,
5221 ) -> Result<
5222 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
5223 tokio_postgres::Error,
5224 > {
5225 let stream = crate::client::async_::raw(
5226 self.client,
5227 self.query,
5228 crate::slice_iter(&self.params),
5229 self.cached,
5230 )
5231 .await?;
5232 let mapped = stream
5233 .map(move |res| {
5234 res.and_then(|row| {
5235 let extracted = (self.extractor)(&row)?;
5236 Ok((self.mapper)(extracted))
5237 })
5238 })
5239 .into_stream();
5240 Ok(mapped)
5241 }
5242}
5243pub struct ReflectPgSubscriptionQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
5244 client: &'c C,
5245 params: [&'a (dyn postgres_types::ToSql + Sync); N],
5246 query: &'static str,
5247 cached: Option<&'s tokio_postgres::Statement>,
5248 extractor:
5249 fn(&tokio_postgres::Row) -> Result<ReflectPgSubscriptionBorrowed, tokio_postgres::Error>,
5250 mapper: fn(ReflectPgSubscriptionBorrowed) -> T,
5251}
5252impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgSubscriptionQuery<'c, 'a, 's, C, T, N>
5253where
5254 C: GenericClient,
5255{
5256 pub fn map<R>(
5257 self,
5258 mapper: fn(ReflectPgSubscriptionBorrowed) -> R,
5259 ) -> ReflectPgSubscriptionQuery<'c, 'a, 's, C, R, N> {
5260 ReflectPgSubscriptionQuery {
5261 client: self.client,
5262 params: self.params,
5263 query: self.query,
5264 cached: self.cached,
5265 extractor: self.extractor,
5266 mapper,
5267 }
5268 }
5269 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
5270 let row =
5271 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
5272 Ok((self.mapper)((self.extractor)(&row)?))
5273 }
5274 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
5275 self.iter().await?.try_collect().await
5276 }
5277 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
5278 let opt_row =
5279 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
5280 Ok(opt_row
5281 .map(|row| {
5282 let extracted = (self.extractor)(&row)?;
5283 Ok((self.mapper)(extracted))
5284 })
5285 .transpose()?)
5286 }
5287 pub async fn iter(
5288 self,
5289 ) -> Result<
5290 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
5291 tokio_postgres::Error,
5292 > {
5293 let stream = crate::client::async_::raw(
5294 self.client,
5295 self.query,
5296 crate::slice_iter(&self.params),
5297 self.cached,
5298 )
5299 .await?;
5300 let mapped = stream
5301 .map(move |res| {
5302 res.and_then(|row| {
5303 let extracted = (self.extractor)(&row)?;
5304 Ok((self.mapper)(extracted))
5305 })
5306 })
5307 .into_stream();
5308 Ok(mapped)
5309 }
5310}
5311pub struct ReflectPgTransformQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
5312 client: &'c C,
5313 params: [&'a (dyn postgres_types::ToSql + Sync); N],
5314 query: &'static str,
5315 cached: Option<&'s tokio_postgres::Statement>,
5316 extractor:
5317 fn(&tokio_postgres::Row) -> Result<ReflectPgTransformBorrowed, tokio_postgres::Error>,
5318 mapper: fn(ReflectPgTransformBorrowed) -> T,
5319}
5320impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgTransformQuery<'c, 'a, 's, C, T, N>
5321where
5322 C: GenericClient,
5323{
5324 pub fn map<R>(
5325 self,
5326 mapper: fn(ReflectPgTransformBorrowed) -> R,
5327 ) -> ReflectPgTransformQuery<'c, 'a, 's, C, R, N> {
5328 ReflectPgTransformQuery {
5329 client: self.client,
5330 params: self.params,
5331 query: self.query,
5332 cached: self.cached,
5333 extractor: self.extractor,
5334 mapper,
5335 }
5336 }
5337 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
5338 let row =
5339 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
5340 Ok((self.mapper)((self.extractor)(&row)?))
5341 }
5342 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
5343 self.iter().await?.try_collect().await
5344 }
5345 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
5346 let opt_row =
5347 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
5348 Ok(opt_row
5349 .map(|row| {
5350 let extracted = (self.extractor)(&row)?;
5351 Ok((self.mapper)(extracted))
5352 })
5353 .transpose()?)
5354 }
5355 pub async fn iter(
5356 self,
5357 ) -> Result<
5358 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
5359 tokio_postgres::Error,
5360 > {
5361 let stream = crate::client::async_::raw(
5362 self.client,
5363 self.query,
5364 crate::slice_iter(&self.params),
5365 self.cached,
5366 )
5367 .await?;
5368 let mapped = stream
5369 .map(move |res| {
5370 res.and_then(|row| {
5371 let extracted = (self.extractor)(&row)?;
5372 Ok((self.mapper)(extracted))
5373 })
5374 })
5375 .into_stream();
5376 Ok(mapped)
5377 }
5378}
5379pub struct ReflectPgTriggerQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
5380 client: &'c C,
5381 params: [&'a (dyn postgres_types::ToSql + Sync); N],
5382 query: &'static str,
5383 cached: Option<&'s tokio_postgres::Statement>,
5384 extractor: fn(&tokio_postgres::Row) -> Result<ReflectPgTriggerBorrowed, tokio_postgres::Error>,
5385 mapper: fn(ReflectPgTriggerBorrowed) -> T,
5386}
5387impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgTriggerQuery<'c, 'a, 's, C, T, N>
5388where
5389 C: GenericClient,
5390{
5391 pub fn map<R>(
5392 self,
5393 mapper: fn(ReflectPgTriggerBorrowed) -> R,
5394 ) -> ReflectPgTriggerQuery<'c, 'a, 's, C, R, N> {
5395 ReflectPgTriggerQuery {
5396 client: self.client,
5397 params: self.params,
5398 query: self.query,
5399 cached: self.cached,
5400 extractor: self.extractor,
5401 mapper,
5402 }
5403 }
5404 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
5405 let row =
5406 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
5407 Ok((self.mapper)((self.extractor)(&row)?))
5408 }
5409 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
5410 self.iter().await?.try_collect().await
5411 }
5412 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
5413 let opt_row =
5414 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
5415 Ok(opt_row
5416 .map(|row| {
5417 let extracted = (self.extractor)(&row)?;
5418 Ok((self.mapper)(extracted))
5419 })
5420 .transpose()?)
5421 }
5422 pub async fn iter(
5423 self,
5424 ) -> Result<
5425 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
5426 tokio_postgres::Error,
5427 > {
5428 let stream = crate::client::async_::raw(
5429 self.client,
5430 self.query,
5431 crate::slice_iter(&self.params),
5432 self.cached,
5433 )
5434 .await?;
5435 let mapped = stream
5436 .map(move |res| {
5437 res.and_then(|row| {
5438 let extracted = (self.extractor)(&row)?;
5439 Ok((self.mapper)(extracted))
5440 })
5441 })
5442 .into_stream();
5443 Ok(mapped)
5444 }
5445}
5446pub struct ReflectPgTsConfigQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
5447 client: &'c C,
5448 params: [&'a (dyn postgres_types::ToSql + Sync); N],
5449 query: &'static str,
5450 cached: Option<&'s tokio_postgres::Statement>,
5451 extractor: fn(&tokio_postgres::Row) -> Result<ReflectPgTsConfigBorrowed, tokio_postgres::Error>,
5452 mapper: fn(ReflectPgTsConfigBorrowed) -> T,
5453}
5454impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgTsConfigQuery<'c, 'a, 's, C, T, N>
5455where
5456 C: GenericClient,
5457{
5458 pub fn map<R>(
5459 self,
5460 mapper: fn(ReflectPgTsConfigBorrowed) -> R,
5461 ) -> ReflectPgTsConfigQuery<'c, 'a, 's, C, R, N> {
5462 ReflectPgTsConfigQuery {
5463 client: self.client,
5464 params: self.params,
5465 query: self.query,
5466 cached: self.cached,
5467 extractor: self.extractor,
5468 mapper,
5469 }
5470 }
5471 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
5472 let row =
5473 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
5474 Ok((self.mapper)((self.extractor)(&row)?))
5475 }
5476 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
5477 self.iter().await?.try_collect().await
5478 }
5479 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
5480 let opt_row =
5481 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
5482 Ok(opt_row
5483 .map(|row| {
5484 let extracted = (self.extractor)(&row)?;
5485 Ok((self.mapper)(extracted))
5486 })
5487 .transpose()?)
5488 }
5489 pub async fn iter(
5490 self,
5491 ) -> Result<
5492 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
5493 tokio_postgres::Error,
5494 > {
5495 let stream = crate::client::async_::raw(
5496 self.client,
5497 self.query,
5498 crate::slice_iter(&self.params),
5499 self.cached,
5500 )
5501 .await?;
5502 let mapped = stream
5503 .map(move |res| {
5504 res.and_then(|row| {
5505 let extracted = (self.extractor)(&row)?;
5506 Ok((self.mapper)(extracted))
5507 })
5508 })
5509 .into_stream();
5510 Ok(mapped)
5511 }
5512}
5513pub struct ReflectPgTsConfigMapQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
5514 client: &'c C,
5515 params: [&'a (dyn postgres_types::ToSql + Sync); N],
5516 query: &'static str,
5517 cached: Option<&'s tokio_postgres::Statement>,
5518 extractor:
5519 fn(&tokio_postgres::Row) -> Result<ReflectPgTsConfigMapBorrowed, tokio_postgres::Error>,
5520 mapper: fn(ReflectPgTsConfigMapBorrowed) -> T,
5521}
5522impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgTsConfigMapQuery<'c, 'a, 's, C, T, N>
5523where
5524 C: GenericClient,
5525{
5526 pub fn map<R>(
5527 self,
5528 mapper: fn(ReflectPgTsConfigMapBorrowed) -> R,
5529 ) -> ReflectPgTsConfigMapQuery<'c, 'a, 's, C, R, N> {
5530 ReflectPgTsConfigMapQuery {
5531 client: self.client,
5532 params: self.params,
5533 query: self.query,
5534 cached: self.cached,
5535 extractor: self.extractor,
5536 mapper,
5537 }
5538 }
5539 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
5540 let row =
5541 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
5542 Ok((self.mapper)((self.extractor)(&row)?))
5543 }
5544 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
5545 self.iter().await?.try_collect().await
5546 }
5547 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
5548 let opt_row =
5549 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
5550 Ok(opt_row
5551 .map(|row| {
5552 let extracted = (self.extractor)(&row)?;
5553 Ok((self.mapper)(extracted))
5554 })
5555 .transpose()?)
5556 }
5557 pub async fn iter(
5558 self,
5559 ) -> Result<
5560 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
5561 tokio_postgres::Error,
5562 > {
5563 let stream = crate::client::async_::raw(
5564 self.client,
5565 self.query,
5566 crate::slice_iter(&self.params),
5567 self.cached,
5568 )
5569 .await?;
5570 let mapped = stream
5571 .map(move |res| {
5572 res.and_then(|row| {
5573 let extracted = (self.extractor)(&row)?;
5574 Ok((self.mapper)(extracted))
5575 })
5576 })
5577 .into_stream();
5578 Ok(mapped)
5579 }
5580}
5581pub struct ReflectPgTsDictQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
5582 client: &'c C,
5583 params: [&'a (dyn postgres_types::ToSql + Sync); N],
5584 query: &'static str,
5585 cached: Option<&'s tokio_postgres::Statement>,
5586 extractor: fn(&tokio_postgres::Row) -> Result<ReflectPgTsDictBorrowed, tokio_postgres::Error>,
5587 mapper: fn(ReflectPgTsDictBorrowed) -> T,
5588}
5589impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgTsDictQuery<'c, 'a, 's, C, T, N>
5590where
5591 C: GenericClient,
5592{
5593 pub fn map<R>(
5594 self,
5595 mapper: fn(ReflectPgTsDictBorrowed) -> R,
5596 ) -> ReflectPgTsDictQuery<'c, 'a, 's, C, R, N> {
5597 ReflectPgTsDictQuery {
5598 client: self.client,
5599 params: self.params,
5600 query: self.query,
5601 cached: self.cached,
5602 extractor: self.extractor,
5603 mapper,
5604 }
5605 }
5606 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
5607 let row =
5608 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
5609 Ok((self.mapper)((self.extractor)(&row)?))
5610 }
5611 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
5612 self.iter().await?.try_collect().await
5613 }
5614 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
5615 let opt_row =
5616 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
5617 Ok(opt_row
5618 .map(|row| {
5619 let extracted = (self.extractor)(&row)?;
5620 Ok((self.mapper)(extracted))
5621 })
5622 .transpose()?)
5623 }
5624 pub async fn iter(
5625 self,
5626 ) -> Result<
5627 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
5628 tokio_postgres::Error,
5629 > {
5630 let stream = crate::client::async_::raw(
5631 self.client,
5632 self.query,
5633 crate::slice_iter(&self.params),
5634 self.cached,
5635 )
5636 .await?;
5637 let mapped = stream
5638 .map(move |res| {
5639 res.and_then(|row| {
5640 let extracted = (self.extractor)(&row)?;
5641 Ok((self.mapper)(extracted))
5642 })
5643 })
5644 .into_stream();
5645 Ok(mapped)
5646 }
5647}
5648pub struct ReflectPgTsParserQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
5649 client: &'c C,
5650 params: [&'a (dyn postgres_types::ToSql + Sync); N],
5651 query: &'static str,
5652 cached: Option<&'s tokio_postgres::Statement>,
5653 extractor: fn(&tokio_postgres::Row) -> Result<ReflectPgTsParserBorrowed, tokio_postgres::Error>,
5654 mapper: fn(ReflectPgTsParserBorrowed) -> T,
5655}
5656impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgTsParserQuery<'c, 'a, 's, C, T, N>
5657where
5658 C: GenericClient,
5659{
5660 pub fn map<R>(
5661 self,
5662 mapper: fn(ReflectPgTsParserBorrowed) -> R,
5663 ) -> ReflectPgTsParserQuery<'c, 'a, 's, C, R, N> {
5664 ReflectPgTsParserQuery {
5665 client: self.client,
5666 params: self.params,
5667 query: self.query,
5668 cached: self.cached,
5669 extractor: self.extractor,
5670 mapper,
5671 }
5672 }
5673 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
5674 let row =
5675 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
5676 Ok((self.mapper)((self.extractor)(&row)?))
5677 }
5678 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
5679 self.iter().await?.try_collect().await
5680 }
5681 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
5682 let opt_row =
5683 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
5684 Ok(opt_row
5685 .map(|row| {
5686 let extracted = (self.extractor)(&row)?;
5687 Ok((self.mapper)(extracted))
5688 })
5689 .transpose()?)
5690 }
5691 pub async fn iter(
5692 self,
5693 ) -> Result<
5694 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
5695 tokio_postgres::Error,
5696 > {
5697 let stream = crate::client::async_::raw(
5698 self.client,
5699 self.query,
5700 crate::slice_iter(&self.params),
5701 self.cached,
5702 )
5703 .await?;
5704 let mapped = stream
5705 .map(move |res| {
5706 res.and_then(|row| {
5707 let extracted = (self.extractor)(&row)?;
5708 Ok((self.mapper)(extracted))
5709 })
5710 })
5711 .into_stream();
5712 Ok(mapped)
5713 }
5714}
5715pub struct ReflectPgTsTemplateQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
5716 client: &'c C,
5717 params: [&'a (dyn postgres_types::ToSql + Sync); N],
5718 query: &'static str,
5719 cached: Option<&'s tokio_postgres::Statement>,
5720 extractor:
5721 fn(&tokio_postgres::Row) -> Result<ReflectPgTsTemplateBorrowed, tokio_postgres::Error>,
5722 mapper: fn(ReflectPgTsTemplateBorrowed) -> T,
5723}
5724impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgTsTemplateQuery<'c, 'a, 's, C, T, N>
5725where
5726 C: GenericClient,
5727{
5728 pub fn map<R>(
5729 self,
5730 mapper: fn(ReflectPgTsTemplateBorrowed) -> R,
5731 ) -> ReflectPgTsTemplateQuery<'c, 'a, 's, C, R, N> {
5732 ReflectPgTsTemplateQuery {
5733 client: self.client,
5734 params: self.params,
5735 query: self.query,
5736 cached: self.cached,
5737 extractor: self.extractor,
5738 mapper,
5739 }
5740 }
5741 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
5742 let row =
5743 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
5744 Ok((self.mapper)((self.extractor)(&row)?))
5745 }
5746 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
5747 self.iter().await?.try_collect().await
5748 }
5749 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
5750 let opt_row =
5751 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
5752 Ok(opt_row
5753 .map(|row| {
5754 let extracted = (self.extractor)(&row)?;
5755 Ok((self.mapper)(extracted))
5756 })
5757 .transpose()?)
5758 }
5759 pub async fn iter(
5760 self,
5761 ) -> Result<
5762 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
5763 tokio_postgres::Error,
5764 > {
5765 let stream = crate::client::async_::raw(
5766 self.client,
5767 self.query,
5768 crate::slice_iter(&self.params),
5769 self.cached,
5770 )
5771 .await?;
5772 let mapped = stream
5773 .map(move |res| {
5774 res.and_then(|row| {
5775 let extracted = (self.extractor)(&row)?;
5776 Ok((self.mapper)(extracted))
5777 })
5778 })
5779 .into_stream();
5780 Ok(mapped)
5781 }
5782}
5783pub struct ReflectPgTypeQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
5784 client: &'c C,
5785 params: [&'a (dyn postgres_types::ToSql + Sync); N],
5786 query: &'static str,
5787 cached: Option<&'s tokio_postgres::Statement>,
5788 extractor: fn(&tokio_postgres::Row) -> Result<ReflectPgTypeBorrowed, tokio_postgres::Error>,
5789 mapper: fn(ReflectPgTypeBorrowed) -> T,
5790}
5791impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgTypeQuery<'c, 'a, 's, C, T, N>
5792where
5793 C: GenericClient,
5794{
5795 pub fn map<R>(
5796 self,
5797 mapper: fn(ReflectPgTypeBorrowed) -> R,
5798 ) -> ReflectPgTypeQuery<'c, 'a, 's, C, R, N> {
5799 ReflectPgTypeQuery {
5800 client: self.client,
5801 params: self.params,
5802 query: self.query,
5803 cached: self.cached,
5804 extractor: self.extractor,
5805 mapper,
5806 }
5807 }
5808 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
5809 let row =
5810 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
5811 Ok((self.mapper)((self.extractor)(&row)?))
5812 }
5813 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
5814 self.iter().await?.try_collect().await
5815 }
5816 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
5817 let opt_row =
5818 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
5819 Ok(opt_row
5820 .map(|row| {
5821 let extracted = (self.extractor)(&row)?;
5822 Ok((self.mapper)(extracted))
5823 })
5824 .transpose()?)
5825 }
5826 pub async fn iter(
5827 self,
5828 ) -> Result<
5829 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
5830 tokio_postgres::Error,
5831 > {
5832 let stream = crate::client::async_::raw(
5833 self.client,
5834 self.query,
5835 crate::slice_iter(&self.params),
5836 self.cached,
5837 )
5838 .await?;
5839 let mapped = stream
5840 .map(move |res| {
5841 res.and_then(|row| {
5842 let extracted = (self.extractor)(&row)?;
5843 Ok((self.mapper)(extracted))
5844 })
5845 })
5846 .into_stream();
5847 Ok(mapped)
5848 }
5849}
5850pub struct ReflectPgUserMappingsQuery<'c, 'a, 's, C: GenericClient, T, const N: usize> {
5851 client: &'c C,
5852 params: [&'a (dyn postgres_types::ToSql + Sync); N],
5853 query: &'static str,
5854 cached: Option<&'s tokio_postgres::Statement>,
5855 extractor:
5856 fn(&tokio_postgres::Row) -> Result<ReflectPgUserMappingsBorrowed, tokio_postgres::Error>,
5857 mapper: fn(ReflectPgUserMappingsBorrowed) -> T,
5858}
5859impl<'c, 'a, 's, C, T: 'c, const N: usize> ReflectPgUserMappingsQuery<'c, 'a, 's, C, T, N>
5860where
5861 C: GenericClient,
5862{
5863 pub fn map<R>(
5864 self,
5865 mapper: fn(ReflectPgUserMappingsBorrowed) -> R,
5866 ) -> ReflectPgUserMappingsQuery<'c, 'a, 's, C, R, N> {
5867 ReflectPgUserMappingsQuery {
5868 client: self.client,
5869 params: self.params,
5870 query: self.query,
5871 cached: self.cached,
5872 extractor: self.extractor,
5873 mapper,
5874 }
5875 }
5876 pub async fn one(self) -> Result<T, tokio_postgres::Error> {
5877 let row =
5878 crate::client::async_::one(self.client, self.query, &self.params, self.cached).await?;
5879 Ok((self.mapper)((self.extractor)(&row)?))
5880 }
5881 pub async fn all(self) -> Result<Vec<T>, tokio_postgres::Error> {
5882 self.iter().await?.try_collect().await
5883 }
5884 pub async fn opt(self) -> Result<Option<T>, tokio_postgres::Error> {
5885 let opt_row =
5886 crate::client::async_::opt(self.client, self.query, &self.params, self.cached).await?;
5887 Ok(opt_row
5888 .map(|row| {
5889 let extracted = (self.extractor)(&row)?;
5890 Ok((self.mapper)(extracted))
5891 })
5892 .transpose()?)
5893 }
5894 pub async fn iter(
5895 self,
5896 ) -> Result<
5897 impl futures::Stream<Item = Result<T, tokio_postgres::Error>> + 'c,
5898 tokio_postgres::Error,
5899 > {
5900 let stream = crate::client::async_::raw(
5901 self.client,
5902 self.query,
5903 crate::slice_iter(&self.params),
5904 self.cached,
5905 )
5906 .await?;
5907 let mapped = stream
5908 .map(move |res| {
5909 res.and_then(|row| {
5910 let extracted = (self.extractor)(&row)?;
5911 Ok((self.mapper)(extracted))
5912 })
5913 })
5914 .into_stream();
5915 Ok(mapped)
5916 }
5917}
5918pub struct ReflectPgAggregateStmt(&'static str, Option<tokio_postgres::Statement>);
5919pub fn reflect_pg_aggregate() -> ReflectPgAggregateStmt {
5920 ReflectPgAggregateStmt(
5921 "select aggfnoid::regprocedure::text as aggfnoid, pg_aggregate.aggkind as aggkind, pg_aggregate.aggnumdirectargs as aggnumdirectargs, aggtransfn::regprocedure::text as aggtransfn, case when aggfinalfn = 0 then null else aggfinalfn::regprocedure::text end as aggfinalfn, case when aggcombinefn = 0 then null else aggcombinefn::regprocedure::text end as aggcombinefn, case when aggserialfn = 0 then null else aggserialfn::regprocedure::text end as aggserialfn, case when aggdeserialfn = 0 then null else aggdeserialfn::regprocedure::text end as aggdeserialfn, case when aggmtransfn = 0 then null else aggmtransfn::regprocedure::text end as aggmtransfn, case when aggminvtransfn = 0 then null else aggminvtransfn::regprocedure::text end as aggminvtransfn, case when aggmfinalfn = 0 then null else aggmfinalfn::regprocedure::text end as aggmfinalfn, pg_aggregate.aggfinalextra as aggfinalextra, pg_aggregate.aggmfinalextra as aggmfinalextra, pg_aggregate.aggfinalmodify as aggfinalmodify, pg_aggregate.aggmfinalmodify as aggmfinalmodify, case when pg_aggregate.aggsortop = 0 then null else pg_aggregate.aggsortop::regoperator::text end as aggsortop, pg_aggregate.aggtranstype::regtype::text as aggtranstype, case when pg_aggregate.aggmtranstype = 0 then null else pg_aggregate.aggmtranstype::regtype::text end as aggmtranstype, pg_aggregate.agginitval as agginitval, pg_aggregate.aggminitval as aggminitval from pg_aggregate",
5922 None,
5923 )
5924}
5925impl ReflectPgAggregateStmt {
5926 pub async fn prepare<'a, C: GenericClient>(
5927 mut self,
5928 client: &'a C,
5929 ) -> Result<Self, tokio_postgres::Error> {
5930 self.1 = Some(client.prepare(self.0).await?);
5931 Ok(self)
5932 }
5933 pub fn bind<'c, 'a, 's, C: GenericClient>(
5934 &'s self,
5935 client: &'c C,
5936 ) -> ReflectPgAggregateQuery<'c, 'a, 's, C, ReflectPgAggregate, 0> {
5937 ReflectPgAggregateQuery {
5938 client,
5939 params: [],
5940 query: self.0,
5941 cached: self.1.as_ref(),
5942 extractor: |
5943 row: &tokio_postgres::Row,
5944 | -> Result<ReflectPgAggregateBorrowed, tokio_postgres::Error> {
5945 Ok(ReflectPgAggregateBorrowed {
5946 aggfnoid: row.try_get(0)?,
5947 aggkind: row.try_get(1)?,
5948 aggnumdirectargs: row.try_get(2)?,
5949 aggtransfn: row.try_get(3)?,
5950 aggfinalfn: row.try_get(4)?,
5951 aggcombinefn: row.try_get(5)?,
5952 aggserialfn: row.try_get(6)?,
5953 aggdeserialfn: row.try_get(7)?,
5954 aggmtransfn: row.try_get(8)?,
5955 aggminvtransfn: row.try_get(9)?,
5956 aggmfinalfn: row.try_get(10)?,
5957 aggfinalextra: row.try_get(11)?,
5958 aggmfinalextra: row.try_get(12)?,
5959 aggfinalmodify: row.try_get(13)?,
5960 aggmfinalmodify: row.try_get(14)?,
5961 aggsortop: row.try_get(15)?,
5962 aggtranstype: row.try_get(16)?,
5963 aggmtranstype: row.try_get(17)?,
5964 agginitval: row.try_get(18)?,
5965 aggminitval: row.try_get(19)?,
5966 })
5967 },
5968 mapper: |it| ReflectPgAggregate::from(it),
5969 }
5970 }
5971}
5972pub struct ReflectPgAmStmt(&'static str, Option<tokio_postgres::Statement>);
5973pub fn reflect_pg_am() -> ReflectPgAmStmt {
5974 ReflectPgAmStmt(
5975 "select pg_am.amname::text as amname, amhandler::regprocedure::text as amhandler, pg_am.amtype as amtype, pg_description.description as description from pg_am left join pg_description on pg_description.objoid = pg_am.oid and pg_description.objsubid = 0",
5976 None,
5977 )
5978}
5979impl ReflectPgAmStmt {
5980 pub async fn prepare<'a, C: GenericClient>(
5981 mut self,
5982 client: &'a C,
5983 ) -> Result<Self, tokio_postgres::Error> {
5984 self.1 = Some(client.prepare(self.0).await?);
5985 Ok(self)
5986 }
5987 pub fn bind<'c, 'a, 's, C: GenericClient>(
5988 &'s self,
5989 client: &'c C,
5990 ) -> ReflectPgAmQuery<'c, 'a, 's, C, ReflectPgAm, 0> {
5991 ReflectPgAmQuery {
5992 client,
5993 params: [],
5994 query: self.0,
5995 cached: self.1.as_ref(),
5996 extractor:
5997 |row: &tokio_postgres::Row| -> Result<ReflectPgAmBorrowed, tokio_postgres::Error> {
5998 Ok(ReflectPgAmBorrowed {
5999 amname: row.try_get(0)?,
6000 amhandler: row.try_get(1)?,
6001 amtype: row.try_get(2)?,
6002 description: row.try_get(3)?,
6003 })
6004 },
6005 mapper: |it| ReflectPgAm::from(it),
6006 }
6007 }
6008}
6009pub struct ReflectPgAmopStmt(&'static str, Option<tokio_postgres::Statement>);
6010pub fn reflect_pg_amop() -> ReflectPgAmopStmt {
6011 ReflectPgAmopStmt(
6012 "select pg_temp.quote_with_namespace(amopfamily_pg_namespace.nspname, amopfamily_pg_opfamily.opfname) as amopfamily, pg_amop.amoplefttype::regtype::text as amoplefttype, pg_amop.amoprighttype::regtype::text as amoprighttype, pg_amop.amopstrategy as amopstrategy, pg_amop.amoppurpose as amoppurpose, pg_amop.amopopr::regoperator::text as amopopr, amopmethod_pg_am.amname::text as amopmethod, pg_temp.quote_with_namespace(amopsortfamily_pg_namespace.nspname, amopsortfamily_pg_opfamily.opfname) as amopsortfamily from pg_amop join pg_opfamily as amopfamily_pg_opfamily on pg_amop.amopfamily = amopfamily_pg_opfamily.oid join pg_namespace as amopfamily_pg_namespace on amopfamily_pg_opfamily.opfnamespace = amopfamily_pg_namespace.oid join pg_am as amopmethod_pg_am on pg_amop.amopmethod = amopmethod_pg_am.oid left join pg_opfamily as amopsortfamily_pg_opfamily on pg_amop.amopsortfamily = amopsortfamily_pg_opfamily.oid left join pg_namespace as amopsortfamily_pg_namespace on amopsortfamily_pg_opfamily.opfnamespace = amopsortfamily_pg_namespace.oid",
6013 None,
6014 )
6015}
6016impl ReflectPgAmopStmt {
6017 pub async fn prepare<'a, C: GenericClient>(
6018 mut self,
6019 client: &'a C,
6020 ) -> Result<Self, tokio_postgres::Error> {
6021 self.1 = Some(client.prepare(self.0).await?);
6022 Ok(self)
6023 }
6024 pub fn bind<'c, 'a, 's, C: GenericClient>(
6025 &'s self,
6026 client: &'c C,
6027 ) -> ReflectPgAmopQuery<'c, 'a, 's, C, ReflectPgAmop, 0> {
6028 ReflectPgAmopQuery {
6029 client,
6030 params: [],
6031 query: self.0,
6032 cached: self.1.as_ref(),
6033 extractor:
6034 |row: &tokio_postgres::Row| -> Result<ReflectPgAmopBorrowed, tokio_postgres::Error> {
6035 Ok(ReflectPgAmopBorrowed {
6036 amopfamily: row.try_get(0)?,
6037 amoplefttype: row.try_get(1)?,
6038 amoprighttype: row.try_get(2)?,
6039 amopstrategy: row.try_get(3)?,
6040 amoppurpose: row.try_get(4)?,
6041 amopopr: row.try_get(5)?,
6042 amopmethod: row.try_get(6)?,
6043 amopsortfamily: row.try_get(7)?,
6044 })
6045 },
6046 mapper: |it| ReflectPgAmop::from(it),
6047 }
6048 }
6049}
6050pub struct ReflectPgAmprocStmt(&'static str, Option<tokio_postgres::Statement>);
6051pub fn reflect_pg_amproc() -> ReflectPgAmprocStmt {
6052 ReflectPgAmprocStmt(
6053 "select pg_temp.quote_with_namespace(amprocfamily_pg_namespace.nspname, amprocfamily_pg_opfamily.opfname) as amprocfamily, pg_amproc.amproclefttype::regtype::text as amproclefttype, pg_amproc.amprocrighttype::regtype::text as amprocrighttype, pg_amproc.amprocnum as amprocnum, amproc::regprocedure::text as amproc from pg_amproc join pg_opfamily as amprocfamily_pg_opfamily on pg_amproc.amprocfamily = amprocfamily_pg_opfamily.oid join pg_namespace as amprocfamily_pg_namespace on amprocfamily_pg_opfamily.opfnamespace = amprocfamily_pg_namespace.oid",
6054 None,
6055 )
6056}
6057impl ReflectPgAmprocStmt {
6058 pub async fn prepare<'a, C: GenericClient>(
6059 mut self,
6060 client: &'a C,
6061 ) -> Result<Self, tokio_postgres::Error> {
6062 self.1 = Some(client.prepare(self.0).await?);
6063 Ok(self)
6064 }
6065 pub fn bind<'c, 'a, 's, C: GenericClient>(
6066 &'s self,
6067 client: &'c C,
6068 ) -> ReflectPgAmprocQuery<'c, 'a, 's, C, ReflectPgAmproc, 0> {
6069 ReflectPgAmprocQuery {
6070 client,
6071 params: [],
6072 query: self.0,
6073 cached: self.1.as_ref(),
6074 extractor: |
6075 row: &tokio_postgres::Row,
6076 | -> Result<ReflectPgAmprocBorrowed, tokio_postgres::Error> {
6077 Ok(ReflectPgAmprocBorrowed {
6078 amprocfamily: row.try_get(0)?,
6079 amproclefttype: row.try_get(1)?,
6080 amprocrighttype: row.try_get(2)?,
6081 amprocnum: row.try_get(3)?,
6082 amproc: row.try_get(4)?,
6083 })
6084 },
6085 mapper: |it| ReflectPgAmproc::from(it),
6086 }
6087 }
6088}
6089pub struct ReflectPgAttrdefStmt(&'static str, Option<tokio_postgres::Statement>);
6090pub fn reflect_pg_attrdef() -> ReflectPgAttrdefStmt {
6091 ReflectPgAttrdefStmt(
6092 "select pg_attrdef.adrelid::regclass::text as adrelid, pg_attrdef.adnum as adnum, pg_get_expr(pg_attrdef.adbin, pg_attrdef.adrelid) as adbin from pg_attrdef where adnum > 0",
6093 None,
6094 )
6095}
6096impl ReflectPgAttrdefStmt {
6097 pub async fn prepare<'a, C: GenericClient>(
6098 mut self,
6099 client: &'a C,
6100 ) -> Result<Self, tokio_postgres::Error> {
6101 self.1 = Some(client.prepare(self.0).await?);
6102 Ok(self)
6103 }
6104 pub fn bind<'c, 'a, 's, C: GenericClient>(
6105 &'s self,
6106 client: &'c C,
6107 ) -> ReflectPgAttrdefQuery<'c, 'a, 's, C, ReflectPgAttrdef, 0> {
6108 ReflectPgAttrdefQuery {
6109 client,
6110 params: [],
6111 query: self.0,
6112 cached: self.1.as_ref(),
6113 extractor: |
6114 row: &tokio_postgres::Row,
6115 | -> Result<ReflectPgAttrdefBorrowed, tokio_postgres::Error> {
6116 Ok(ReflectPgAttrdefBorrowed {
6117 adrelid: row.try_get(0)?,
6118 adnum: row.try_get(1)?,
6119 adbin: row.try_get(2)?,
6120 })
6121 },
6122 mapper: |it| ReflectPgAttrdef::from(it),
6123 }
6124 }
6125}
6126pub struct ReflectPgAttributeStmt(&'static str, Option<tokio_postgres::Statement>);
6127pub fn reflect_pg_attribute() -> ReflectPgAttributeStmt {
6128 ReflectPgAttributeStmt(
6129 "select pg_attribute.attrelid::regclass::text as attrelid, pg_attribute.attname::text as attname, case when pg_attribute.atttypid = 0 then null else pg_attribute.atttypid::regtype::text end as atttypid, pg_attribute.attnum as attnum, case when atttypmod < 0 then null else atttypmod end as atttypmod, pg_attribute.attndims as attndims, case when pg_attribute.attcompression = '' then null else pg_attribute.attcompression end as attcompression, pg_attribute.attnotnull as attnotnull, pg_attribute.atthasdef as atthasdef, case when pg_attribute.attidentity = '' then null else pg_attribute.attidentity end as attidentity, case when pg_attribute.attgenerated = '' then null else pg_attribute.attgenerated end as attgenerated, pg_attribute.attisdropped as attisdropped, pg_attribute.attislocal as attislocal, pg_attribute.attinhcount as attinhcount, case when pg_attribute.attcollation = 0 then null else pg_attribute.attcollation::regcollation::text end as attcollation, pg_attribute.attstattarget as attstattarget, pg_temp.format_tablecolumn_aclitems(pg_attribute.attacl) as attacl, pg_attribute.attoptions as attoptions, pg_attribute.attfdwoptions as attfdwoptions, pg_description.description as description, pg_seclabel.label as seclabel, pg_seclabel.provider as seclabel_provider, pg_temp.format_tablecolumn_aclitems(pg_init_privs.initprivs) as initprivs, pg_init_privs.privtype as initprivs_type from pg_attribute left join pg_description on pg_description.objoid = pg_attribute.attrelid and pg_description.objsubid = pg_attribute.attnum left join pg_seclabel on pg_seclabel.objoid = pg_attribute.attrelid and pg_seclabel.objsubid = pg_attribute.attnum left join pg_init_privs on pg_init_privs.objoid = pg_attribute.attrelid and pg_init_privs.objsubid = pg_attribute.attnum where not starts_with(pg_attribute.attrelid::regclass::text, 'pg_toast') and attnum > 0 and not pg_attribute.attisdropped",
6130 None,
6131 )
6132}
6133impl ReflectPgAttributeStmt {
6134 pub async fn prepare<'a, C: GenericClient>(
6135 mut self,
6136 client: &'a C,
6137 ) -> Result<Self, tokio_postgres::Error> {
6138 self.1 = Some(client.prepare(self.0).await?);
6139 Ok(self)
6140 }
6141 pub fn bind<'c, 'a, 's, C: GenericClient>(
6142 &'s self,
6143 client: &'c C,
6144 ) -> ReflectPgAttributeQuery<'c, 'a, 's, C, ReflectPgAttribute, 0> {
6145 ReflectPgAttributeQuery {
6146 client,
6147 params: [],
6148 query: self.0,
6149 cached: self.1.as_ref(),
6150 extractor: |
6151 row: &tokio_postgres::Row,
6152 | -> Result<ReflectPgAttributeBorrowed, tokio_postgres::Error> {
6153 Ok(ReflectPgAttributeBorrowed {
6154 attrelid: row.try_get(0)?,
6155 attname: row.try_get(1)?,
6156 atttypid: row.try_get(2)?,
6157 attnum: row.try_get(3)?,
6158 atttypmod: row.try_get(4)?,
6159 attndims: row.try_get(5)?,
6160 attcompression: row.try_get(6)?,
6161 attnotnull: row.try_get(7)?,
6162 atthasdef: row.try_get(8)?,
6163 attidentity: row.try_get(9)?,
6164 attgenerated: row.try_get(10)?,
6165 attisdropped: row.try_get(11)?,
6166 attislocal: row.try_get(12)?,
6167 attinhcount: row.try_get(13)?,
6168 attcollation: row.try_get(14)?,
6169 attstattarget: row.try_get(15)?,
6170 attacl: row.try_get(16)?,
6171 attoptions: row.try_get(17)?,
6172 attfdwoptions: row.try_get(18)?,
6173 description: row.try_get(19)?,
6174 seclabel: row.try_get(20)?,
6175 seclabel_provider: row.try_get(21)?,
6176 initprivs: row.try_get(22)?,
6177 initprivs_type: row.try_get(23)?,
6178 })
6179 },
6180 mapper: |it| ReflectPgAttribute::from(it),
6181 }
6182 }
6183}
6184pub struct ReflectPgRolesStmt(&'static str, Option<tokio_postgres::Statement>);
6185pub fn reflect_pg_roles() -> ReflectPgRolesStmt {
6186 ReflectPgRolesStmt(
6187 "select pg_roles.rolname::text as rolname, pg_roles.rolsuper as rolsuper, pg_roles.rolinherit as rolinherit, pg_roles.rolcreaterole as rolcreaterole, pg_roles.rolcreatedb as rolcreatedb, pg_roles.rolcanlogin as rolcanlogin, pg_roles.rolreplication as rolreplication, case when rolconnlimit < 0 then null else rolconnlimit end as rolconnlimit, pg_roles.rolvaliduntil as rolvaliduntil, pg_roles.rolbypassrls as rolbypassrls, pg_roles.rolconfig as rolconfig, pg_shdescription.description as description, pg_shseclabel.label as seclabel, pg_shseclabel.provider as seclabel_provider from pg_roles left join pg_shdescription on pg_shdescription.objoid = pg_roles.oid left join pg_shseclabel on pg_shseclabel.objoid = pg_roles.oid",
6188 None,
6189 )
6190}
6191impl ReflectPgRolesStmt {
6192 pub async fn prepare<'a, C: GenericClient>(
6193 mut self,
6194 client: &'a C,
6195 ) -> Result<Self, tokio_postgres::Error> {
6196 self.1 = Some(client.prepare(self.0).await?);
6197 Ok(self)
6198 }
6199 pub fn bind<'c, 'a, 's, C: GenericClient>(
6200 &'s self,
6201 client: &'c C,
6202 ) -> ReflectPgRolesQuery<'c, 'a, 's, C, ReflectPgRoles, 0> {
6203 ReflectPgRolesQuery {
6204 client,
6205 params: [],
6206 query: self.0,
6207 cached: self.1.as_ref(),
6208 extractor: |
6209 row: &tokio_postgres::Row,
6210 | -> Result<ReflectPgRolesBorrowed, tokio_postgres::Error> {
6211 Ok(ReflectPgRolesBorrowed {
6212 rolname: row.try_get(0)?,
6213 rolsuper: row.try_get(1)?,
6214 rolinherit: row.try_get(2)?,
6215 rolcreaterole: row.try_get(3)?,
6216 rolcreatedb: row.try_get(4)?,
6217 rolcanlogin: row.try_get(5)?,
6218 rolreplication: row.try_get(6)?,
6219 rolconnlimit: row.try_get(7)?,
6220 rolvaliduntil: row.try_get(8)?,
6221 rolbypassrls: row.try_get(9)?,
6222 rolconfig: row.try_get(10)?,
6223 description: row.try_get(11)?,
6224 seclabel: row.try_get(12)?,
6225 seclabel_provider: row.try_get(13)?,
6226 })
6227 },
6228 mapper: |it| ReflectPgRoles::from(it),
6229 }
6230 }
6231}
6232pub struct ReflectPgAuthMembersStmt(&'static str, Option<tokio_postgres::Statement>);
6233pub fn reflect_pg_auth_members() -> ReflectPgAuthMembersStmt {
6234 ReflectPgAuthMembersStmt(
6235 "select pg_get_userbyid(pg_auth_members.roleid)::text as roleid, pg_get_userbyid(pg_auth_members.member)::text as member, pg_get_userbyid(pg_auth_members.grantor)::text as grantor, pg_auth_members.admin_option as admin_option, pg_auth_members.inherit_option as inherit_option, pg_auth_members.set_option as set_option from pg_auth_members",
6236 None,
6237 )
6238}
6239impl ReflectPgAuthMembersStmt {
6240 pub async fn prepare<'a, C: GenericClient>(
6241 mut self,
6242 client: &'a C,
6243 ) -> Result<Self, tokio_postgres::Error> {
6244 self.1 = Some(client.prepare(self.0).await?);
6245 Ok(self)
6246 }
6247 pub fn bind<'c, 'a, 's, C: GenericClient>(
6248 &'s self,
6249 client: &'c C,
6250 ) -> ReflectPgAuthMembersQuery<'c, 'a, 's, C, ReflectPgAuthMembers, 0> {
6251 ReflectPgAuthMembersQuery {
6252 client,
6253 params: [],
6254 query: self.0,
6255 cached: self.1.as_ref(),
6256 extractor: |
6257 row: &tokio_postgres::Row,
6258 | -> Result<ReflectPgAuthMembersBorrowed, tokio_postgres::Error> {
6259 Ok(ReflectPgAuthMembersBorrowed {
6260 roleid: row.try_get(0)?,
6261 member: row.try_get(1)?,
6262 grantor: row.try_get(2)?,
6263 admin_option: row.try_get(3)?,
6264 inherit_option: row.try_get(4)?,
6265 set_option: row.try_get(5)?,
6266 })
6267 },
6268 mapper: |it| ReflectPgAuthMembers::from(it),
6269 }
6270 }
6271}
6272pub struct ReflectPgCastStmt(&'static str, Option<tokio_postgres::Statement>);
6273pub fn reflect_pg_cast() -> ReflectPgCastStmt {
6274 ReflectPgCastStmt(
6275 "select pg_cast.castsource::regtype::text as castsource, pg_cast.casttarget::regtype::text as casttarget, case when pg_cast.castfunc = 0 then null else pg_cast.castfunc::regprocedure::text end as castfunc, pg_cast.castcontext as castcontext, pg_cast.castmethod as castmethod, pg_description.description as description from pg_cast left join pg_description on pg_description.objoid = pg_cast.oid and pg_description.objsubid = 0",
6276 None,
6277 )
6278}
6279impl ReflectPgCastStmt {
6280 pub async fn prepare<'a, C: GenericClient>(
6281 mut self,
6282 client: &'a C,
6283 ) -> Result<Self, tokio_postgres::Error> {
6284 self.1 = Some(client.prepare(self.0).await?);
6285 Ok(self)
6286 }
6287 pub fn bind<'c, 'a, 's, C: GenericClient>(
6288 &'s self,
6289 client: &'c C,
6290 ) -> ReflectPgCastQuery<'c, 'a, 's, C, ReflectPgCast, 0> {
6291 ReflectPgCastQuery {
6292 client,
6293 params: [],
6294 query: self.0,
6295 cached: self.1.as_ref(),
6296 extractor:
6297 |row: &tokio_postgres::Row| -> Result<ReflectPgCastBorrowed, tokio_postgres::Error> {
6298 Ok(ReflectPgCastBorrowed {
6299 castsource: row.try_get(0)?,
6300 casttarget: row.try_get(1)?,
6301 castfunc: row.try_get(2)?,
6302 castcontext: row.try_get(3)?,
6303 castmethod: row.try_get(4)?,
6304 description: row.try_get(5)?,
6305 })
6306 },
6307 mapper: |it| ReflectPgCast::from(it),
6308 }
6309 }
6310}
6311pub struct ReflectPgClassStmt(&'static str, Option<tokio_postgres::Statement>);
6312pub fn reflect_pg_class() -> ReflectPgClassStmt {
6313 ReflectPgClassStmt(
6314 "select pg_class.oid::regclass::text as oid, pg_class.relname::text as relname, pg_class.relnamespace::regnamespace::text as relnamespace, case when pg_class.reltype = 0 then null else pg_class.reltype::regtype::text end as reltype, case when pg_class.reloftype = 0 then null else pg_class.reloftype::regtype::text end as reloftype, pg_get_userbyid(pg_class.relowner)::text as relowner, relam_pg_am.amname::text as relam, pg_class.relisshared as relisshared, pg_class.relpersistence as relpersistence, pg_class.relkind as relkind, pg_class.relnatts as relnatts, pg_class.relchecks as relchecks, pg_class.relrowsecurity as relrowsecurity, pg_class.relforcerowsecurity as relforcerowsecurity, pg_class.relreplident as relreplident, pg_class.relispartition as relispartition, pg_temp.format_table_aclitems(pg_class.relacl) as relacl, pg_class.reloptions as reloptions, pg_get_expr(relpartbound, pg_class.oid) as relpartbound, pg_description.description as description, pg_seclabel.label as seclabel, pg_seclabel.provider as seclabel_provider, pg_temp.format_table_aclitems(pg_init_privs.initprivs) as initprivs, pg_init_privs.privtype as initprivs_type from pg_class left join pg_am as relam_pg_am on pg_class.relam = relam_pg_am.oid left join pg_description on pg_description.objoid = pg_class.oid and pg_description.objsubid = 0 left join pg_seclabel on pg_seclabel.objoid = pg_class.oid and pg_seclabel.objsubid = 0 left join pg_init_privs on pg_init_privs.objoid = pg_class.oid and pg_init_privs.objsubid = 0 where relnamespace::regnamespace != 'pg_toast'::regnamespace",
6315 None,
6316 )
6317}
6318impl ReflectPgClassStmt {
6319 pub async fn prepare<'a, C: GenericClient>(
6320 mut self,
6321 client: &'a C,
6322 ) -> Result<Self, tokio_postgres::Error> {
6323 self.1 = Some(client.prepare(self.0).await?);
6324 Ok(self)
6325 }
6326 pub fn bind<'c, 'a, 's, C: GenericClient>(
6327 &'s self,
6328 client: &'c C,
6329 ) -> ReflectPgClassQuery<'c, 'a, 's, C, ReflectPgClass, 0> {
6330 ReflectPgClassQuery {
6331 client,
6332 params: [],
6333 query: self.0,
6334 cached: self.1.as_ref(),
6335 extractor: |
6336 row: &tokio_postgres::Row,
6337 | -> Result<ReflectPgClassBorrowed, tokio_postgres::Error> {
6338 Ok(ReflectPgClassBorrowed {
6339 oid: row.try_get(0)?,
6340 relname: row.try_get(1)?,
6341 relnamespace: row.try_get(2)?,
6342 reltype: row.try_get(3)?,
6343 reloftype: row.try_get(4)?,
6344 relowner: row.try_get(5)?,
6345 relam: row.try_get(6)?,
6346 relisshared: row.try_get(7)?,
6347 relpersistence: row.try_get(8)?,
6348 relkind: row.try_get(9)?,
6349 relnatts: row.try_get(10)?,
6350 relchecks: row.try_get(11)?,
6351 relrowsecurity: row.try_get(12)?,
6352 relforcerowsecurity: row.try_get(13)?,
6353 relreplident: row.try_get(14)?,
6354 relispartition: row.try_get(15)?,
6355 relacl: row.try_get(16)?,
6356 reloptions: row.try_get(17)?,
6357 relpartbound: row.try_get(18)?,
6358 description: row.try_get(19)?,
6359 seclabel: row.try_get(20)?,
6360 seclabel_provider: row.try_get(21)?,
6361 initprivs: row.try_get(22)?,
6362 initprivs_type: row.try_get(23)?,
6363 })
6364 },
6365 mapper: |it| ReflectPgClass::from(it),
6366 }
6367 }
6368}
6369pub struct ReflectPgCollationStmt(&'static str, Option<tokio_postgres::Statement>);
6370pub fn reflect_pg_collation() -> ReflectPgCollationStmt {
6371 ReflectPgCollationStmt(
6372 "select pg_collation.oid::regcollation::text as oid, pg_collation.collname::text as collname, pg_collation.collnamespace::regnamespace::text as collnamespace, pg_get_userbyid(pg_collation.collowner)::text as collowner, pg_collation.collprovider as collprovider, pg_collation.collisdeterministic as collisdeterministic, case when collencoding < 0 then null else pg_encoding_to_char(collencoding)::text end as collencoding, pg_collation.collcollate as collcollate, pg_collation.collctype as collctype, pg_collation.colllocale as colllocale, pg_collation.collicurules as collicurules, pg_description.description as description from pg_collation left join pg_description on pg_description.objoid = pg_collation.oid and pg_description.objsubid = 0",
6373 None,
6374 )
6375}
6376impl ReflectPgCollationStmt {
6377 pub async fn prepare<'a, C: GenericClient>(
6378 mut self,
6379 client: &'a C,
6380 ) -> Result<Self, tokio_postgres::Error> {
6381 self.1 = Some(client.prepare(self.0).await?);
6382 Ok(self)
6383 }
6384 pub fn bind<'c, 'a, 's, C: GenericClient>(
6385 &'s self,
6386 client: &'c C,
6387 ) -> ReflectPgCollationQuery<'c, 'a, 's, C, ReflectPgCollation, 0> {
6388 ReflectPgCollationQuery {
6389 client,
6390 params: [],
6391 query: self.0,
6392 cached: self.1.as_ref(),
6393 extractor: |
6394 row: &tokio_postgres::Row,
6395 | -> Result<ReflectPgCollationBorrowed, tokio_postgres::Error> {
6396 Ok(ReflectPgCollationBorrowed {
6397 oid: row.try_get(0)?,
6398 collname: row.try_get(1)?,
6399 collnamespace: row.try_get(2)?,
6400 collowner: row.try_get(3)?,
6401 collprovider: row.try_get(4)?,
6402 collisdeterministic: row.try_get(5)?,
6403 collencoding: row.try_get(6)?,
6404 collcollate: row.try_get(7)?,
6405 collctype: row.try_get(8)?,
6406 colllocale: row.try_get(9)?,
6407 collicurules: row.try_get(10)?,
6408 description: row.try_get(11)?,
6409 })
6410 },
6411 mapper: |it| ReflectPgCollation::from(it),
6412 }
6413 }
6414}
6415pub struct ReflectPgConstraintStmt(&'static str, Option<tokio_postgres::Statement>);
6416pub fn reflect_pg_constraint() -> ReflectPgConstraintStmt {
6417 ReflectPgConstraintStmt(
6418 "select pg_constraint.conname::text as conname, pg_constraint.connamespace::regnamespace::text as connamespace, pg_constraint.contype as contype, pg_constraint.condeferrable as condeferrable, pg_constraint.condeferred as condeferred, pg_constraint.convalidated as convalidated, case when pg_constraint.conrelid = 0 then null else pg_constraint.conrelid::regclass::text end as conrelid, case when pg_constraint.contypid = 0 then null else pg_constraint.contypid::regtype::text end as contypid, case when pg_constraint.conindid = 0 then null else pg_constraint.conindid::regclass::text end as conindid, pg_temp.quote_with_namespace(conparentid_pg_namespace.nspname, conparentid_pg_constraint.conname) as conparentid, case when pg_constraint.confrelid = 0 then null else pg_constraint.confrelid::regclass::text end as confrelid, case when pg_constraint.confupdtype = ' ' then null else pg_constraint.confupdtype end as confupdtype, case when pg_constraint.confdeltype = ' ' then null else pg_constraint.confdeltype end as confdeltype, case when pg_constraint.confmatchtype = ' ' then null else pg_constraint.confmatchtype end as confmatchtype, pg_constraint.conislocal as conislocal, pg_constraint.coninhcount as coninhcount, pg_constraint.connoinherit as connoinherit, pg_constraint.conkey as conkey, pg_constraint.confkey as confkey, pg_constraint.conpfeqop::regoperator[]::text[] as conpfeqop, pg_constraint.conppeqop::regoperator[]::text[] as conppeqop, pg_constraint.conffeqop::regoperator[]::text[] as conffeqop, pg_constraint.confdelsetcols as confdelsetcols, pg_constraint.conexclop::regoperator[]::text[] as conexclop, pg_get_expr(pg_constraint.conbin, pg_constraint.conrelid) as conbin, pg_description.description as description from pg_constraint left join pg_constraint as conparentid_pg_constraint on pg_constraint.conparentid = conparentid_pg_constraint.oid left join pg_namespace as conparentid_pg_namespace on conparentid_pg_constraint.connamespace = conparentid_pg_namespace.oid left join pg_description on pg_description.objoid = pg_constraint.oid and pg_description.objsubid = 0 where (pg_constraint.conkey is null or not (0 >= any(pg_constraint.conkey))) and (pg_constraint.confkey is null or not (0 >= any(pg_constraint.confkey))) and (pg_constraint.confdelsetcols is null or not (0 >= any(pg_constraint.confdelsetcols)))",
6419 None,
6420 )
6421}
6422impl ReflectPgConstraintStmt {
6423 pub async fn prepare<'a, C: GenericClient>(
6424 mut self,
6425 client: &'a C,
6426 ) -> Result<Self, tokio_postgres::Error> {
6427 self.1 = Some(client.prepare(self.0).await?);
6428 Ok(self)
6429 }
6430 pub fn bind<'c, 'a, 's, C: GenericClient>(
6431 &'s self,
6432 client: &'c C,
6433 ) -> ReflectPgConstraintQuery<'c, 'a, 's, C, ReflectPgConstraint, 0> {
6434 ReflectPgConstraintQuery {
6435 client,
6436 params: [],
6437 query: self.0,
6438 cached: self.1.as_ref(),
6439 extractor: |
6440 row: &tokio_postgres::Row,
6441 | -> Result<ReflectPgConstraintBorrowed, tokio_postgres::Error> {
6442 Ok(ReflectPgConstraintBorrowed {
6443 conname: row.try_get(0)?,
6444 connamespace: row.try_get(1)?,
6445 contype: row.try_get(2)?,
6446 condeferrable: row.try_get(3)?,
6447 condeferred: row.try_get(4)?,
6448 convalidated: row.try_get(5)?,
6449 conrelid: row.try_get(6)?,
6450 contypid: row.try_get(7)?,
6451 conindid: row.try_get(8)?,
6452 conparentid: row.try_get(9)?,
6453 confrelid: row.try_get(10)?,
6454 confupdtype: row.try_get(11)?,
6455 confdeltype: row.try_get(12)?,
6456 confmatchtype: row.try_get(13)?,
6457 conislocal: row.try_get(14)?,
6458 coninhcount: row.try_get(15)?,
6459 connoinherit: row.try_get(16)?,
6460 conkey: row.try_get(17)?,
6461 confkey: row.try_get(18)?,
6462 conpfeqop: row.try_get(19)?,
6463 conppeqop: row.try_get(20)?,
6464 conffeqop: row.try_get(21)?,
6465 confdelsetcols: row.try_get(22)?,
6466 conexclop: row.try_get(23)?,
6467 conbin: row.try_get(24)?,
6468 description: row.try_get(25)?,
6469 })
6470 },
6471 mapper: |it| ReflectPgConstraint::from(it),
6472 }
6473 }
6474}
6475pub struct ReflectPgConversionStmt(&'static str, Option<tokio_postgres::Statement>);
6476pub fn reflect_pg_conversion() -> ReflectPgConversionStmt {
6477 ReflectPgConversionStmt(
6478 "select pg_conversion.conname::text as conname, pg_conversion.connamespace::regnamespace::text as connamespace, pg_get_userbyid(pg_conversion.conowner)::text as conowner, pg_encoding_to_char(conforencoding)::text as conforencoding, pg_encoding_to_char(contoencoding)::text as contoencoding, conproc::regprocedure::text as conproc, pg_conversion.condefault as condefault, pg_description.description as description from pg_conversion left join pg_description on pg_description.objoid = pg_conversion.oid and pg_description.objsubid = 0",
6479 None,
6480 )
6481}
6482impl ReflectPgConversionStmt {
6483 pub async fn prepare<'a, C: GenericClient>(
6484 mut self,
6485 client: &'a C,
6486 ) -> Result<Self, tokio_postgres::Error> {
6487 self.1 = Some(client.prepare(self.0).await?);
6488 Ok(self)
6489 }
6490 pub fn bind<'c, 'a, 's, C: GenericClient>(
6491 &'s self,
6492 client: &'c C,
6493 ) -> ReflectPgConversionQuery<'c, 'a, 's, C, ReflectPgConversion, 0> {
6494 ReflectPgConversionQuery {
6495 client,
6496 params: [],
6497 query: self.0,
6498 cached: self.1.as_ref(),
6499 extractor: |
6500 row: &tokio_postgres::Row,
6501 | -> Result<ReflectPgConversionBorrowed, tokio_postgres::Error> {
6502 Ok(ReflectPgConversionBorrowed {
6503 conname: row.try_get(0)?,
6504 connamespace: row.try_get(1)?,
6505 conowner: row.try_get(2)?,
6506 conforencoding: row.try_get(3)?,
6507 contoencoding: row.try_get(4)?,
6508 conproc: row.try_get(5)?,
6509 condefault: row.try_get(6)?,
6510 description: row.try_get(7)?,
6511 })
6512 },
6513 mapper: |it| ReflectPgConversion::from(it),
6514 }
6515 }
6516}
6517pub struct ReflectPgDatabaseStmt(&'static str, Option<tokio_postgres::Statement>);
6518pub fn reflect_pg_database() -> ReflectPgDatabaseStmt {
6519 ReflectPgDatabaseStmt(
6520 "select pg_database.datname::text as datname, pg_get_userbyid(pg_database.datdba)::text as datdba, pg_encoding_to_char(encoding)::text as encoding, pg_database.datlocprovider as datlocprovider, pg_database.datistemplate as datistemplate, pg_database.datallowconn as datallowconn, case when datconnlimit < 0 then null else datconnlimit end as datconnlimit, pg_database.datcollate as datcollate, pg_database.datctype as datctype, pg_database.datlocale as datlocale, pg_database.daticurules as daticurules, pg_temp.format_db_aclitems(pg_database.datacl) as datacl, pg_shdescription.description as description, pg_shseclabel.label as seclabel, pg_shseclabel.provider as seclabel_provider from pg_database left join pg_shdescription on pg_shdescription.objoid = pg_database.oid left join pg_shseclabel on pg_shseclabel.objoid = pg_database.oid where pg_database.datname = current_database()",
6521 None,
6522 )
6523}
6524impl ReflectPgDatabaseStmt {
6525 pub async fn prepare<'a, C: GenericClient>(
6526 mut self,
6527 client: &'a C,
6528 ) -> Result<Self, tokio_postgres::Error> {
6529 self.1 = Some(client.prepare(self.0).await?);
6530 Ok(self)
6531 }
6532 pub fn bind<'c, 'a, 's, C: GenericClient>(
6533 &'s self,
6534 client: &'c C,
6535 ) -> ReflectPgDatabaseQuery<'c, 'a, 's, C, ReflectPgDatabase, 0> {
6536 ReflectPgDatabaseQuery {
6537 client,
6538 params: [],
6539 query: self.0,
6540 cached: self.1.as_ref(),
6541 extractor: |
6542 row: &tokio_postgres::Row,
6543 | -> Result<ReflectPgDatabaseBorrowed, tokio_postgres::Error> {
6544 Ok(ReflectPgDatabaseBorrowed {
6545 datname: row.try_get(0)?,
6546 datdba: row.try_get(1)?,
6547 encoding: row.try_get(2)?,
6548 datlocprovider: row.try_get(3)?,
6549 datistemplate: row.try_get(4)?,
6550 datallowconn: row.try_get(5)?,
6551 datconnlimit: row.try_get(6)?,
6552 datcollate: row.try_get(7)?,
6553 datctype: row.try_get(8)?,
6554 datlocale: row.try_get(9)?,
6555 daticurules: row.try_get(10)?,
6556 datacl: row.try_get(11)?,
6557 description: row.try_get(12)?,
6558 seclabel: row.try_get(13)?,
6559 seclabel_provider: row.try_get(14)?,
6560 })
6561 },
6562 mapper: |it| ReflectPgDatabase::from(it),
6563 }
6564 }
6565}
6566pub struct ReflectPgDefaultAclStmt(&'static str, Option<tokio_postgres::Statement>);
6567pub fn reflect_pg_default_acl() -> ReflectPgDefaultAclStmt {
6568 ReflectPgDefaultAclStmt(
6569 "select pg_get_userbyid(pg_default_acl.defaclrole)::text as defaclrole, case when pg_default_acl.defaclnamespace = 0 then null else pg_default_acl.defaclnamespace::regnamespace::text end as defaclnamespace, pg_default_acl.defaclobjtype as defaclobjtype, pg_temp.format_acldefault_aclitems(pg_default_acl.defaclacl) as defaclacl from pg_default_acl",
6570 None,
6571 )
6572}
6573impl ReflectPgDefaultAclStmt {
6574 pub async fn prepare<'a, C: GenericClient>(
6575 mut self,
6576 client: &'a C,
6577 ) -> Result<Self, tokio_postgres::Error> {
6578 self.1 = Some(client.prepare(self.0).await?);
6579 Ok(self)
6580 }
6581 pub fn bind<'c, 'a, 's, C: GenericClient>(
6582 &'s self,
6583 client: &'c C,
6584 ) -> ReflectPgDefaultAclQuery<'c, 'a, 's, C, ReflectPgDefaultAcl, 0> {
6585 ReflectPgDefaultAclQuery {
6586 client,
6587 params: [],
6588 query: self.0,
6589 cached: self.1.as_ref(),
6590 extractor: |
6591 row: &tokio_postgres::Row,
6592 | -> Result<ReflectPgDefaultAclBorrowed, tokio_postgres::Error> {
6593 Ok(ReflectPgDefaultAclBorrowed {
6594 defaclrole: row.try_get(0)?,
6595 defaclnamespace: row.try_get(1)?,
6596 defaclobjtype: row.try_get(2)?,
6597 defaclacl: row.try_get(3)?,
6598 })
6599 },
6600 mapper: |it| ReflectPgDefaultAcl::from(it),
6601 }
6602 }
6603}
6604pub struct ReflectPgEventTriggerStmt(&'static str, Option<tokio_postgres::Statement>);
6605pub fn reflect_pg_event_trigger() -> ReflectPgEventTriggerStmt {
6606 ReflectPgEventTriggerStmt(
6607 "select pg_event_trigger.evtname::text as evtname, pg_event_trigger.evtevent::text as evtevent, pg_get_userbyid(pg_event_trigger.evtowner)::text as evtowner, pg_event_trigger.evtfoid::regprocedure::text as evtfoid, pg_event_trigger.evtenabled as evtenabled, pg_event_trigger.evttags as evttags, pg_description.description as description, pg_seclabel.label as seclabel, pg_seclabel.provider as seclabel_provider from pg_event_trigger left join pg_description on pg_description.objoid = pg_event_trigger.oid and pg_description.objsubid = 0 left join pg_seclabel on pg_seclabel.objoid = pg_event_trigger.oid and pg_seclabel.objsubid = 0",
6608 None,
6609 )
6610}
6611impl ReflectPgEventTriggerStmt {
6612 pub async fn prepare<'a, C: GenericClient>(
6613 mut self,
6614 client: &'a C,
6615 ) -> Result<Self, tokio_postgres::Error> {
6616 self.1 = Some(client.prepare(self.0).await?);
6617 Ok(self)
6618 }
6619 pub fn bind<'c, 'a, 's, C: GenericClient>(
6620 &'s self,
6621 client: &'c C,
6622 ) -> ReflectPgEventTriggerQuery<'c, 'a, 's, C, ReflectPgEventTrigger, 0> {
6623 ReflectPgEventTriggerQuery {
6624 client,
6625 params: [],
6626 query: self.0,
6627 cached: self.1.as_ref(),
6628 extractor: |
6629 row: &tokio_postgres::Row,
6630 | -> Result<ReflectPgEventTriggerBorrowed, tokio_postgres::Error> {
6631 Ok(ReflectPgEventTriggerBorrowed {
6632 evtname: row.try_get(0)?,
6633 evtevent: row.try_get(1)?,
6634 evtowner: row.try_get(2)?,
6635 evtfoid: row.try_get(3)?,
6636 evtenabled: row.try_get(4)?,
6637 evttags: row.try_get(5)?,
6638 description: row.try_get(6)?,
6639 seclabel: row.try_get(7)?,
6640 seclabel_provider: row.try_get(8)?,
6641 })
6642 },
6643 mapper: |it| ReflectPgEventTrigger::from(it),
6644 }
6645 }
6646}
6647pub struct ReflectPgExtensionStmt(&'static str, Option<tokio_postgres::Statement>);
6648pub fn reflect_pg_extension() -> ReflectPgExtensionStmt {
6649 ReflectPgExtensionStmt(
6650 "select pg_extension.extname::text as extname, pg_get_userbyid(pg_extension.extowner)::text as extowner, pg_extension.extnamespace::regnamespace::text as extnamespace, pg_extension.extrelocatable as extrelocatable, pg_extension.extversion as extversion, pg_extension.extconfig::regclass[]::text[] as extconfig, pg_extension.extcondition as extcondition, pg_description.description as description from pg_extension left join pg_description on pg_description.objoid = pg_extension.oid and pg_description.objsubid = 0",
6651 None,
6652 )
6653}
6654impl ReflectPgExtensionStmt {
6655 pub async fn prepare<'a, C: GenericClient>(
6656 mut self,
6657 client: &'a C,
6658 ) -> Result<Self, tokio_postgres::Error> {
6659 self.1 = Some(client.prepare(self.0).await?);
6660 Ok(self)
6661 }
6662 pub fn bind<'c, 'a, 's, C: GenericClient>(
6663 &'s self,
6664 client: &'c C,
6665 ) -> ReflectPgExtensionQuery<'c, 'a, 's, C, ReflectPgExtension, 0> {
6666 ReflectPgExtensionQuery {
6667 client,
6668 params: [],
6669 query: self.0,
6670 cached: self.1.as_ref(),
6671 extractor: |
6672 row: &tokio_postgres::Row,
6673 | -> Result<ReflectPgExtensionBorrowed, tokio_postgres::Error> {
6674 Ok(ReflectPgExtensionBorrowed {
6675 extname: row.try_get(0)?,
6676 extowner: row.try_get(1)?,
6677 extnamespace: row.try_get(2)?,
6678 extrelocatable: row.try_get(3)?,
6679 extversion: row.try_get(4)?,
6680 extconfig: row.try_get(5)?,
6681 extcondition: row.try_get(6)?,
6682 description: row.try_get(7)?,
6683 })
6684 },
6685 mapper: |it| ReflectPgExtension::from(it),
6686 }
6687 }
6688}
6689pub struct ReflectPgForeignDataWrapperStmt(&'static str, Option<tokio_postgres::Statement>);
6690pub fn reflect_pg_foreign_data_wrapper() -> ReflectPgForeignDataWrapperStmt {
6691 ReflectPgForeignDataWrapperStmt(
6692 "select pg_foreign_data_wrapper.fdwname::text as fdwname, pg_get_userbyid(pg_foreign_data_wrapper.fdwowner)::text as fdwowner, case when pg_foreign_data_wrapper.fdwhandler = 0 then null else pg_foreign_data_wrapper.fdwhandler::regprocedure::text end as fdwhandler, case when pg_foreign_data_wrapper.fdwvalidator = 0 then null else pg_foreign_data_wrapper.fdwvalidator::regprocedure::text end as fdwvalidator, pg_temp.format_foreigndatawrapper_aclitems(pg_foreign_data_wrapper.fdwacl) as fdwacl, pg_foreign_data_wrapper.fdwoptions as fdwoptions, pg_description.description as description, pg_temp.format_foreigndatawrapper_aclitems(pg_init_privs.initprivs) as initprivs, pg_init_privs.privtype as initprivs_type from pg_foreign_data_wrapper left join pg_description on pg_description.objoid = pg_foreign_data_wrapper.oid and pg_description.objsubid = 0 left join pg_init_privs on pg_init_privs.objoid = pg_foreign_data_wrapper.oid and pg_init_privs.objsubid = 0",
6693 None,
6694 )
6695}
6696impl ReflectPgForeignDataWrapperStmt {
6697 pub async fn prepare<'a, C: GenericClient>(
6698 mut self,
6699 client: &'a C,
6700 ) -> Result<Self, tokio_postgres::Error> {
6701 self.1 = Some(client.prepare(self.0).await?);
6702 Ok(self)
6703 }
6704 pub fn bind<'c, 'a, 's, C: GenericClient>(
6705 &'s self,
6706 client: &'c C,
6707 ) -> ReflectPgForeignDataWrapperQuery<'c, 'a, 's, C, ReflectPgForeignDataWrapper, 0> {
6708 ReflectPgForeignDataWrapperQuery {
6709 client,
6710 params: [],
6711 query: self.0,
6712 cached: self.1.as_ref(),
6713 extractor: |
6714 row: &tokio_postgres::Row,
6715 | -> Result<ReflectPgForeignDataWrapperBorrowed, tokio_postgres::Error> {
6716 Ok(ReflectPgForeignDataWrapperBorrowed {
6717 fdwname: row.try_get(0)?,
6718 fdwowner: row.try_get(1)?,
6719 fdwhandler: row.try_get(2)?,
6720 fdwvalidator: row.try_get(3)?,
6721 fdwacl: row.try_get(4)?,
6722 fdwoptions: row.try_get(5)?,
6723 description: row.try_get(6)?,
6724 initprivs: row.try_get(7)?,
6725 initprivs_type: row.try_get(8)?,
6726 })
6727 },
6728 mapper: |it| ReflectPgForeignDataWrapper::from(it),
6729 }
6730 }
6731}
6732pub struct ReflectPgForeignServerStmt(&'static str, Option<tokio_postgres::Statement>);
6733pub fn reflect_pg_foreign_server() -> ReflectPgForeignServerStmt {
6734 ReflectPgForeignServerStmt(
6735 "select pg_foreign_server.srvname::text as srvname, pg_get_userbyid(pg_foreign_server.srvowner)::text as srvowner, srvfdw_pg_foreign_data_wrapper.fdwname::text as srvfdw, pg_foreign_server.srvtype as srvtype, pg_foreign_server.srvversion as srvversion, pg_temp.format_foreignserver_aclitems(pg_foreign_server.srvacl) as srvacl, pg_foreign_server.srvoptions as srvoptions, pg_description.description as description, pg_temp.format_foreignserver_aclitems(pg_init_privs.initprivs) as initprivs, pg_init_privs.privtype as initprivs_type from pg_foreign_server join pg_foreign_data_wrapper as srvfdw_pg_foreign_data_wrapper on pg_foreign_server.srvfdw = srvfdw_pg_foreign_data_wrapper.oid left join pg_description on pg_description.objoid = pg_foreign_server.oid and pg_description.objsubid = 0 left join pg_init_privs on pg_init_privs.objoid = pg_foreign_server.oid and pg_init_privs.objsubid = 0",
6736 None,
6737 )
6738}
6739impl ReflectPgForeignServerStmt {
6740 pub async fn prepare<'a, C: GenericClient>(
6741 mut self,
6742 client: &'a C,
6743 ) -> Result<Self, tokio_postgres::Error> {
6744 self.1 = Some(client.prepare(self.0).await?);
6745 Ok(self)
6746 }
6747 pub fn bind<'c, 'a, 's, C: GenericClient>(
6748 &'s self,
6749 client: &'c C,
6750 ) -> ReflectPgForeignServerQuery<'c, 'a, 's, C, ReflectPgForeignServer, 0> {
6751 ReflectPgForeignServerQuery {
6752 client,
6753 params: [],
6754 query: self.0,
6755 cached: self.1.as_ref(),
6756 extractor: |
6757 row: &tokio_postgres::Row,
6758 | -> Result<ReflectPgForeignServerBorrowed, tokio_postgres::Error> {
6759 Ok(ReflectPgForeignServerBorrowed {
6760 srvname: row.try_get(0)?,
6761 srvowner: row.try_get(1)?,
6762 srvfdw: row.try_get(2)?,
6763 srvtype: row.try_get(3)?,
6764 srvversion: row.try_get(4)?,
6765 srvacl: row.try_get(5)?,
6766 srvoptions: row.try_get(6)?,
6767 description: row.try_get(7)?,
6768 initprivs: row.try_get(8)?,
6769 initprivs_type: row.try_get(9)?,
6770 })
6771 },
6772 mapper: |it| ReflectPgForeignServer::from(it),
6773 }
6774 }
6775}
6776pub struct ReflectPgForeignTableStmt(&'static str, Option<tokio_postgres::Statement>);
6777pub fn reflect_pg_foreign_table() -> ReflectPgForeignTableStmt {
6778 ReflectPgForeignTableStmt(
6779 "select pg_foreign_table.ftrelid::regclass::text as ftrelid, ftserver_pg_foreign_server.srvname::text as ftserver, pg_foreign_table.ftoptions as ftoptions from pg_foreign_table join pg_foreign_server as ftserver_pg_foreign_server on pg_foreign_table.ftserver = ftserver_pg_foreign_server.oid",
6780 None,
6781 )
6782}
6783impl ReflectPgForeignTableStmt {
6784 pub async fn prepare<'a, C: GenericClient>(
6785 mut self,
6786 client: &'a C,
6787 ) -> Result<Self, tokio_postgres::Error> {
6788 self.1 = Some(client.prepare(self.0).await?);
6789 Ok(self)
6790 }
6791 pub fn bind<'c, 'a, 's, C: GenericClient>(
6792 &'s self,
6793 client: &'c C,
6794 ) -> ReflectPgForeignTableQuery<'c, 'a, 's, C, ReflectPgForeignTable, 0> {
6795 ReflectPgForeignTableQuery {
6796 client,
6797 params: [],
6798 query: self.0,
6799 cached: self.1.as_ref(),
6800 extractor: |
6801 row: &tokio_postgres::Row,
6802 | -> Result<ReflectPgForeignTableBorrowed, tokio_postgres::Error> {
6803 Ok(ReflectPgForeignTableBorrowed {
6804 ftrelid: row.try_get(0)?,
6805 ftserver: row.try_get(1)?,
6806 ftoptions: row.try_get(2)?,
6807 })
6808 },
6809 mapper: |it| ReflectPgForeignTable::from(it),
6810 }
6811 }
6812}
6813pub struct ReflectPgIndexStmt(&'static str, Option<tokio_postgres::Statement>);
6814pub fn reflect_pg_index() -> ReflectPgIndexStmt {
6815 ReflectPgIndexStmt(
6816 "select pg_index.indexrelid::regclass::text as indexrelid, pg_index.indrelid::regclass::text as indrelid, pg_index.indnatts as indnatts, pg_index.indnkeyatts as indnkeyatts, pg_index.indisunique as indisunique, pg_index.indnullsnotdistinct as indnullsnotdistinct, pg_index.indisprimary as indisprimary, pg_index.indisexclusion as indisexclusion, pg_index.indimmediate as indimmediate, pg_index.indisreplident as indisreplident, pg_index.indkey as indkey, pg_temp.format_pg_collation_oidvector(pg_index.indcollation) as indcollation, pg_temp.format_pg_opclass_oidvector(pg_index.indclass) as indclass, pg_index.indoption::int2[] as indoption, pg_get_expr(pg_index.indexprs, pg_index.indrelid) as indexprs, pg_get_expr(pg_index.indpred, pg_index.indrelid) as indpred from pg_index where not starts_with(pg_index.indrelid::regclass::text, 'pg_toast')",
6817 None,
6818 )
6819}
6820impl ReflectPgIndexStmt {
6821 pub async fn prepare<'a, C: GenericClient>(
6822 mut self,
6823 client: &'a C,
6824 ) -> Result<Self, tokio_postgres::Error> {
6825 self.1 = Some(client.prepare(self.0).await?);
6826 Ok(self)
6827 }
6828 pub fn bind<'c, 'a, 's, C: GenericClient>(
6829 &'s self,
6830 client: &'c C,
6831 ) -> ReflectPgIndexQuery<'c, 'a, 's, C, ReflectPgIndex, 0> {
6832 ReflectPgIndexQuery {
6833 client,
6834 params: [],
6835 query: self.0,
6836 cached: self.1.as_ref(),
6837 extractor: |
6838 row: &tokio_postgres::Row,
6839 | -> Result<ReflectPgIndexBorrowed, tokio_postgres::Error> {
6840 Ok(ReflectPgIndexBorrowed {
6841 indexrelid: row.try_get(0)?,
6842 indrelid: row.try_get(1)?,
6843 indnatts: row.try_get(2)?,
6844 indnkeyatts: row.try_get(3)?,
6845 indisunique: row.try_get(4)?,
6846 indnullsnotdistinct: row.try_get(5)?,
6847 indisprimary: row.try_get(6)?,
6848 indisexclusion: row.try_get(7)?,
6849 indimmediate: row.try_get(8)?,
6850 indisreplident: row.try_get(9)?,
6851 indkey: row.try_get(10)?,
6852 indcollation: row.try_get(11)?,
6853 indclass: row.try_get(12)?,
6854 indoption: row.try_get(13)?,
6855 indexprs: row.try_get(14)?,
6856 indpred: row.try_get(15)?,
6857 })
6858 },
6859 mapper: |it| ReflectPgIndex::from(it),
6860 }
6861 }
6862}
6863pub struct ReflectPgInheritsStmt(&'static str, Option<tokio_postgres::Statement>);
6864pub fn reflect_pg_inherits() -> ReflectPgInheritsStmt {
6865 ReflectPgInheritsStmt(
6866 "select pg_inherits.inhrelid::regclass::text as inhrelid, pg_inherits.inhparent::regclass::text as inhparent, pg_inherits.inhseqno as inhseqno from pg_inherits",
6867 None,
6868 )
6869}
6870impl ReflectPgInheritsStmt {
6871 pub async fn prepare<'a, C: GenericClient>(
6872 mut self,
6873 client: &'a C,
6874 ) -> Result<Self, tokio_postgres::Error> {
6875 self.1 = Some(client.prepare(self.0).await?);
6876 Ok(self)
6877 }
6878 pub fn bind<'c, 'a, 's, C: GenericClient>(
6879 &'s self,
6880 client: &'c C,
6881 ) -> ReflectPgInheritsQuery<'c, 'a, 's, C, ReflectPgInherits, 0> {
6882 ReflectPgInheritsQuery {
6883 client,
6884 params: [],
6885 query: self.0,
6886 cached: self.1.as_ref(),
6887 extractor: |
6888 row: &tokio_postgres::Row,
6889 | -> Result<ReflectPgInheritsBorrowed, tokio_postgres::Error> {
6890 Ok(ReflectPgInheritsBorrowed {
6891 inhrelid: row.try_get(0)?,
6892 inhparent: row.try_get(1)?,
6893 inhseqno: row.try_get(2)?,
6894 })
6895 },
6896 mapper: |it| ReflectPgInherits::from(it),
6897 }
6898 }
6899}
6900pub struct ReflectPgLanguageStmt(&'static str, Option<tokio_postgres::Statement>);
6901pub fn reflect_pg_language() -> ReflectPgLanguageStmt {
6902 ReflectPgLanguageStmt(
6903 "select pg_language.lanname::text as lanname, pg_get_userbyid(pg_language.lanowner)::text as lanowner, pg_language.lanispl as lanispl, pg_language.lanpltrusted as lanpltrusted, case when pg_language.lanplcallfoid = 0 then null else pg_language.lanplcallfoid::regprocedure::text end as lanplcallfoid, case when pg_language.laninline = 0 then null else pg_language.laninline::regprocedure::text end as laninline, case when pg_language.lanvalidator = 0 then null else pg_language.lanvalidator::regprocedure::text end as lanvalidator, pg_temp.format_language_aclitems(pg_language.lanacl) as lanacl, pg_description.description as description, pg_seclabel.label as seclabel, pg_seclabel.provider as seclabel_provider, pg_temp.format_language_aclitems(pg_init_privs.initprivs) as initprivs, pg_init_privs.privtype as initprivs_type from pg_language left join pg_description on pg_description.objoid = pg_language.oid and pg_description.objsubid = 0 left join pg_seclabel on pg_seclabel.objoid = pg_language.oid and pg_seclabel.objsubid = 0 left join pg_init_privs on pg_init_privs.objoid = pg_language.oid and pg_init_privs.objsubid = 0",
6904 None,
6905 )
6906}
6907impl ReflectPgLanguageStmt {
6908 pub async fn prepare<'a, C: GenericClient>(
6909 mut self,
6910 client: &'a C,
6911 ) -> Result<Self, tokio_postgres::Error> {
6912 self.1 = Some(client.prepare(self.0).await?);
6913 Ok(self)
6914 }
6915 pub fn bind<'c, 'a, 's, C: GenericClient>(
6916 &'s self,
6917 client: &'c C,
6918 ) -> ReflectPgLanguageQuery<'c, 'a, 's, C, ReflectPgLanguage, 0> {
6919 ReflectPgLanguageQuery {
6920 client,
6921 params: [],
6922 query: self.0,
6923 cached: self.1.as_ref(),
6924 extractor: |
6925 row: &tokio_postgres::Row,
6926 | -> Result<ReflectPgLanguageBorrowed, tokio_postgres::Error> {
6927 Ok(ReflectPgLanguageBorrowed {
6928 lanname: row.try_get(0)?,
6929 lanowner: row.try_get(1)?,
6930 lanispl: row.try_get(2)?,
6931 lanpltrusted: row.try_get(3)?,
6932 lanplcallfoid: row.try_get(4)?,
6933 laninline: row.try_get(5)?,
6934 lanvalidator: row.try_get(6)?,
6935 lanacl: row.try_get(7)?,
6936 description: row.try_get(8)?,
6937 seclabel: row.try_get(9)?,
6938 seclabel_provider: row.try_get(10)?,
6939 initprivs: row.try_get(11)?,
6940 initprivs_type: row.try_get(12)?,
6941 })
6942 },
6943 mapper: |it| ReflectPgLanguage::from(it),
6944 }
6945 }
6946}
6947pub struct ReflectPgNamespaceStmt(&'static str, Option<tokio_postgres::Statement>);
6948pub fn reflect_pg_namespace() -> ReflectPgNamespaceStmt {
6949 ReflectPgNamespaceStmt(
6950 "select pg_namespace.nspname::text as nspname, pg_get_userbyid(pg_namespace.nspowner)::text as nspowner, pg_temp.format_schema_aclitems(pg_namespace.nspacl) as nspacl, pg_description.description as description, pg_seclabel.label as seclabel, pg_seclabel.provider as seclabel_provider, pg_temp.format_schema_aclitems(pg_init_privs.initprivs) as initprivs, pg_init_privs.privtype as initprivs_type from pg_namespace left join pg_description on pg_description.objoid = pg_namespace.oid and pg_description.objsubid = 0 left join pg_seclabel on pg_seclabel.objoid = pg_namespace.oid and pg_seclabel.objsubid = 0 left join pg_init_privs on pg_init_privs.objoid = pg_namespace.oid and pg_init_privs.objsubid = 0 where not starts_with(nspname, 'pg_temp') and not starts_with(nspname, 'pg_toast')",
6951 None,
6952 )
6953}
6954impl ReflectPgNamespaceStmt {
6955 pub async fn prepare<'a, C: GenericClient>(
6956 mut self,
6957 client: &'a C,
6958 ) -> Result<Self, tokio_postgres::Error> {
6959 self.1 = Some(client.prepare(self.0).await?);
6960 Ok(self)
6961 }
6962 pub fn bind<'c, 'a, 's, C: GenericClient>(
6963 &'s self,
6964 client: &'c C,
6965 ) -> ReflectPgNamespaceQuery<'c, 'a, 's, C, ReflectPgNamespace, 0> {
6966 ReflectPgNamespaceQuery {
6967 client,
6968 params: [],
6969 query: self.0,
6970 cached: self.1.as_ref(),
6971 extractor: |
6972 row: &tokio_postgres::Row,
6973 | -> Result<ReflectPgNamespaceBorrowed, tokio_postgres::Error> {
6974 Ok(ReflectPgNamespaceBorrowed {
6975 nspname: row.try_get(0)?,
6976 nspowner: row.try_get(1)?,
6977 nspacl: row.try_get(2)?,
6978 description: row.try_get(3)?,
6979 seclabel: row.try_get(4)?,
6980 seclabel_provider: row.try_get(5)?,
6981 initprivs: row.try_get(6)?,
6982 initprivs_type: row.try_get(7)?,
6983 })
6984 },
6985 mapper: |it| ReflectPgNamespace::from(it),
6986 }
6987 }
6988}
6989pub struct ReflectPgOpclassStmt(&'static str, Option<tokio_postgres::Statement>);
6990pub fn reflect_pg_opclass() -> ReflectPgOpclassStmt {
6991 ReflectPgOpclassStmt(
6992 "select opcmethod_pg_am.amname::text as opcmethod, pg_opclass.opcname::text as opcname, pg_opclass.opcnamespace::regnamespace::text as opcnamespace, pg_get_userbyid(pg_opclass.opcowner)::text as opcowner, pg_temp.quote_with_namespace(opcfamily_pg_namespace.nspname, opcfamily_pg_opfamily.opfname) as opcfamily, pg_opclass.opcintype::regtype::text as opcintype, pg_opclass.opcdefault as opcdefault, case when pg_opclass.opckeytype = 0 then null else pg_opclass.opckeytype::regtype::text end as opckeytype, pg_description.description as description from pg_opclass join pg_am as opcmethod_pg_am on pg_opclass.opcmethod = opcmethod_pg_am.oid join pg_opfamily as opcfamily_pg_opfamily on pg_opclass.opcfamily = opcfamily_pg_opfamily.oid join pg_namespace as opcfamily_pg_namespace on opcfamily_pg_opfamily.opfnamespace = opcfamily_pg_namespace.oid left join pg_description on pg_description.objoid = pg_opclass.oid and pg_description.objsubid = 0",
6993 None,
6994 )
6995}
6996impl ReflectPgOpclassStmt {
6997 pub async fn prepare<'a, C: GenericClient>(
6998 mut self,
6999 client: &'a C,
7000 ) -> Result<Self, tokio_postgres::Error> {
7001 self.1 = Some(client.prepare(self.0).await?);
7002 Ok(self)
7003 }
7004 pub fn bind<'c, 'a, 's, C: GenericClient>(
7005 &'s self,
7006 client: &'c C,
7007 ) -> ReflectPgOpclassQuery<'c, 'a, 's, C, ReflectPgOpclass, 0> {
7008 ReflectPgOpclassQuery {
7009 client,
7010 params: [],
7011 query: self.0,
7012 cached: self.1.as_ref(),
7013 extractor: |
7014 row: &tokio_postgres::Row,
7015 | -> Result<ReflectPgOpclassBorrowed, tokio_postgres::Error> {
7016 Ok(ReflectPgOpclassBorrowed {
7017 opcmethod: row.try_get(0)?,
7018 opcname: row.try_get(1)?,
7019 opcnamespace: row.try_get(2)?,
7020 opcowner: row.try_get(3)?,
7021 opcfamily: row.try_get(4)?,
7022 opcintype: row.try_get(5)?,
7023 opcdefault: row.try_get(6)?,
7024 opckeytype: row.try_get(7)?,
7025 description: row.try_get(8)?,
7026 })
7027 },
7028 mapper: |it| ReflectPgOpclass::from(it),
7029 }
7030 }
7031}
7032pub struct ReflectPgOperatorStmt(&'static str, Option<tokio_postgres::Statement>);
7033pub fn reflect_pg_operator() -> ReflectPgOperatorStmt {
7034 ReflectPgOperatorStmt(
7035 "select pg_operator.oid::regoperator::text as oid, pg_operator.oprname::text as oprname, pg_operator.oprnamespace::regnamespace::text as oprnamespace, pg_get_userbyid(pg_operator.oprowner)::text as oprowner, pg_operator.oprkind as oprkind, pg_operator.oprcanmerge as oprcanmerge, pg_operator.oprcanhash as oprcanhash, case when pg_operator.oprleft = 0 then null else pg_operator.oprleft::regtype::text end as oprleft, pg_operator.oprright::regtype::text as oprright, case when pg_operator.oprresult = 0 then null else pg_operator.oprresult::regtype::text end as oprresult, case when pg_operator.oprcom = 0 then null else pg_operator.oprcom::regoperator::text end as oprcom, case when pg_operator.oprnegate = 0 then null else pg_operator.oprnegate::regoperator::text end as oprnegate, case when oprcode = 0 then null else oprcode::regprocedure::text end as oprcode, case when oprrest = 0 then null else oprrest::regprocedure::text end as oprrest, case when oprjoin = 0 then null else oprjoin::regprocedure::text end as oprjoin, pg_description.description as description from pg_operator left join pg_description on pg_description.objoid = pg_operator.oid and pg_description.objsubid = 0",
7036 None,
7037 )
7038}
7039impl ReflectPgOperatorStmt {
7040 pub async fn prepare<'a, C: GenericClient>(
7041 mut self,
7042 client: &'a C,
7043 ) -> Result<Self, tokio_postgres::Error> {
7044 self.1 = Some(client.prepare(self.0).await?);
7045 Ok(self)
7046 }
7047 pub fn bind<'c, 'a, 's, C: GenericClient>(
7048 &'s self,
7049 client: &'c C,
7050 ) -> ReflectPgOperatorQuery<'c, 'a, 's, C, ReflectPgOperator, 0> {
7051 ReflectPgOperatorQuery {
7052 client,
7053 params: [],
7054 query: self.0,
7055 cached: self.1.as_ref(),
7056 extractor: |
7057 row: &tokio_postgres::Row,
7058 | -> Result<ReflectPgOperatorBorrowed, tokio_postgres::Error> {
7059 Ok(ReflectPgOperatorBorrowed {
7060 oid: row.try_get(0)?,
7061 oprname: row.try_get(1)?,
7062 oprnamespace: row.try_get(2)?,
7063 oprowner: row.try_get(3)?,
7064 oprkind: row.try_get(4)?,
7065 oprcanmerge: row.try_get(5)?,
7066 oprcanhash: row.try_get(6)?,
7067 oprleft: row.try_get(7)?,
7068 oprright: row.try_get(8)?,
7069 oprresult: row.try_get(9)?,
7070 oprcom: row.try_get(10)?,
7071 oprnegate: row.try_get(11)?,
7072 oprcode: row.try_get(12)?,
7073 oprrest: row.try_get(13)?,
7074 oprjoin: row.try_get(14)?,
7075 description: row.try_get(15)?,
7076 })
7077 },
7078 mapper: |it| ReflectPgOperator::from(it),
7079 }
7080 }
7081}
7082pub struct ReflectPgOpfamilyStmt(&'static str, Option<tokio_postgres::Statement>);
7083pub fn reflect_pg_opfamily() -> ReflectPgOpfamilyStmt {
7084 ReflectPgOpfamilyStmt(
7085 "select opfmethod_pg_am.amname::text as opfmethod, pg_opfamily.opfname::text as opfname, pg_opfamily.opfnamespace::regnamespace::text as opfnamespace, pg_get_userbyid(pg_opfamily.opfowner)::text as opfowner, pg_description.description as description from pg_opfamily join pg_am as opfmethod_pg_am on pg_opfamily.opfmethod = opfmethod_pg_am.oid left join pg_description on pg_description.objoid = pg_opfamily.oid and pg_description.objsubid = 0",
7086 None,
7087 )
7088}
7089impl ReflectPgOpfamilyStmt {
7090 pub async fn prepare<'a, C: GenericClient>(
7091 mut self,
7092 client: &'a C,
7093 ) -> Result<Self, tokio_postgres::Error> {
7094 self.1 = Some(client.prepare(self.0).await?);
7095 Ok(self)
7096 }
7097 pub fn bind<'c, 'a, 's, C: GenericClient>(
7098 &'s self,
7099 client: &'c C,
7100 ) -> ReflectPgOpfamilyQuery<'c, 'a, 's, C, ReflectPgOpfamily, 0> {
7101 ReflectPgOpfamilyQuery {
7102 client,
7103 params: [],
7104 query: self.0,
7105 cached: self.1.as_ref(),
7106 extractor: |
7107 row: &tokio_postgres::Row,
7108 | -> Result<ReflectPgOpfamilyBorrowed, tokio_postgres::Error> {
7109 Ok(ReflectPgOpfamilyBorrowed {
7110 opfmethod: row.try_get(0)?,
7111 opfname: row.try_get(1)?,
7112 opfnamespace: row.try_get(2)?,
7113 opfowner: row.try_get(3)?,
7114 description: row.try_get(4)?,
7115 })
7116 },
7117 mapper: |it| ReflectPgOpfamily::from(it),
7118 }
7119 }
7120}
7121pub struct ReflectPgParameterAclStmt(&'static str, Option<tokio_postgres::Statement>);
7122pub fn reflect_pg_parameter_acl() -> ReflectPgParameterAclStmt {
7123 ReflectPgParameterAclStmt(
7124 "select pg_parameter_acl.parname as parname, pg_temp.format_parameter_aclitems(pg_parameter_acl.paracl) as paracl, pg_temp.format_parameter_aclitems(pg_init_privs.initprivs) as initprivs, pg_init_privs.privtype as initprivs_type from pg_parameter_acl left join pg_init_privs on pg_init_privs.objoid = pg_parameter_acl.oid and pg_init_privs.objsubid = 0",
7125 None,
7126 )
7127}
7128impl ReflectPgParameterAclStmt {
7129 pub async fn prepare<'a, C: GenericClient>(
7130 mut self,
7131 client: &'a C,
7132 ) -> Result<Self, tokio_postgres::Error> {
7133 self.1 = Some(client.prepare(self.0).await?);
7134 Ok(self)
7135 }
7136 pub fn bind<'c, 'a, 's, C: GenericClient>(
7137 &'s self,
7138 client: &'c C,
7139 ) -> ReflectPgParameterAclQuery<'c, 'a, 's, C, ReflectPgParameterAcl, 0> {
7140 ReflectPgParameterAclQuery {
7141 client,
7142 params: [],
7143 query: self.0,
7144 cached: self.1.as_ref(),
7145 extractor: |
7146 row: &tokio_postgres::Row,
7147 | -> Result<ReflectPgParameterAclBorrowed, tokio_postgres::Error> {
7148 Ok(ReflectPgParameterAclBorrowed {
7149 parname: row.try_get(0)?,
7150 paracl: row.try_get(1)?,
7151 initprivs: row.try_get(2)?,
7152 initprivs_type: row.try_get(3)?,
7153 })
7154 },
7155 mapper: |it| ReflectPgParameterAcl::from(it),
7156 }
7157 }
7158}
7159pub struct ReflectPgPartitionedTableStmt(&'static str, Option<tokio_postgres::Statement>);
7160pub fn reflect_pg_partitioned_table() -> ReflectPgPartitionedTableStmt {
7161 ReflectPgPartitionedTableStmt(
7162 "select pg_partitioned_table.partrelid::regclass::text as partrelid, pg_partitioned_table.partstrat as partstrat, pg_partitioned_table.partnatts as partnatts, case when pg_partitioned_table.partdefid = 0 then null else pg_partitioned_table.partdefid::regclass::text end as partdefid, pg_partitioned_table.partattrs as partattrs, pg_temp.format_pg_opclass_oidvector(pg_partitioned_table.partclass) as partclass, pg_temp.format_pg_collation_oidvector(pg_partitioned_table.partcollation) as partcollation, pg_get_expr(pg_partitioned_table.partexprs, pg_partitioned_table.partrelid) as partexprs from pg_partitioned_table",
7163 None,
7164 )
7165}
7166impl ReflectPgPartitionedTableStmt {
7167 pub async fn prepare<'a, C: GenericClient>(
7168 mut self,
7169 client: &'a C,
7170 ) -> Result<Self, tokio_postgres::Error> {
7171 self.1 = Some(client.prepare(self.0).await?);
7172 Ok(self)
7173 }
7174 pub fn bind<'c, 'a, 's, C: GenericClient>(
7175 &'s self,
7176 client: &'c C,
7177 ) -> ReflectPgPartitionedTableQuery<'c, 'a, 's, C, ReflectPgPartitionedTable, 0> {
7178 ReflectPgPartitionedTableQuery {
7179 client,
7180 params: [],
7181 query: self.0,
7182 cached: self.1.as_ref(),
7183 extractor: |
7184 row: &tokio_postgres::Row,
7185 | -> Result<ReflectPgPartitionedTableBorrowed, tokio_postgres::Error> {
7186 Ok(ReflectPgPartitionedTableBorrowed {
7187 partrelid: row.try_get(0)?,
7188 partstrat: row.try_get(1)?,
7189 partnatts: row.try_get(2)?,
7190 partdefid: row.try_get(3)?,
7191 partattrs: row.try_get(4)?,
7192 partclass: row.try_get(5)?,
7193 partcollation: row.try_get(6)?,
7194 partexprs: row.try_get(7)?,
7195 })
7196 },
7197 mapper: |it| ReflectPgPartitionedTable::from(it),
7198 }
7199 }
7200}
7201pub struct ReflectPgPolicyStmt(&'static str, Option<tokio_postgres::Statement>);
7202pub fn reflect_pg_policy() -> ReflectPgPolicyStmt {
7203 ReflectPgPolicyStmt(
7204 "select pg_policy.polname::text as polname, pg_policy.polrelid::regclass::text as polrelid, pg_policy.polcmd as polcmd, pg_policy.polpermissive as polpermissive, pg_temp.format_role_oid_array(pg_policy.polroles) as polroles, pg_get_expr(pg_policy.polqual, pg_policy.polrelid) as polqual, pg_get_expr(pg_policy.polwithcheck, pg_policy.polrelid) as polwithcheck, pg_description.description as description from pg_policy left join pg_description on pg_description.objoid = pg_policy.oid and pg_description.objsubid = 0",
7205 None,
7206 )
7207}
7208impl ReflectPgPolicyStmt {
7209 pub async fn prepare<'a, C: GenericClient>(
7210 mut self,
7211 client: &'a C,
7212 ) -> Result<Self, tokio_postgres::Error> {
7213 self.1 = Some(client.prepare(self.0).await?);
7214 Ok(self)
7215 }
7216 pub fn bind<'c, 'a, 's, C: GenericClient>(
7217 &'s self,
7218 client: &'c C,
7219 ) -> ReflectPgPolicyQuery<'c, 'a, 's, C, ReflectPgPolicy, 0> {
7220 ReflectPgPolicyQuery {
7221 client,
7222 params: [],
7223 query: self.0,
7224 cached: self.1.as_ref(),
7225 extractor: |
7226 row: &tokio_postgres::Row,
7227 | -> Result<ReflectPgPolicyBorrowed, tokio_postgres::Error> {
7228 Ok(ReflectPgPolicyBorrowed {
7229 polname: row.try_get(0)?,
7230 polrelid: row.try_get(1)?,
7231 polcmd: row.try_get(2)?,
7232 polpermissive: row.try_get(3)?,
7233 polroles: row.try_get(4)?,
7234 polqual: row.try_get(5)?,
7235 polwithcheck: row.try_get(6)?,
7236 description: row.try_get(7)?,
7237 })
7238 },
7239 mapper: |it| ReflectPgPolicy::from(it),
7240 }
7241 }
7242}
7243pub struct ReflectPgPublicationStmt(&'static str, Option<tokio_postgres::Statement>);
7244pub fn reflect_pg_publication() -> ReflectPgPublicationStmt {
7245 ReflectPgPublicationStmt(
7246 "select pg_publication.pubname::text as pubname, pg_get_userbyid(pg_publication.pubowner)::text as pubowner, pg_publication.puballtables as puballtables, pg_publication.pubinsert as pubinsert, pg_publication.pubupdate as pubupdate, pg_publication.pubdelete as pubdelete, pg_publication.pubtruncate as pubtruncate, pg_publication.pubviaroot as pubviaroot, pg_description.description as description, pg_seclabel.label as seclabel, pg_seclabel.provider as seclabel_provider from pg_publication left join pg_description on pg_description.objoid = pg_publication.oid and pg_description.objsubid = 0 left join pg_seclabel on pg_seclabel.objoid = pg_publication.oid and pg_seclabel.objsubid = 0",
7247 None,
7248 )
7249}
7250impl ReflectPgPublicationStmt {
7251 pub async fn prepare<'a, C: GenericClient>(
7252 mut self,
7253 client: &'a C,
7254 ) -> Result<Self, tokio_postgres::Error> {
7255 self.1 = Some(client.prepare(self.0).await?);
7256 Ok(self)
7257 }
7258 pub fn bind<'c, 'a, 's, C: GenericClient>(
7259 &'s self,
7260 client: &'c C,
7261 ) -> ReflectPgPublicationQuery<'c, 'a, 's, C, ReflectPgPublication, 0> {
7262 ReflectPgPublicationQuery {
7263 client,
7264 params: [],
7265 query: self.0,
7266 cached: self.1.as_ref(),
7267 extractor: |
7268 row: &tokio_postgres::Row,
7269 | -> Result<ReflectPgPublicationBorrowed, tokio_postgres::Error> {
7270 Ok(ReflectPgPublicationBorrowed {
7271 pubname: row.try_get(0)?,
7272 pubowner: row.try_get(1)?,
7273 puballtables: row.try_get(2)?,
7274 pubinsert: row.try_get(3)?,
7275 pubupdate: row.try_get(4)?,
7276 pubdelete: row.try_get(5)?,
7277 pubtruncate: row.try_get(6)?,
7278 pubviaroot: row.try_get(7)?,
7279 description: row.try_get(8)?,
7280 seclabel: row.try_get(9)?,
7281 seclabel_provider: row.try_get(10)?,
7282 })
7283 },
7284 mapper: |it| ReflectPgPublication::from(it),
7285 }
7286 }
7287}
7288pub struct ReflectPgPublicationNamespaceStmt(&'static str, Option<tokio_postgres::Statement>);
7289pub fn reflect_pg_publication_namespace() -> ReflectPgPublicationNamespaceStmt {
7290 ReflectPgPublicationNamespaceStmt(
7291 "select pnpubid_pg_publication.pubname::text as pnpubid, pg_publication_namespace.pnnspid::regnamespace::text as pnnspid from pg_publication_namespace join pg_publication as pnpubid_pg_publication on pg_publication_namespace.pnpubid = pnpubid_pg_publication.oid",
7292 None,
7293 )
7294}
7295impl ReflectPgPublicationNamespaceStmt {
7296 pub async fn prepare<'a, C: GenericClient>(
7297 mut self,
7298 client: &'a C,
7299 ) -> Result<Self, tokio_postgres::Error> {
7300 self.1 = Some(client.prepare(self.0).await?);
7301 Ok(self)
7302 }
7303 pub fn bind<'c, 'a, 's, C: GenericClient>(
7304 &'s self,
7305 client: &'c C,
7306 ) -> ReflectPgPublicationNamespaceQuery<'c, 'a, 's, C, ReflectPgPublicationNamespace, 0> {
7307 ReflectPgPublicationNamespaceQuery {
7308 client,
7309 params: [],
7310 query: self.0,
7311 cached: self.1.as_ref(),
7312 extractor: |
7313 row: &tokio_postgres::Row,
7314 | -> Result<ReflectPgPublicationNamespaceBorrowed, tokio_postgres::Error> {
7315 Ok(ReflectPgPublicationNamespaceBorrowed {
7316 pnpubid: row.try_get(0)?,
7317 pnnspid: row.try_get(1)?,
7318 })
7319 },
7320 mapper: |it| ReflectPgPublicationNamespace::from(it),
7321 }
7322 }
7323}
7324pub struct ReflectPgPublicationRelStmt(&'static str, Option<tokio_postgres::Statement>);
7325pub fn reflect_pg_publication_rel() -> ReflectPgPublicationRelStmt {
7326 ReflectPgPublicationRelStmt(
7327 "select prpubid_pg_publication.pubname::text as prpubid, pg_publication_rel.prrelid::regclass::text as prrelid, pg_get_expr(pg_publication_rel.prqual, pg_publication_rel.prrelid) as prqual, pg_publication_rel.prattrs as prattrs from pg_publication_rel join pg_publication as prpubid_pg_publication on pg_publication_rel.prpubid = prpubid_pg_publication.oid",
7328 None,
7329 )
7330}
7331impl ReflectPgPublicationRelStmt {
7332 pub async fn prepare<'a, C: GenericClient>(
7333 mut self,
7334 client: &'a C,
7335 ) -> Result<Self, tokio_postgres::Error> {
7336 self.1 = Some(client.prepare(self.0).await?);
7337 Ok(self)
7338 }
7339 pub fn bind<'c, 'a, 's, C: GenericClient>(
7340 &'s self,
7341 client: &'c C,
7342 ) -> ReflectPgPublicationRelQuery<'c, 'a, 's, C, ReflectPgPublicationRel, 0> {
7343 ReflectPgPublicationRelQuery {
7344 client,
7345 params: [],
7346 query: self.0,
7347 cached: self.1.as_ref(),
7348 extractor: |
7349 row: &tokio_postgres::Row,
7350 | -> Result<ReflectPgPublicationRelBorrowed, tokio_postgres::Error> {
7351 Ok(ReflectPgPublicationRelBorrowed {
7352 prpubid: row.try_get(0)?,
7353 prrelid: row.try_get(1)?,
7354 prqual: row.try_get(2)?,
7355 prattrs: row.try_get(3)?,
7356 })
7357 },
7358 mapper: |it| ReflectPgPublicationRel::from(it),
7359 }
7360 }
7361}
7362pub struct ReflectPgRangeStmt(&'static str, Option<tokio_postgres::Statement>);
7363pub fn reflect_pg_range() -> ReflectPgRangeStmt {
7364 ReflectPgRangeStmt(
7365 "select pg_range.rngtypid::regtype::text as rngtypid, pg_range.rngsubtype::regtype::text as rngsubtype, pg_range.rngmultitypid::regtype::text as rngmultitypid, case when pg_range.rngcollation = 0 then null else pg_range.rngcollation::regcollation::text end as rngcollation, pg_temp.quote_with_namespace(rngsubopc_pg_namespace.nspname, rngsubopc_pg_opclass.opcname) as rngsubopc, case when rngcanonical = 0 then null else rngcanonical::regprocedure::text end as rngcanonical, case when rngsubdiff = 0 then null else rngsubdiff::regprocedure::text end as rngsubdiff from pg_range join pg_opclass as rngsubopc_pg_opclass on pg_range.rngsubopc = rngsubopc_pg_opclass.oid join pg_namespace as rngsubopc_pg_namespace on rngsubopc_pg_opclass.opcnamespace = rngsubopc_pg_namespace.oid",
7366 None,
7367 )
7368}
7369impl ReflectPgRangeStmt {
7370 pub async fn prepare<'a, C: GenericClient>(
7371 mut self,
7372 client: &'a C,
7373 ) -> Result<Self, tokio_postgres::Error> {
7374 self.1 = Some(client.prepare(self.0).await?);
7375 Ok(self)
7376 }
7377 pub fn bind<'c, 'a, 's, C: GenericClient>(
7378 &'s self,
7379 client: &'c C,
7380 ) -> ReflectPgRangeQuery<'c, 'a, 's, C, ReflectPgRange, 0> {
7381 ReflectPgRangeQuery {
7382 client,
7383 params: [],
7384 query: self.0,
7385 cached: self.1.as_ref(),
7386 extractor: |
7387 row: &tokio_postgres::Row,
7388 | -> Result<ReflectPgRangeBorrowed, tokio_postgres::Error> {
7389 Ok(ReflectPgRangeBorrowed {
7390 rngtypid: row.try_get(0)?,
7391 rngsubtype: row.try_get(1)?,
7392 rngmultitypid: row.try_get(2)?,
7393 rngcollation: row.try_get(3)?,
7394 rngsubopc: row.try_get(4)?,
7395 rngcanonical: row.try_get(5)?,
7396 rngsubdiff: row.try_get(6)?,
7397 })
7398 },
7399 mapper: |it| ReflectPgRange::from(it),
7400 }
7401 }
7402}
7403pub struct ReflectPgRulesStmt(&'static str, Option<tokio_postgres::Statement>);
7404pub fn reflect_pg_rules() -> ReflectPgRulesStmt {
7405 ReflectPgRulesStmt(
7406 "select pg_rules.schemaname::text as schemaname, pg_temp.quote_with_namespace(pg_rules.schemaname, pg_rules.tablename) as tablename, pg_rules.rulename::text as rulename, pg_rules.definition as definition, pg_description.description as description from pg_rules join pg_rewrite on pg_rewrite.ev_type != '1' and pg_rules.rulename = pg_rewrite.rulename and (quote_ident(pg_rules.schemaname) || '.' || quote_ident(pg_rules.tablename))::regclass::oid = pg_rewrite.ev_class left join pg_description on pg_description.objoid = pg_rewrite.oid and pg_description.objsubid = 0",
7407 None,
7408 )
7409}
7410impl ReflectPgRulesStmt {
7411 pub async fn prepare<'a, C: GenericClient>(
7412 mut self,
7413 client: &'a C,
7414 ) -> Result<Self, tokio_postgres::Error> {
7415 self.1 = Some(client.prepare(self.0).await?);
7416 Ok(self)
7417 }
7418 pub fn bind<'c, 'a, 's, C: GenericClient>(
7419 &'s self,
7420 client: &'c C,
7421 ) -> ReflectPgRulesQuery<'c, 'a, 's, C, ReflectPgRules, 0> {
7422 ReflectPgRulesQuery {
7423 client,
7424 params: [],
7425 query: self.0,
7426 cached: self.1.as_ref(),
7427 extractor: |
7428 row: &tokio_postgres::Row,
7429 | -> Result<ReflectPgRulesBorrowed, tokio_postgres::Error> {
7430 Ok(ReflectPgRulesBorrowed {
7431 schemaname: row.try_get(0)?,
7432 tablename: row.try_get(1)?,
7433 rulename: row.try_get(2)?,
7434 definition: row.try_get(3)?,
7435 description: row.try_get(4)?,
7436 })
7437 },
7438 mapper: |it| ReflectPgRules::from(it),
7439 }
7440 }
7441}
7442pub struct ReflectPgViewsStmt(&'static str, Option<tokio_postgres::Statement>);
7443pub fn reflect_pg_views() -> ReflectPgViewsStmt {
7444 ReflectPgViewsStmt(
7445 "select pg_views.schemaname::text as schemaname, pg_temp.quote_with_namespace(pg_views.schemaname, pg_views.viewname) as viewname, pg_views.viewowner::text as viewowner, pg_views.definition as definition from pg_views where not starts_with(pg_views.schemaname, 'pg_toast')",
7446 None,
7447 )
7448}
7449impl ReflectPgViewsStmt {
7450 pub async fn prepare<'a, C: GenericClient>(
7451 mut self,
7452 client: &'a C,
7453 ) -> Result<Self, tokio_postgres::Error> {
7454 self.1 = Some(client.prepare(self.0).await?);
7455 Ok(self)
7456 }
7457 pub fn bind<'c, 'a, 's, C: GenericClient>(
7458 &'s self,
7459 client: &'c C,
7460 ) -> ReflectPgViewsQuery<'c, 'a, 's, C, ReflectPgViews, 0> {
7461 ReflectPgViewsQuery {
7462 client,
7463 params: [],
7464 query: self.0,
7465 cached: self.1.as_ref(),
7466 extractor: |
7467 row: &tokio_postgres::Row,
7468 | -> Result<ReflectPgViewsBorrowed, tokio_postgres::Error> {
7469 Ok(ReflectPgViewsBorrowed {
7470 schemaname: row.try_get(0)?,
7471 viewname: row.try_get(1)?,
7472 viewowner: row.try_get(2)?,
7473 definition: row.try_get(3)?,
7474 })
7475 },
7476 mapper: |it| ReflectPgViews::from(it),
7477 }
7478 }
7479}
7480pub struct ReflectPgMatviewsStmt(&'static str, Option<tokio_postgres::Statement>);
7481pub fn reflect_pg_matviews() -> ReflectPgMatviewsStmt {
7482 ReflectPgMatviewsStmt(
7483 "select pg_matviews.schemaname::text as schemaname, pg_temp.quote_with_namespace(pg_matviews.schemaname, pg_matviews.matviewname) as matviewname, pg_matviews.matviewowner::text as matviewowner, pg_matviews.definition as definition from pg_matviews",
7484 None,
7485 )
7486}
7487impl ReflectPgMatviewsStmt {
7488 pub async fn prepare<'a, C: GenericClient>(
7489 mut self,
7490 client: &'a C,
7491 ) -> Result<Self, tokio_postgres::Error> {
7492 self.1 = Some(client.prepare(self.0).await?);
7493 Ok(self)
7494 }
7495 pub fn bind<'c, 'a, 's, C: GenericClient>(
7496 &'s self,
7497 client: &'c C,
7498 ) -> ReflectPgMatviewsQuery<'c, 'a, 's, C, ReflectPgMatviews, 0> {
7499 ReflectPgMatviewsQuery {
7500 client,
7501 params: [],
7502 query: self.0,
7503 cached: self.1.as_ref(),
7504 extractor: |
7505 row: &tokio_postgres::Row,
7506 | -> Result<ReflectPgMatviewsBorrowed, tokio_postgres::Error> {
7507 Ok(ReflectPgMatviewsBorrowed {
7508 schemaname: row.try_get(0)?,
7509 matviewname: row.try_get(1)?,
7510 matviewowner: row.try_get(2)?,
7511 definition: row.try_get(3)?,
7512 })
7513 },
7514 mapper: |it| ReflectPgMatviews::from(it),
7515 }
7516 }
7517}
7518pub struct ReflectPgSequenceStmt(&'static str, Option<tokio_postgres::Statement>);
7519pub fn reflect_pg_sequence() -> ReflectPgSequenceStmt {
7520 ReflectPgSequenceStmt(
7521 "select pg_sequence.seqrelid::regclass::text as seqrelid, pg_sequence.seqtypid::regtype::text as seqtypid, pg_sequence.seqstart as seqstart, pg_sequence.seqincrement as seqincrement, pg_sequence.seqmax as seqmax, pg_sequence.seqmin as seqmin, pg_sequence.seqcache as seqcache, pg_sequence.seqcycle as seqcycle from pg_sequence",
7522 None,
7523 )
7524}
7525impl ReflectPgSequenceStmt {
7526 pub async fn prepare<'a, C: GenericClient>(
7527 mut self,
7528 client: &'a C,
7529 ) -> Result<Self, tokio_postgres::Error> {
7530 self.1 = Some(client.prepare(self.0).await?);
7531 Ok(self)
7532 }
7533 pub fn bind<'c, 'a, 's, C: GenericClient>(
7534 &'s self,
7535 client: &'c C,
7536 ) -> ReflectPgSequenceQuery<'c, 'a, 's, C, ReflectPgSequence, 0> {
7537 ReflectPgSequenceQuery {
7538 client,
7539 params: [],
7540 query: self.0,
7541 cached: self.1.as_ref(),
7542 extractor: |
7543 row: &tokio_postgres::Row,
7544 | -> Result<ReflectPgSequenceBorrowed, tokio_postgres::Error> {
7545 Ok(ReflectPgSequenceBorrowed {
7546 seqrelid: row.try_get(0)?,
7547 seqtypid: row.try_get(1)?,
7548 seqstart: row.try_get(2)?,
7549 seqincrement: row.try_get(3)?,
7550 seqmax: row.try_get(4)?,
7551 seqmin: row.try_get(5)?,
7552 seqcache: row.try_get(6)?,
7553 seqcycle: row.try_get(7)?,
7554 })
7555 },
7556 mapper: |it| ReflectPgSequence::from(it),
7557 }
7558 }
7559}
7560pub struct ReflectPgStatisticExtStmt(&'static str, Option<tokio_postgres::Statement>);
7561pub fn reflect_pg_statistic_ext() -> ReflectPgStatisticExtStmt {
7562 ReflectPgStatisticExtStmt(
7563 "select pg_statistic_ext.stxrelid::regclass::text as stxrelid, pg_statistic_ext.stxname::text as stxname, pg_statistic_ext.stxnamespace::regnamespace::text as stxnamespace, pg_get_userbyid(pg_statistic_ext.stxowner)::text as stxowner, pg_statistic_ext.stxkeys as stxkeys, pg_statistic_ext.stxstattarget as stxstattarget, pg_statistic_ext.stxkind as stxkind, pg_get_expr(pg_statistic_ext.stxexprs, pg_statistic_ext.stxrelid) as stxexprs, pg_description.description as description from pg_statistic_ext left join pg_description on pg_description.objoid = pg_statistic_ext.oid and pg_description.objsubid = 0",
7564 None,
7565 )
7566}
7567impl ReflectPgStatisticExtStmt {
7568 pub async fn prepare<'a, C: GenericClient>(
7569 mut self,
7570 client: &'a C,
7571 ) -> Result<Self, tokio_postgres::Error> {
7572 self.1 = Some(client.prepare(self.0).await?);
7573 Ok(self)
7574 }
7575 pub fn bind<'c, 'a, 's, C: GenericClient>(
7576 &'s self,
7577 client: &'c C,
7578 ) -> ReflectPgStatisticExtQuery<'c, 'a, 's, C, ReflectPgStatisticExt, 0> {
7579 ReflectPgStatisticExtQuery {
7580 client,
7581 params: [],
7582 query: self.0,
7583 cached: self.1.as_ref(),
7584 extractor: |
7585 row: &tokio_postgres::Row,
7586 | -> Result<ReflectPgStatisticExtBorrowed, tokio_postgres::Error> {
7587 Ok(ReflectPgStatisticExtBorrowed {
7588 stxrelid: row.try_get(0)?,
7589 stxname: row.try_get(1)?,
7590 stxnamespace: row.try_get(2)?,
7591 stxowner: row.try_get(3)?,
7592 stxkeys: row.try_get(4)?,
7593 stxstattarget: row.try_get(5)?,
7594 stxkind: row.try_get(6)?,
7595 stxexprs: row.try_get(7)?,
7596 description: row.try_get(8)?,
7597 })
7598 },
7599 mapper: |it| ReflectPgStatisticExt::from(it),
7600 }
7601 }
7602}
7603pub struct ReflectPgSubscriptionStmt(&'static str, Option<tokio_postgres::Statement>);
7604pub fn reflect_pg_subscription() -> ReflectPgSubscriptionStmt {
7605 ReflectPgSubscriptionStmt(
7606 "select pg_subscription.subname::text as subname, pg_get_userbyid(pg_subscription.subowner)::text as subowner, pg_subscription.subenabled as subenabled, pg_subscription.subbinary as subbinary, pg_subscription.substream as substream, pg_subscription.subtwophasestate as subtwophasestate, pg_subscription.subdisableonerr as subdisableonerr, pg_subscription.subpasswordrequired as subpasswordrequired, pg_subscription.subrunasowner as subrunasowner, pg_subscription.subfailover as subfailover, pg_subscription.subconninfo as subconninfo, pg_subscription.subslotname::text as subslotname, pg_subscription.subsynccommit as subsynccommit, pg_subscription.subpublications as subpublications, pg_subscription.suborigin as suborigin, pg_description.description as description, pg_seclabel.label as seclabel, pg_seclabel.provider as seclabel_provider from pg_subscription left join pg_description on pg_description.objoid = pg_subscription.oid and pg_description.objsubid = 0 left join pg_seclabel on pg_seclabel.objoid = pg_subscription.oid and pg_seclabel.objsubid = 0 where pg_subscription.subdbid = (select oid from pg_database where datname = current_database())",
7607 None,
7608 )
7609}
7610impl ReflectPgSubscriptionStmt {
7611 pub async fn prepare<'a, C: GenericClient>(
7612 mut self,
7613 client: &'a C,
7614 ) -> Result<Self, tokio_postgres::Error> {
7615 self.1 = Some(client.prepare(self.0).await?);
7616 Ok(self)
7617 }
7618 pub fn bind<'c, 'a, 's, C: GenericClient>(
7619 &'s self,
7620 client: &'c C,
7621 ) -> ReflectPgSubscriptionQuery<'c, 'a, 's, C, ReflectPgSubscription, 0> {
7622 ReflectPgSubscriptionQuery {
7623 client,
7624 params: [],
7625 query: self.0,
7626 cached: self.1.as_ref(),
7627 extractor: |
7628 row: &tokio_postgres::Row,
7629 | -> Result<ReflectPgSubscriptionBorrowed, tokio_postgres::Error> {
7630 Ok(ReflectPgSubscriptionBorrowed {
7631 subname: row.try_get(0)?,
7632 subowner: row.try_get(1)?,
7633 subenabled: row.try_get(2)?,
7634 subbinary: row.try_get(3)?,
7635 substream: row.try_get(4)?,
7636 subtwophasestate: row.try_get(5)?,
7637 subdisableonerr: row.try_get(6)?,
7638 subpasswordrequired: row.try_get(7)?,
7639 subrunasowner: row.try_get(8)?,
7640 subfailover: row.try_get(9)?,
7641 subconninfo: row.try_get(10)?,
7642 subslotname: row.try_get(11)?,
7643 subsynccommit: row.try_get(12)?,
7644 subpublications: row.try_get(13)?,
7645 suborigin: row.try_get(14)?,
7646 description: row.try_get(15)?,
7647 seclabel: row.try_get(16)?,
7648 seclabel_provider: row.try_get(17)?,
7649 })
7650 },
7651 mapper: |it| ReflectPgSubscription::from(it),
7652 }
7653 }
7654}
7655pub struct ReflectPgTransformStmt(&'static str, Option<tokio_postgres::Statement>);
7656pub fn reflect_pg_transform() -> ReflectPgTransformStmt {
7657 ReflectPgTransformStmt(
7658 "select pg_transform.trftype::regtype::text as trftype, trflang_pg_language.lanname::text as trflang, case when trffromsql = 0 then null else trffromsql::regprocedure::text end as trffromsql, case when trftosql = 0 then null else trftosql::regprocedure::text end as trftosql from pg_transform join pg_language as trflang_pg_language on pg_transform.trflang = trflang_pg_language.oid",
7659 None,
7660 )
7661}
7662impl ReflectPgTransformStmt {
7663 pub async fn prepare<'a, C: GenericClient>(
7664 mut self,
7665 client: &'a C,
7666 ) -> Result<Self, tokio_postgres::Error> {
7667 self.1 = Some(client.prepare(self.0).await?);
7668 Ok(self)
7669 }
7670 pub fn bind<'c, 'a, 's, C: GenericClient>(
7671 &'s self,
7672 client: &'c C,
7673 ) -> ReflectPgTransformQuery<'c, 'a, 's, C, ReflectPgTransform, 0> {
7674 ReflectPgTransformQuery {
7675 client,
7676 params: [],
7677 query: self.0,
7678 cached: self.1.as_ref(),
7679 extractor: |
7680 row: &tokio_postgres::Row,
7681 | -> Result<ReflectPgTransformBorrowed, tokio_postgres::Error> {
7682 Ok(ReflectPgTransformBorrowed {
7683 trftype: row.try_get(0)?,
7684 trflang: row.try_get(1)?,
7685 trffromsql: row.try_get(2)?,
7686 trftosql: row.try_get(3)?,
7687 })
7688 },
7689 mapper: |it| ReflectPgTransform::from(it),
7690 }
7691 }
7692}
7693pub struct ReflectPgTriggerStmt(&'static str, Option<tokio_postgres::Statement>);
7694pub fn reflect_pg_trigger() -> ReflectPgTriggerStmt {
7695 ReflectPgTriggerStmt(
7696 "select pg_trigger.tgrelid::regclass::text as tgrelid, tgparentid_pg_trigger.tgname::text as tgparentid, pg_trigger.tgname::text as tgname, pg_trigger.tgfoid::regprocedure::text as tgfoid, pg_trigger.tgtype as tgtype, pg_trigger.tgenabled as tgenabled, pg_trigger.tgisinternal as tgisinternal, case when pg_trigger.tgconstrrelid = 0 then null else pg_trigger.tgconstrrelid::regclass::text end as tgconstrrelid, case when pg_trigger.tgconstrindid = 0 then null else pg_trigger.tgconstrindid::regclass::text end as tgconstrindid, pg_temp.quote_with_namespace(tgconstraint_pg_namespace.nspname, tgconstraint_pg_constraint.conname) as tgconstraint, pg_trigger.tgdeferrable as tgdeferrable, pg_trigger.tginitdeferred as tginitdeferred, pg_trigger.tgnargs as tgnargs, pg_trigger.tgattr as tgattr, pg_trigger.tgargs as tgargs, pg_get_expr(pg_trigger.tgqual, pg_trigger.tgrelid) as tgqual, pg_trigger.tgoldtable::text as tgoldtable, pg_trigger.tgnewtable::text as tgnewtable, pg_description.description as description, pg_seclabel.label as seclabel, pg_seclabel.provider as seclabel_provider from pg_trigger left join pg_trigger as tgparentid_pg_trigger on pg_trigger.tgparentid = tgparentid_pg_trigger.oid left join pg_constraint as tgconstraint_pg_constraint on pg_trigger.tgconstraint = tgconstraint_pg_constraint.oid left join pg_namespace as tgconstraint_pg_namespace on tgconstraint_pg_constraint.connamespace = tgconstraint_pg_namespace.oid left join pg_description on pg_description.objoid = pg_trigger.oid and pg_description.objsubid = 0 left join pg_seclabel on pg_seclabel.objoid = pg_trigger.oid and pg_seclabel.objsubid = 0",
7697 None,
7698 )
7699}
7700impl ReflectPgTriggerStmt {
7701 pub async fn prepare<'a, C: GenericClient>(
7702 mut self,
7703 client: &'a C,
7704 ) -> Result<Self, tokio_postgres::Error> {
7705 self.1 = Some(client.prepare(self.0).await?);
7706 Ok(self)
7707 }
7708 pub fn bind<'c, 'a, 's, C: GenericClient>(
7709 &'s self,
7710 client: &'c C,
7711 ) -> ReflectPgTriggerQuery<'c, 'a, 's, C, ReflectPgTrigger, 0> {
7712 ReflectPgTriggerQuery {
7713 client,
7714 params: [],
7715 query: self.0,
7716 cached: self.1.as_ref(),
7717 extractor: |
7718 row: &tokio_postgres::Row,
7719 | -> Result<ReflectPgTriggerBorrowed, tokio_postgres::Error> {
7720 Ok(ReflectPgTriggerBorrowed {
7721 tgrelid: row.try_get(0)?,
7722 tgparentid: row.try_get(1)?,
7723 tgname: row.try_get(2)?,
7724 tgfoid: row.try_get(3)?,
7725 tgtype: row.try_get(4)?,
7726 tgenabled: row.try_get(5)?,
7727 tgisinternal: row.try_get(6)?,
7728 tgconstrrelid: row.try_get(7)?,
7729 tgconstrindid: row.try_get(8)?,
7730 tgconstraint: row.try_get(9)?,
7731 tgdeferrable: row.try_get(10)?,
7732 tginitdeferred: row.try_get(11)?,
7733 tgnargs: row.try_get(12)?,
7734 tgattr: row.try_get(13)?,
7735 tgargs: row.try_get(14)?,
7736 tgqual: row.try_get(15)?,
7737 tgoldtable: row.try_get(16)?,
7738 tgnewtable: row.try_get(17)?,
7739 description: row.try_get(18)?,
7740 seclabel: row.try_get(19)?,
7741 seclabel_provider: row.try_get(20)?,
7742 })
7743 },
7744 mapper: |it| ReflectPgTrigger::from(it),
7745 }
7746 }
7747}
7748pub struct ReflectPgTsConfigStmt(&'static str, Option<tokio_postgres::Statement>);
7749pub fn reflect_pg_ts_config() -> ReflectPgTsConfigStmt {
7750 ReflectPgTsConfigStmt(
7751 "select pg_ts_config.oid::regconfig::text as oid, pg_ts_config.cfgname::text as cfgname, pg_ts_config.cfgnamespace::regnamespace::text as cfgnamespace, pg_get_userbyid(pg_ts_config.cfgowner)::text as cfgowner, pg_description.description as description, pg_seclabel.label as seclabel, pg_seclabel.provider as seclabel_provider from pg_ts_config left join pg_description on pg_description.objoid = pg_ts_config.oid and pg_description.objsubid = 0 left join pg_seclabel on pg_seclabel.objoid = pg_ts_config.oid and pg_seclabel.objsubid = 0",
7752 None,
7753 )
7754}
7755impl ReflectPgTsConfigStmt {
7756 pub async fn prepare<'a, C: GenericClient>(
7757 mut self,
7758 client: &'a C,
7759 ) -> Result<Self, tokio_postgres::Error> {
7760 self.1 = Some(client.prepare(self.0).await?);
7761 Ok(self)
7762 }
7763 pub fn bind<'c, 'a, 's, C: GenericClient>(
7764 &'s self,
7765 client: &'c C,
7766 ) -> ReflectPgTsConfigQuery<'c, 'a, 's, C, ReflectPgTsConfig, 0> {
7767 ReflectPgTsConfigQuery {
7768 client,
7769 params: [],
7770 query: self.0,
7771 cached: self.1.as_ref(),
7772 extractor: |
7773 row: &tokio_postgres::Row,
7774 | -> Result<ReflectPgTsConfigBorrowed, tokio_postgres::Error> {
7775 Ok(ReflectPgTsConfigBorrowed {
7776 oid: row.try_get(0)?,
7777 cfgname: row.try_get(1)?,
7778 cfgnamespace: row.try_get(2)?,
7779 cfgowner: row.try_get(3)?,
7780 description: row.try_get(4)?,
7781 seclabel: row.try_get(5)?,
7782 seclabel_provider: row.try_get(6)?,
7783 })
7784 },
7785 mapper: |it| ReflectPgTsConfig::from(it),
7786 }
7787 }
7788}
7789pub struct ReflectPgTsConfigMapStmt(&'static str, Option<tokio_postgres::Statement>);
7790pub fn reflect_pg_ts_config_map() -> ReflectPgTsConfigMapStmt {
7791 ReflectPgTsConfigMapStmt(
7792 "select pg_ts_config_map.mapcfg::regconfig::text as mapcfg, pg_ts_config_map.maptokentype as maptokentype, pg_ts_config_map.mapseqno as mapseqno, pg_ts_config_map.mapdict::regdictionary::text as mapdict from pg_ts_config_map",
7793 None,
7794 )
7795}
7796impl ReflectPgTsConfigMapStmt {
7797 pub async fn prepare<'a, C: GenericClient>(
7798 mut self,
7799 client: &'a C,
7800 ) -> Result<Self, tokio_postgres::Error> {
7801 self.1 = Some(client.prepare(self.0).await?);
7802 Ok(self)
7803 }
7804 pub fn bind<'c, 'a, 's, C: GenericClient>(
7805 &'s self,
7806 client: &'c C,
7807 ) -> ReflectPgTsConfigMapQuery<'c, 'a, 's, C, ReflectPgTsConfigMap, 0> {
7808 ReflectPgTsConfigMapQuery {
7809 client,
7810 params: [],
7811 query: self.0,
7812 cached: self.1.as_ref(),
7813 extractor: |
7814 row: &tokio_postgres::Row,
7815 | -> Result<ReflectPgTsConfigMapBorrowed, tokio_postgres::Error> {
7816 Ok(ReflectPgTsConfigMapBorrowed {
7817 mapcfg: row.try_get(0)?,
7818 maptokentype: row.try_get(1)?,
7819 mapseqno: row.try_get(2)?,
7820 mapdict: row.try_get(3)?,
7821 })
7822 },
7823 mapper: |it| ReflectPgTsConfigMap::from(it),
7824 }
7825 }
7826}
7827pub struct ReflectPgTsDictStmt(&'static str, Option<tokio_postgres::Statement>);
7828pub fn reflect_pg_ts_dict() -> ReflectPgTsDictStmt {
7829 ReflectPgTsDictStmt(
7830 "select pg_ts_dict.oid::regdictionary::text as oid, pg_ts_dict.dictname::text as dictname, pg_ts_dict.dictnamespace::regnamespace::text as dictnamespace, pg_get_userbyid(pg_ts_dict.dictowner)::text as dictowner, pg_ts_dict.dictinitoption as dictinitoption, pg_description.description as description, pg_seclabel.label as seclabel, pg_seclabel.provider as seclabel_provider from pg_ts_dict left join pg_description on pg_description.objoid = pg_ts_dict.oid and pg_description.objsubid = 0 left join pg_seclabel on pg_seclabel.objoid = pg_ts_dict.oid and pg_seclabel.objsubid = 0",
7831 None,
7832 )
7833}
7834impl ReflectPgTsDictStmt {
7835 pub async fn prepare<'a, C: GenericClient>(
7836 mut self,
7837 client: &'a C,
7838 ) -> Result<Self, tokio_postgres::Error> {
7839 self.1 = Some(client.prepare(self.0).await?);
7840 Ok(self)
7841 }
7842 pub fn bind<'c, 'a, 's, C: GenericClient>(
7843 &'s self,
7844 client: &'c C,
7845 ) -> ReflectPgTsDictQuery<'c, 'a, 's, C, ReflectPgTsDict, 0> {
7846 ReflectPgTsDictQuery {
7847 client,
7848 params: [],
7849 query: self.0,
7850 cached: self.1.as_ref(),
7851 extractor: |
7852 row: &tokio_postgres::Row,
7853 | -> Result<ReflectPgTsDictBorrowed, tokio_postgres::Error> {
7854 Ok(ReflectPgTsDictBorrowed {
7855 oid: row.try_get(0)?,
7856 dictname: row.try_get(1)?,
7857 dictnamespace: row.try_get(2)?,
7858 dictowner: row.try_get(3)?,
7859 dictinitoption: row.try_get(4)?,
7860 description: row.try_get(5)?,
7861 seclabel: row.try_get(6)?,
7862 seclabel_provider: row.try_get(7)?,
7863 })
7864 },
7865 mapper: |it| ReflectPgTsDict::from(it),
7866 }
7867 }
7868}
7869pub struct ReflectPgTsParserStmt(&'static str, Option<tokio_postgres::Statement>);
7870pub fn reflect_pg_ts_parser() -> ReflectPgTsParserStmt {
7871 ReflectPgTsParserStmt(
7872 "select pg_ts_parser.prsname::text as prsname, pg_ts_parser.prsnamespace::regnamespace::text as prsnamespace, prsstart::regprocedure::text as prsstart, prstoken::regprocedure::text as prstoken, prsend::regprocedure::text as prsend, case when prsheadline = 0 then null else prsheadline::regprocedure::text end as prsheadline, prslextype::regprocedure::text as prslextype from pg_ts_parser",
7873 None,
7874 )
7875}
7876impl ReflectPgTsParserStmt {
7877 pub async fn prepare<'a, C: GenericClient>(
7878 mut self,
7879 client: &'a C,
7880 ) -> Result<Self, tokio_postgres::Error> {
7881 self.1 = Some(client.prepare(self.0).await?);
7882 Ok(self)
7883 }
7884 pub fn bind<'c, 'a, 's, C: GenericClient>(
7885 &'s self,
7886 client: &'c C,
7887 ) -> ReflectPgTsParserQuery<'c, 'a, 's, C, ReflectPgTsParser, 0> {
7888 ReflectPgTsParserQuery {
7889 client,
7890 params: [],
7891 query: self.0,
7892 cached: self.1.as_ref(),
7893 extractor: |
7894 row: &tokio_postgres::Row,
7895 | -> Result<ReflectPgTsParserBorrowed, tokio_postgres::Error> {
7896 Ok(ReflectPgTsParserBorrowed {
7897 prsname: row.try_get(0)?,
7898 prsnamespace: row.try_get(1)?,
7899 prsstart: row.try_get(2)?,
7900 prstoken: row.try_get(3)?,
7901 prsend: row.try_get(4)?,
7902 prsheadline: row.try_get(5)?,
7903 prslextype: row.try_get(6)?,
7904 })
7905 },
7906 mapper: |it| ReflectPgTsParser::from(it),
7907 }
7908 }
7909}
7910pub struct ReflectPgTsTemplateStmt(&'static str, Option<tokio_postgres::Statement>);
7911pub fn reflect_pg_ts_template() -> ReflectPgTsTemplateStmt {
7912 ReflectPgTsTemplateStmt(
7913 "select pg_ts_template.tmplname::text as tmplname, pg_ts_template.tmplnamespace::regnamespace::text as tmplnamespace, case when tmplinit = 0 then null else tmplinit::regprocedure::text end as tmplinit, tmpllexize::regprocedure::text as tmpllexize from pg_ts_template",
7914 None,
7915 )
7916}
7917impl ReflectPgTsTemplateStmt {
7918 pub async fn prepare<'a, C: GenericClient>(
7919 mut self,
7920 client: &'a C,
7921 ) -> Result<Self, tokio_postgres::Error> {
7922 self.1 = Some(client.prepare(self.0).await?);
7923 Ok(self)
7924 }
7925 pub fn bind<'c, 'a, 's, C: GenericClient>(
7926 &'s self,
7927 client: &'c C,
7928 ) -> ReflectPgTsTemplateQuery<'c, 'a, 's, C, ReflectPgTsTemplate, 0> {
7929 ReflectPgTsTemplateQuery {
7930 client,
7931 params: [],
7932 query: self.0,
7933 cached: self.1.as_ref(),
7934 extractor: |
7935 row: &tokio_postgres::Row,
7936 | -> Result<ReflectPgTsTemplateBorrowed, tokio_postgres::Error> {
7937 Ok(ReflectPgTsTemplateBorrowed {
7938 tmplname: row.try_get(0)?,
7939 tmplnamespace: row.try_get(1)?,
7940 tmplinit: row.try_get(2)?,
7941 tmpllexize: row.try_get(3)?,
7942 })
7943 },
7944 mapper: |it| ReflectPgTsTemplate::from(it),
7945 }
7946 }
7947}
7948pub struct ReflectPgTypeStmt(&'static str, Option<tokio_postgres::Statement>);
7949pub fn reflect_pg_type() -> ReflectPgTypeStmt {
7950 ReflectPgTypeStmt(
7951 "select pg_type.oid::regtype::text as oid, pg_type.typname::text as typname, pg_type.typnamespace::regnamespace::text as typnamespace, pg_get_userbyid(pg_type.typowner)::text as typowner, pg_type.typlen as typlen, pg_type.typbyval as typbyval, pg_type.typtype as typtype, pg_type.typispreferred as typispreferred, pg_type.typisdefined as typisdefined, pg_type.typdelim as typdelim, case when pg_type.typrelid = 0 then null else pg_type.typrelid::regclass::text end as typrelid, case when typsubscript = 0 then null else typsubscript::regprocedure::text end as typsubscript, case when pg_type.typelem = 0 then null else pg_type.typelem::regtype::text end as typelem, case when pg_type.typarray = 0 then null else pg_type.typarray::regtype::text end as typarray, typinput::regprocedure::text as typinput, typoutput::regprocedure::text as typoutput, case when typreceive = 0 then null else typreceive::regprocedure::text end as typreceive, case when typsend = 0 then null else typsend::regprocedure::text end as typsend, case when typmodin = 0 then null else typmodin::regprocedure::text end as typmodin, case when typmodout = 0 then null else typmodout::regprocedure::text end as typmodout, case when typanalyze = 0 then null else typanalyze::regprocedure::text end as typanalyze, pg_type.typalign as typalign, pg_type.typstorage as typstorage, pg_type.typnotnull as typnotnull, case when pg_type.typbasetype = 0 then null else pg_type.typbasetype::regtype::text end as typbasetype, case when typtypmod < 0 then null else typtypmod end as typtypmod, pg_type.typndims as typndims, case when pg_type.typcollation = 0 then null else pg_type.typcollation::regcollation::text end as typcollation, pg_get_expr(typdefaultbin, 0) as typdefaultbin, pg_type.typdefault as typdefault, pg_temp.format_type_aclitems(pg_type.typacl) as typacl, pg_description.description as description, pg_seclabel.label as seclabel, pg_seclabel.provider as seclabel_provider, pg_temp.format_type_aclitems(pg_init_privs.initprivs) as initprivs, pg_init_privs.privtype as initprivs_type from pg_type left join pg_description on pg_description.objoid = pg_type.oid and pg_description.objsubid = 0 left join pg_seclabel on pg_seclabel.objoid = pg_type.oid and pg_seclabel.objsubid = 0 left join pg_init_privs on pg_init_privs.objoid = pg_type.oid and pg_init_privs.objsubid = 0",
7952 None,
7953 )
7954}
7955impl ReflectPgTypeStmt {
7956 pub async fn prepare<'a, C: GenericClient>(
7957 mut self,
7958 client: &'a C,
7959 ) -> Result<Self, tokio_postgres::Error> {
7960 self.1 = Some(client.prepare(self.0).await?);
7961 Ok(self)
7962 }
7963 pub fn bind<'c, 'a, 's, C: GenericClient>(
7964 &'s self,
7965 client: &'c C,
7966 ) -> ReflectPgTypeQuery<'c, 'a, 's, C, ReflectPgType, 0> {
7967 ReflectPgTypeQuery {
7968 client,
7969 params: [],
7970 query: self.0,
7971 cached: self.1.as_ref(),
7972 extractor:
7973 |row: &tokio_postgres::Row| -> Result<ReflectPgTypeBorrowed, tokio_postgres::Error> {
7974 Ok(ReflectPgTypeBorrowed {
7975 oid: row.try_get(0)?,
7976 typname: row.try_get(1)?,
7977 typnamespace: row.try_get(2)?,
7978 typowner: row.try_get(3)?,
7979 typlen: row.try_get(4)?,
7980 typbyval: row.try_get(5)?,
7981 typtype: row.try_get(6)?,
7982 typispreferred: row.try_get(7)?,
7983 typisdefined: row.try_get(8)?,
7984 typdelim: row.try_get(9)?,
7985 typrelid: row.try_get(10)?,
7986 typsubscript: row.try_get(11)?,
7987 typelem: row.try_get(12)?,
7988 typarray: row.try_get(13)?,
7989 typinput: row.try_get(14)?,
7990 typoutput: row.try_get(15)?,
7991 typreceive: row.try_get(16)?,
7992 typsend: row.try_get(17)?,
7993 typmodin: row.try_get(18)?,
7994 typmodout: row.try_get(19)?,
7995 typanalyze: row.try_get(20)?,
7996 typalign: row.try_get(21)?,
7997 typstorage: row.try_get(22)?,
7998 typnotnull: row.try_get(23)?,
7999 typbasetype: row.try_get(24)?,
8000 typtypmod: row.try_get(25)?,
8001 typndims: row.try_get(26)?,
8002 typcollation: row.try_get(27)?,
8003 typdefaultbin: row.try_get(28)?,
8004 typdefault: row.try_get(29)?,
8005 typacl: row.try_get(30)?,
8006 description: row.try_get(31)?,
8007 seclabel: row.try_get(32)?,
8008 seclabel_provider: row.try_get(33)?,
8009 initprivs: row.try_get(34)?,
8010 initprivs_type: row.try_get(35)?,
8011 })
8012 },
8013 mapper: |it| ReflectPgType::from(it),
8014 }
8015 }
8016}
8017pub struct ReflectPgUserMappingsStmt(&'static str, Option<tokio_postgres::Statement>);
8018pub fn reflect_pg_user_mappings() -> ReflectPgUserMappingsStmt {
8019 ReflectPgUserMappingsStmt(
8020 "select pg_user_mappings.srvname::text as srvname, case when pg_user_mappings.umuser = 0 then null else pg_get_userbyid(pg_user_mappings.umuser)::text end as umuser, pg_user_mappings.usename::text as usename, pg_user_mappings.umoptions as umoptions from pg_user_mappings",
8021 None,
8022 )
8023}
8024impl ReflectPgUserMappingsStmt {
8025 pub async fn prepare<'a, C: GenericClient>(
8026 mut self,
8027 client: &'a C,
8028 ) -> Result<Self, tokio_postgres::Error> {
8029 self.1 = Some(client.prepare(self.0).await?);
8030 Ok(self)
8031 }
8032 pub fn bind<'c, 'a, 's, C: GenericClient>(
8033 &'s self,
8034 client: &'c C,
8035 ) -> ReflectPgUserMappingsQuery<'c, 'a, 's, C, ReflectPgUserMappings, 0> {
8036 ReflectPgUserMappingsQuery {
8037 client,
8038 params: [],
8039 query: self.0,
8040 cached: self.1.as_ref(),
8041 extractor: |
8042 row: &tokio_postgres::Row,
8043 | -> Result<ReflectPgUserMappingsBorrowed, tokio_postgres::Error> {
8044 Ok(ReflectPgUserMappingsBorrowed {
8045 srvname: row.try_get(0)?,
8046 umuser: row.try_get(1)?,
8047 usename: row.try_get(2)?,
8048 umoptions: row.try_get(3)?,
8049 })
8050 },
8051 mapper: |it| ReflectPgUserMappings::from(it),
8052 }
8053 }
8054}