1use super::*;
2use futures::TryStreamExt;
3
4pub async fn reflect_pg_aggregate(
6 client: &PgClient
7) -> Result<Vec<PgAggregate>, postgres::Error> {
8 let pg_aggregate_coll = queries_crate::queries::query_gen::reflect_pg_aggregate().bind(client)
9 .map(|pg_aggregate| {
10 PgAggregate {
11 aggfnoid: pg_aggregate.aggfnoid.into(),
12 aggkind: PgAggregateAggkind::pg_from_char(pg_aggregate.aggkind),
13 aggnumdirectargs: pg_aggregate.aggnumdirectargs.unsigned_abs(),
14 aggtransfn: pg_aggregate.aggtransfn.into(),
15 aggfinalfn: pg_aggregate.aggfinalfn.map(Into::into),
16 aggcombinefn: pg_aggregate.aggcombinefn.map(Into::into),
17 aggserialfn: pg_aggregate.aggserialfn.map(Into::into),
18 aggdeserialfn: pg_aggregate.aggdeserialfn.map(Into::into),
19 aggmtransfn: pg_aggregate.aggmtransfn.map(Into::into),
20 aggminvtransfn: pg_aggregate.aggminvtransfn.map(Into::into),
21 aggmfinalfn: pg_aggregate.aggmfinalfn.map(Into::into),
22 aggfinalextra: pg_aggregate.aggfinalextra,
23 aggmfinalextra: pg_aggregate.aggmfinalextra,
24 aggfinalmodify: PgAggregateAggfinalmodify::pg_from_char(pg_aggregate.aggfinalmodify),
25 aggmfinalmodify: PgAggregateAggmfinalmodify::pg_from_char(pg_aggregate.aggmfinalmodify),
26 aggsortop: pg_aggregate.aggsortop.map(Into::into),
27 aggtranstype: pg_aggregate.aggtranstype.into(),
28 aggmtranstype: pg_aggregate.aggmtranstype.map(Into::into),
29 agginitval: pg_aggregate.agginitval.map(Into::into),
30 aggminitval: pg_aggregate.aggminitval.map(Into::into),
31 }
32 })
33 .iter().await?.try_collect()
34 .await?;
35
36 Ok(pg_aggregate_coll)
37}
38
39
40pub async fn reflect_pg_am(
42 client: &PgClient
43) -> Result<Set<PgAm>, postgres::Error> {
44 let pg_am_coll = queries_crate::queries::query_gen::reflect_pg_am().bind(client)
45 .map(|pg_am| {
46 PgAm {
47 amname: pg_am.amname.into(),
48 amhandler: pg_am.amhandler.into(),
49 amtype: PgAmAmtype::pg_from_char(pg_am.amtype),
50 description: pg_am.description.map(Into::into),
51 }
52 })
53 .iter().await?.try_collect()
54 .await?;
55
56 Ok(pg_am_coll)
57}
58
59
60pub async fn reflect_pg_amop(
62 client: &PgClient
63) -> Result<Vec<PgAmop>, postgres::Error> {
64 let pg_amop_coll = queries_crate::queries::query_gen::reflect_pg_amop().bind(client)
65 .map(|pg_amop| {
66 PgAmop {
67 amopfamily: pg_amop.amopfamily.into(),
68 amoplefttype: pg_amop.amoplefttype.into(),
69 amoprighttype: pg_amop.amoprighttype.into(),
70 amopstrategy: pg_amop.amopstrategy.unsigned_abs(),
71 amoppurpose: PgAmopAmoppurpose::pg_from_char(pg_amop.amoppurpose),
72 amopopr: pg_amop.amopopr.into(),
73 amopmethod: pg_amop.amopmethod.into(),
74 amopsortfamily: pg_amop.amopsortfamily.map(Into::into),
75 }
76 })
77 .iter().await?.try_collect()
78 .await?;
79
80 Ok(pg_amop_coll)
81}
82
83
84pub async fn reflect_pg_amproc(
86 client: &PgClient
87) -> Result<Vec<PgAmproc>, postgres::Error> {
88 let pg_amproc_coll = queries_crate::queries::query_gen::reflect_pg_amproc().bind(client)
89 .map(|pg_amproc| {
90 PgAmproc {
91 amprocfamily: pg_amproc.amprocfamily.into(),
92 amproclefttype: pg_amproc.amproclefttype.into(),
93 amprocrighttype: pg_amproc.amprocrighttype.into(),
94 amprocnum: pg_amproc.amprocnum.unsigned_abs(),
95 amproc: pg_amproc.amproc.into(),
96 }
97 })
98 .iter().await?.try_collect()
99 .await?;
100
101 Ok(pg_amproc_coll)
102}
103
104
105pub async fn reflect_pg_attrdef(
107 client: &PgClient
108) -> Result<Vec<PgAttrdef>, postgres::Error> {
109 let pg_attrdef_coll = queries_crate::queries::query_gen::reflect_pg_attrdef().bind(client)
110 .map(|pg_attrdef| {
111 PgAttrdef {
112 adrelid: pg_attrdef.adrelid.into(),
113 adnum: pg_attrdef.adnum.unsigned_abs(),
114 adbin: pg_attrdef.adbin.into(),
115 }
116 })
117 .iter().await?.try_collect()
118 .await?;
119
120 Ok(pg_attrdef_coll)
121}
122
123
124pub async fn reflect_pg_attribute(
126 client: &PgClient
127) -> Result<Vec<PgAttribute>, postgres::Error> {
128 let pg_attribute_coll = queries_crate::queries::query_gen::reflect_pg_attribute().bind(client)
129 .map(|pg_attribute| {
130 PgAttribute {
131 attrelid: pg_attribute.attrelid.into(),
132 attname: pg_attribute.attname.into(),
133 atttypid: pg_attribute.atttypid.into(),
134 attnum: pg_attribute.attnum.unsigned_abs(),
135 atttypmod: pg_attribute.atttypmod.map(i32::unsigned_abs),
136 attndims: pg_attribute.attndims.unsigned_abs(),
137 attcompression: pg_attribute.attcompression.map(PgAttributeAttcompression::pg_from_char),
138 attnotnull: pg_attribute.attnotnull,
139 atthasdef: pg_attribute.atthasdef,
140 attidentity: pg_attribute.attidentity.map(PgAttributeAttidentity::pg_from_char),
141 attgenerated: pg_attribute.attgenerated.map(PgAttributeAttgenerated::pg_from_char),
142 attisdropped: pg_attribute.attisdropped,
143 attislocal: pg_attribute.attislocal,
144 attinhcount: pg_attribute.attinhcount.unsigned_abs(),
145 attcollation: pg_attribute.attcollation.map(Into::into),
146 attstattarget: pg_attribute.attstattarget.map(i16::unsigned_abs),
147 attacl: pg_attribute.attacl.map(|attacl| attacl.map(|acl| aclitems!(acl, TableColumnAclItem, TableColumnGrant)).collect()),
148 attoptions: pg_attribute.attoptions.map(|items| items.map(Into::into).collect()),
149 attfdwoptions: pg_attribute.attfdwoptions.map(|items| items.map(Into::into).collect()),
150 description: pg_attribute.description.map(Into::into),
151 seclabel: pg_attribute.seclabel.map(Into::into),
152 seclabel_provider: pg_attribute.seclabel_provider.map(Into::into),
153 initprivs: pg_attribute.initprivs.map(|initprivs| initprivs.map(|acl| aclitems!(acl, TableColumnAclItem, TableColumnGrant)).collect()),
154 initprivs_type: pg_attribute.initprivs_type.map(PgAttributeInitprivsType::pg_from_char),
155 }
156 })
157 .iter().await?.try_collect()
158 .await?;
159
160 Ok(pg_attribute_coll)
161}
162
163
164pub async fn reflect_pg_roles(
166 client: &PgClient
167) -> Result<Set<PgRoles>, postgres::Error> {
168 let pg_roles_coll = queries_crate::queries::query_gen::reflect_pg_roles().bind(client)
169 .map(|pg_roles| {
170 PgRoles {
171 rolname: pg_roles.rolname.into(),
172 rolsuper: pg_roles.rolsuper,
173 rolinherit: pg_roles.rolinherit,
174 rolcreaterole: pg_roles.rolcreaterole,
175 rolcreatedb: pg_roles.rolcreatedb,
176 rolcanlogin: pg_roles.rolcanlogin,
177 rolreplication: pg_roles.rolreplication,
178 rolconnlimit: pg_roles.rolconnlimit.map(i32::unsigned_abs),
179 rolvaliduntil: pg_roles.rolvaliduntil,
180 rolbypassrls: pg_roles.rolbypassrls,
181 rolconfig: pg_roles.rolconfig.map(|items| items.map(Into::into).collect()),
182 description: pg_roles.description.map(Into::into),
183 seclabel: pg_roles.seclabel.map(Into::into),
184 seclabel_provider: pg_roles.seclabel_provider.map(Into::into),
185 }
186 })
187 .iter().await?.try_collect()
188 .await?;
189
190 Ok(pg_roles_coll)
191}
192
193
194pub async fn reflect_pg_auth_members(
196 client: &PgClient
197) -> Result<Vec<PgAuthMembers>, postgres::Error> {
198 let pg_auth_members_coll = queries_crate::queries::query_gen::reflect_pg_auth_members().bind(client)
199 .map(|pg_auth_members| {
200 PgAuthMembers {
201 roleid: pg_auth_members.roleid.into(),
202 member: pg_auth_members.member.into(),
203 grantor: pg_auth_members.grantor.into(),
204 admin_option: pg_auth_members.admin_option,
205 inherit_option: pg_auth_members.inherit_option,
206 set_option: pg_auth_members.set_option,
207 }
208 })
209 .iter().await?.try_collect()
210 .await?;
211
212 Ok(pg_auth_members_coll)
213}
214
215
216pub async fn reflect_pg_cast(
218 client: &PgClient
219) -> Result<Vec<PgCast>, postgres::Error> {
220 let pg_cast_coll = queries_crate::queries::query_gen::reflect_pg_cast().bind(client)
221 .map(|pg_cast| {
222 PgCast {
223 castsource: pg_cast.castsource.into(),
224 casttarget: pg_cast.casttarget.into(),
225 castfunc: pg_cast.castfunc.map(Into::into),
226 castcontext: PgCastCastcontext::pg_from_char(pg_cast.castcontext),
227 castmethod: PgCastCastmethod::pg_from_char(pg_cast.castmethod),
228 description: pg_cast.description.map(Into::into),
229 }
230 })
231 .iter().await?.try_collect()
232 .await?;
233
234 Ok(pg_cast_coll)
235}
236
237
238pub async fn reflect_pg_class(
240 client: &PgClient
241) -> Result<Set<PgClass>, postgres::Error> {
242 let pg_class_coll = queries_crate::queries::query_gen::reflect_pg_class().bind(client)
243 .map(|pg_class| {
244 PgClass {
245 oid: pg_class.oid.into(),
246 relname: pg_class.relname.into(),
247 relnamespace: pg_class.relnamespace.into(),
248 reltype: pg_class.reltype.map(Into::into),
249 reloftype: pg_class.reloftype.map(Into::into),
250 relowner: pg_class.relowner.into(),
251 relam: pg_class.relam.map(Into::into),
252 relisshared: pg_class.relisshared,
253 relpersistence: PgClassRelpersistence::pg_from_char(pg_class.relpersistence),
254 relkind: PgClassRelkind::pg_from_char(pg_class.relkind),
255 relnatts: pg_class.relnatts.unsigned_abs(),
256 relchecks: pg_class.relchecks.unsigned_abs(),
257 relrowsecurity: pg_class.relrowsecurity,
258 relforcerowsecurity: pg_class.relforcerowsecurity,
259 relreplident: PgClassRelreplident::pg_from_char(pg_class.relreplident),
260 relispartition: pg_class.relispartition,
261 relacl: pg_class.relacl.map(|relacl| relacl.map(|acl| aclitems!(acl, TableAclItem, TableGrant)).collect()),
262 reloptions: pg_class.reloptions.map(|items| items.map(Into::into).collect()),
263 relpartbound: pg_class.relpartbound.map(Into::into),
264 description: pg_class.description.map(Into::into),
265 seclabel: pg_class.seclabel.map(Into::into),
266 seclabel_provider: pg_class.seclabel_provider.map(Into::into),
267 initprivs: pg_class.initprivs.map(|initprivs| initprivs.map(|acl| aclitems!(acl, TableAclItem, TableGrant)).collect()),
268 initprivs_type: pg_class.initprivs_type.map(PgClassInitprivsType::pg_from_char),
269 }
270 })
271 .iter().await?.try_collect()
272 .await?;
273
274 Ok(pg_class_coll)
275}
276
277
278pub async fn reflect_pg_collation(
280 client: &PgClient
281) -> Result<Vec<PgCollation>, postgres::Error> {
282 let pg_collation_coll = queries_crate::queries::query_gen::reflect_pg_collation().bind(client)
283 .map(|pg_collation| {
284 PgCollation {
285 oid: pg_collation.oid.into(),
286 collname: pg_collation.collname.into(),
287 collnamespace: pg_collation.collnamespace.into(),
288 collowner: pg_collation.collowner.into(),
289 collprovider: PgCollationCollprovider::pg_from_char(pg_collation.collprovider),
290 collisdeterministic: pg_collation.collisdeterministic,
291 collencoding: pg_collation.collencoding.map(Into::into),
292 collcollate: pg_collation.collcollate.map(Into::into),
293 collctype: pg_collation.collctype.map(Into::into),
294 colllocale: pg_collation.colllocale.map(Into::into),
295 collicurules: pg_collation.collicurules.map(Into::into),
296 description: pg_collation.description.map(Into::into),
297 }
298 })
299 .iter().await?.try_collect()
300 .await?;
301
302 Ok(pg_collation_coll)
303}
304
305
306pub async fn reflect_pg_constraint(
308 client: &PgClient
309) -> Result<Vec<PgConstraint>, postgres::Error> {
310 let pg_constraint_coll = queries_crate::queries::query_gen::reflect_pg_constraint().bind(client)
311 .map(|pg_constraint| {
312 PgConstraint {
313 conname: pg_constraint.conname.into(),
314 connamespace: pg_constraint.connamespace.into(),
315 contype: PgConstraintContype::pg_from_char(pg_constraint.contype),
316 condeferrable: pg_constraint.condeferrable,
317 condeferred: pg_constraint.condeferred,
318 convalidated: pg_constraint.convalidated,
319 conrelid: pg_constraint.conrelid.map(Into::into),
320 contypid: pg_constraint.contypid.map(Into::into),
321 conindid: pg_constraint.conindid.map(Into::into),
322 conparentid: pg_constraint.conparentid.map(Into::into),
323 confrelid: pg_constraint.confrelid.map(Into::into),
324 confupdtype: pg_constraint.confupdtype.map(PgConstraintConfupdtype::pg_from_char),
325 confdeltype: pg_constraint.confdeltype.map(PgConstraintConfdeltype::pg_from_char),
326 confmatchtype: pg_constraint.confmatchtype.map(PgConstraintConfmatchtype::pg_from_char),
327 conislocal: pg_constraint.conislocal,
328 coninhcount: pg_constraint.coninhcount.unsigned_abs(),
329 connoinherit: pg_constraint.connoinherit,
330 conkey: pg_constraint.conkey.map(|items| items.map(i16::unsigned_abs).collect()),
331 confkey: pg_constraint.confkey.map(|items| items.map(i16::unsigned_abs).collect()),
332 conpfeqop: pg_constraint.conpfeqop.map(|items| items.map(Str::new).collect()),
333 conppeqop: pg_constraint.conppeqop.map(|items| items.map(Str::new).collect()),
334 conffeqop: pg_constraint.conffeqop.map(|items| items.map(Str::new).collect()),
335 confdelsetcols: pg_constraint.confdelsetcols.map(|items| items.map(i16::unsigned_abs).collect()),
336 conexclop: pg_constraint.conexclop.map(|items| items.map(Str::new).collect()),
337 conbin: pg_constraint.conbin.map(Into::into),
338 description: pg_constraint.description.map(Into::into),
339 }
340 })
341 .iter().await?.try_collect()
342 .await?;
343
344 Ok(pg_constraint_coll)
345}
346
347
348pub async fn reflect_pg_conversion(
350 client: &PgClient
351) -> Result<Vec<PgConversion>, postgres::Error> {
352 let pg_conversion_coll = queries_crate::queries::query_gen::reflect_pg_conversion().bind(client)
353 .map(|pg_conversion| {
354 PgConversion {
355 conname: pg_conversion.conname.into(),
356 connamespace: pg_conversion.connamespace.into(),
357 conowner: pg_conversion.conowner.into(),
358 conforencoding: pg_conversion.conforencoding.into(),
359 contoencoding: pg_conversion.contoencoding.into(),
360 conproc: pg_conversion.conproc.into(),
361 condefault: pg_conversion.condefault,
362 description: pg_conversion.description.map(Into::into),
363 }
364 })
365 .iter().await?.try_collect()
366 .await?;
367
368 Ok(pg_conversion_coll)
369}
370
371
372pub async fn reflect_pg_database(
374 client: &PgClient
375) -> Result<PgDatabase, postgres::Error> {
376 let pg_database_coll = queries_crate::queries::query_gen::reflect_pg_database().bind(client)
377 .map(|pg_database| {
378 PgDatabase {
379 datname: pg_database.datname.into(),
380 datdba: pg_database.datdba.into(),
381 encoding: pg_database.encoding.into(),
382 datlocprovider: PgDatabaseDatlocprovider::pg_from_char(pg_database.datlocprovider),
383 datistemplate: pg_database.datistemplate,
384 datallowconn: pg_database.datallowconn,
385 datconnlimit: pg_database.datconnlimit.map(i32::unsigned_abs),
386 datcollate: pg_database.datcollate.map(Into::into),
387 datctype: pg_database.datctype.map(Into::into),
388 datlocale: pg_database.datlocale.map(Into::into),
389 daticurules: pg_database.daticurules.map(Into::into),
390 datacl: pg_database.datacl.map(|datacl| datacl.map(|acl| aclitems!(acl, DbAclItem, DbGrant)).collect()),
391 description: pg_database.description.map(Into::into),
392 seclabel: pg_database.seclabel.map(Into::into),
393 seclabel_provider: pg_database.seclabel_provider.map(Into::into),
394 }
395 })
396 .one()
397 .await?;
398
399 Ok(pg_database_coll)
400}
401
402
403pub async fn reflect_pg_default_acl(
405 client: &PgClient
406) -> Result<Vec<PgDefaultAcl>, postgres::Error> {
407 let pg_default_acl_coll = queries_crate::queries::query_gen::reflect_pg_default_acl().bind(client)
408 .map(|pg_default_acl| {
409 PgDefaultAcl {
410 defaclrole: pg_default_acl.defaclrole.into(),
411 defaclnamespace: pg_default_acl.defaclnamespace.map(Into::into),
412 defaclobjtype: PgDefaultAclDefaclobjtype::pg_from_char(pg_default_acl.defaclobjtype),
413 defaclacl: pg_default_acl.defaclacl.map(|defaclacl| defaclacl.map(|acl| aclitems!(acl, AclDefaultAclItem, AclDefaultGrant)).collect()),
414 }
415 })
416 .iter().await?.try_collect()
417 .await?;
418
419 Ok(pg_default_acl_coll)
420}
421
422
423pub async fn reflect_pg_event_trigger(
425 client: &PgClient
426) -> Result<Vec<PgEventTrigger>, postgres::Error> {
427 let pg_event_trigger_coll = queries_crate::queries::query_gen::reflect_pg_event_trigger().bind(client)
428 .map(|pg_event_trigger| {
429 PgEventTrigger {
430 evtname: pg_event_trigger.evtname.into(),
431 evtevent: pg_event_trigger.evtevent.into(),
432 evtowner: pg_event_trigger.evtowner.into(),
433 evtfoid: pg_event_trigger.evtfoid.into(),
434 evtenabled: PgEventTriggerEvtenabled::pg_from_char(pg_event_trigger.evtenabled),
435 evttags: pg_event_trigger.evttags.map(|items| items.map(Into::into).collect()),
436 description: pg_event_trigger.description.map(Into::into),
437 seclabel: pg_event_trigger.seclabel.map(Into::into),
438 seclabel_provider: pg_event_trigger.seclabel_provider.map(Into::into),
439 }
440 })
441 .iter().await?.try_collect()
442 .await?;
443
444 Ok(pg_event_trigger_coll)
445}
446
447
448pub async fn reflect_pg_extension(
450 client: &PgClient
451) -> Result<Vec<PgExtension>, postgres::Error> {
452 let pg_extension_coll = queries_crate::queries::query_gen::reflect_pg_extension().bind(client)
453 .map(|pg_extension| {
454 PgExtension {
455 extname: pg_extension.extname.into(),
456 extowner: pg_extension.extowner.into(),
457 extnamespace: pg_extension.extnamespace.into(),
458 extrelocatable: pg_extension.extrelocatable,
459 extversion: pg_extension.extversion.into(),
460 extconfig: pg_extension.extconfig.map(|items| items.map(Str::new).collect()),
461 extcondition: pg_extension.extcondition.map(|items| items.map(Into::into).collect()),
462 description: pg_extension.description.map(Into::into),
463 }
464 })
465 .iter().await?.try_collect()
466 .await?;
467
468 Ok(pg_extension_coll)
469}
470
471
472pub async fn reflect_pg_foreign_data_wrapper(
474 client: &PgClient
475) -> Result<Vec<PgForeignDataWrapper>, postgres::Error> {
476 let pg_foreign_data_wrapper_coll = queries_crate::queries::query_gen::reflect_pg_foreign_data_wrapper().bind(client)
477 .map(|pg_foreign_data_wrapper| {
478 PgForeignDataWrapper {
479 fdwname: pg_foreign_data_wrapper.fdwname.into(),
480 fdwowner: pg_foreign_data_wrapper.fdwowner.into(),
481 fdwhandler: pg_foreign_data_wrapper.fdwhandler.map(Into::into),
482 fdwvalidator: pg_foreign_data_wrapper.fdwvalidator.map(Into::into),
483 fdwacl: pg_foreign_data_wrapper.fdwacl.map(|fdwacl| fdwacl.map(|acl| aclitems!(acl, ForeignDataWrapperAclItem, ForeignDataWrapperGrant)).collect()),
484 fdwoptions: pg_foreign_data_wrapper.fdwoptions.map(|items| items.map(Into::into).collect()),
485 description: pg_foreign_data_wrapper.description.map(Into::into),
486 initprivs: pg_foreign_data_wrapper.initprivs.map(|initprivs| initprivs.map(|acl| aclitems!(acl, ForeignDataWrapperAclItem, ForeignDataWrapperGrant)).collect()),
487 initprivs_type: pg_foreign_data_wrapper.initprivs_type.map(PgForeignDataWrapperInitprivsType::pg_from_char),
488 }
489 })
490 .iter().await?.try_collect()
491 .await?;
492
493 Ok(pg_foreign_data_wrapper_coll)
494}
495
496
497pub async fn reflect_pg_foreign_server(
499 client: &PgClient
500) -> Result<Vec<PgForeignServer>, postgres::Error> {
501 let pg_foreign_server_coll = queries_crate::queries::query_gen::reflect_pg_foreign_server().bind(client)
502 .map(|pg_foreign_server| {
503 PgForeignServer {
504 srvname: pg_foreign_server.srvname.into(),
505 srvowner: pg_foreign_server.srvowner.into(),
506 srvfdw: pg_foreign_server.srvfdw.into(),
507 srvtype: pg_foreign_server.srvtype.map(Into::into),
508 srvversion: pg_foreign_server.srvversion.map(Into::into),
509 srvacl: pg_foreign_server.srvacl.map(|srvacl| srvacl.map(|acl| aclitems!(acl, ForeignServerAclItem, ForeignServerGrant)).collect()),
510 srvoptions: pg_foreign_server.srvoptions.map(|items| items.map(Into::into).collect()),
511 description: pg_foreign_server.description.map(Into::into),
512 initprivs: pg_foreign_server.initprivs.map(|initprivs| initprivs.map(|acl| aclitems!(acl, ForeignServerAclItem, ForeignServerGrant)).collect()),
513 initprivs_type: pg_foreign_server.initprivs_type.map(PgForeignServerInitprivsType::pg_from_char),
514 }
515 })
516 .iter().await?.try_collect()
517 .await?;
518
519 Ok(pg_foreign_server_coll)
520}
521
522
523pub async fn reflect_pg_foreign_table(
525 client: &PgClient
526) -> Result<Vec<PgForeignTable>, postgres::Error> {
527 let pg_foreign_table_coll = queries_crate::queries::query_gen::reflect_pg_foreign_table().bind(client)
528 .map(|pg_foreign_table| {
529 PgForeignTable {
530 ftrelid: pg_foreign_table.ftrelid.into(),
531 ftserver: pg_foreign_table.ftserver.into(),
532 ftoptions: pg_foreign_table.ftoptions.map(|items| items.map(Into::into).collect()),
533 }
534 })
535 .iter().await?.try_collect()
536 .await?;
537
538 Ok(pg_foreign_table_coll)
539}
540
541
542pub async fn reflect_pg_index(
544 client: &PgClient
545) -> Result<Vec<PgIndex>, postgres::Error> {
546 let pg_index_coll = queries_crate::queries::query_gen::reflect_pg_index().bind(client)
547 .map(|pg_index| {
548 PgIndex {
549 indexrelid: pg_index.indexrelid.into(),
550 indrelid: pg_index.indrelid.into(),
551 indnatts: pg_index.indnatts.unsigned_abs(),
552 indnkeyatts: pg_index.indnkeyatts.unsigned_abs(),
553 indisunique: pg_index.indisunique,
554 indnullsnotdistinct: pg_index.indnullsnotdistinct,
555 indisprimary: pg_index.indisprimary,
556 indisexclusion: pg_index.indisexclusion,
557 indimmediate: pg_index.indimmediate,
558 indisreplident: pg_index.indisreplident,
559 indkey: pg_index.indkey.map(i16::unsigned_abs).collect(),
560 indcollation: pg_index.indcollation.map(maybe_str).collect(),
561 indclass: pg_index.indclass.map(Str::new).collect(),
562 indoption: pg_index.indoption.collect(),
563 indexprs: pg_index.indexprs.map(Into::into),
564 indpred: pg_index.indpred.map(Into::into),
565 }
566 })
567 .iter().await?.try_collect()
568 .await?;
569
570 Ok(pg_index_coll)
571}
572
573
574pub async fn reflect_pg_inherits(
576 client: &PgClient
577) -> Result<Vec<PgInherits>, postgres::Error> {
578 let pg_inherits_coll = queries_crate::queries::query_gen::reflect_pg_inherits().bind(client)
579 .map(|pg_inherits| {
580 PgInherits {
581 inhrelid: pg_inherits.inhrelid.into(),
582 inhparent: pg_inherits.inhparent.into(),
583 inhseqno: pg_inherits.inhseqno.unsigned_abs(),
584 }
585 })
586 .iter().await?.try_collect()
587 .await?;
588
589 Ok(pg_inherits_coll)
590}
591
592
593pub async fn reflect_pg_language(
595 client: &PgClient
596) -> Result<Set<PgLanguage>, postgres::Error> {
597 let pg_language_coll = queries_crate::queries::query_gen::reflect_pg_language().bind(client)
598 .map(|pg_language| {
599 PgLanguage {
600 lanname: pg_language.lanname.into(),
601 lanowner: pg_language.lanowner.into(),
602 lanispl: pg_language.lanispl,
603 lanpltrusted: pg_language.lanpltrusted,
604 lanplcallfoid: pg_language.lanplcallfoid.map(Into::into),
605 laninline: pg_language.laninline.map(Into::into),
606 lanvalidator: pg_language.lanvalidator.map(Into::into),
607 lanacl: pg_language.lanacl.map(|lanacl| lanacl.map(|acl| aclitems!(acl, LanguageAclItem, LanguageGrant)).collect()),
608 description: pg_language.description.map(Into::into),
609 seclabel: pg_language.seclabel.map(Into::into),
610 seclabel_provider: pg_language.seclabel_provider.map(Into::into),
611 initprivs: pg_language.initprivs.map(|initprivs| initprivs.map(|acl| aclitems!(acl, LanguageAclItem, LanguageGrant)).collect()),
612 initprivs_type: pg_language.initprivs_type.map(PgLanguageInitprivsType::pg_from_char),
613 }
614 })
615 .iter().await?.try_collect()
616 .await?;
617
618 Ok(pg_language_coll)
619}
620
621
622pub async fn reflect_pg_namespace(
624 client: &PgClient
625) -> Result<Set<PgNamespace>, postgres::Error> {
626 let pg_namespace_coll = queries_crate::queries::query_gen::reflect_pg_namespace().bind(client)
627 .map(|pg_namespace| {
628 PgNamespace {
629 nspname: pg_namespace.nspname.into(),
630 nspowner: pg_namespace.nspowner.into(),
631 nspacl: pg_namespace.nspacl.map(|nspacl| nspacl.map(|acl| aclitems!(acl, SchemaAclItem, SchemaGrant)).collect()),
632 description: pg_namespace.description.map(Into::into),
633 seclabel: pg_namespace.seclabel.map(Into::into),
634 seclabel_provider: pg_namespace.seclabel_provider.map(Into::into),
635 initprivs: pg_namespace.initprivs.map(|initprivs| initprivs.map(|acl| aclitems!(acl, SchemaAclItem, SchemaGrant)).collect()),
636 initprivs_type: pg_namespace.initprivs_type.map(PgNamespaceInitprivsType::pg_from_char),
637 }
638 })
639 .iter().await?.try_collect()
640 .await?;
641
642 Ok(pg_namespace_coll)
643}
644
645
646pub async fn reflect_pg_opclass(
648 client: &PgClient
649) -> Result<Vec<PgOpclass>, postgres::Error> {
650 let pg_opclass_coll = queries_crate::queries::query_gen::reflect_pg_opclass().bind(client)
651 .map(|pg_opclass| {
652 PgOpclass {
653 opcmethod: pg_opclass.opcmethod.into(),
654 opcname: pg_opclass.opcname.into(),
655 opcnamespace: pg_opclass.opcnamespace.into(),
656 opcowner: pg_opclass.opcowner.into(),
657 opcfamily: pg_opclass.opcfamily.into(),
658 opcintype: pg_opclass.opcintype.into(),
659 opcdefault: pg_opclass.opcdefault,
660 opckeytype: pg_opclass.opckeytype.map(Into::into),
661 description: pg_opclass.description.map(Into::into),
662 }
663 })
664 .iter().await?.try_collect()
665 .await?;
666
667 Ok(pg_opclass_coll)
668}
669
670
671pub async fn reflect_pg_operator(
673 client: &PgClient
674) -> Result<Set<PgOperator>, postgres::Error> {
675 let pg_operator_coll = queries_crate::queries::query_gen::reflect_pg_operator().bind(client)
676 .map(|pg_operator| {
677 PgOperator {
678 oid: pg_operator.oid.into(),
679 oprname: pg_operator.oprname.into(),
680 oprnamespace: pg_operator.oprnamespace.into(),
681 oprowner: pg_operator.oprowner.into(),
682 oprkind: PgOperatorOprkind::pg_from_char(pg_operator.oprkind),
683 oprcanmerge: pg_operator.oprcanmerge,
684 oprcanhash: pg_operator.oprcanhash,
685 oprleft: pg_operator.oprleft.map(Into::into),
686 oprright: pg_operator.oprright.into(),
687 oprresult: pg_operator.oprresult.map(Into::into),
688 oprcom: pg_operator.oprcom.map(Into::into),
689 oprnegate: pg_operator.oprnegate.map(Into::into),
690 oprcode: pg_operator.oprcode.map(Into::into),
691 oprrest: pg_operator.oprrest.map(Into::into),
692 oprjoin: pg_operator.oprjoin.map(Into::into),
693 description: pg_operator.description.map(Into::into),
694 }
695 })
696 .iter().await?.try_collect()
697 .await?;
698
699 Ok(pg_operator_coll)
700}
701
702
703pub async fn reflect_pg_opfamily(
705 client: &PgClient
706) -> Result<Vec<PgOpfamily>, postgres::Error> {
707 let pg_opfamily_coll = queries_crate::queries::query_gen::reflect_pg_opfamily().bind(client)
708 .map(|pg_opfamily| {
709 PgOpfamily {
710 opfmethod: pg_opfamily.opfmethod.into(),
711 opfname: pg_opfamily.opfname.into(),
712 opfnamespace: pg_opfamily.opfnamespace.into(),
713 opfowner: pg_opfamily.opfowner.into(),
714 description: pg_opfamily.description.map(Into::into),
715 }
716 })
717 .iter().await?.try_collect()
718 .await?;
719
720 Ok(pg_opfamily_coll)
721}
722
723
724pub async fn reflect_pg_parameter_acl(
726 client: &PgClient
727) -> Result<Vec<PgParameterAcl>, postgres::Error> {
728 let pg_parameter_acl_coll = queries_crate::queries::query_gen::reflect_pg_parameter_acl().bind(client)
729 .map(|pg_parameter_acl| {
730 PgParameterAcl {
731 parname: pg_parameter_acl.parname.into(),
732 paracl: pg_parameter_acl.paracl.map(|paracl| paracl.map(|acl| aclitems!(acl, ParameterAclItem, ParameterGrant)).collect()),
733 initprivs: pg_parameter_acl.initprivs.map(|initprivs| initprivs.map(|acl| aclitems!(acl, ParameterAclItem, ParameterGrant)).collect()),
734 initprivs_type: pg_parameter_acl.initprivs_type.map(PgParameterAclInitprivsType::pg_from_char),
735 }
736 })
737 .iter().await?.try_collect()
738 .await?;
739
740 Ok(pg_parameter_acl_coll)
741}
742
743
744pub async fn reflect_pg_partitioned_table(
746 client: &PgClient
747) -> Result<Vec<PgPartitionedTable>, postgres::Error> {
748 let pg_partitioned_table_coll = queries_crate::queries::query_gen::reflect_pg_partitioned_table().bind(client)
749 .map(|pg_partitioned_table| {
750 PgPartitionedTable {
751 partrelid: pg_partitioned_table.partrelid.into(),
752 partstrat: PgPartitionedTablePartstrat::pg_from_char(pg_partitioned_table.partstrat),
753 partnatts: pg_partitioned_table.partnatts.unsigned_abs(),
754 partdefid: pg_partitioned_table.partdefid.map(Into::into),
755 partattrs: pg_partitioned_table.partattrs.map(i16::unsigned_abs).collect(),
756 partclass: pg_partitioned_table.partclass.map(Str::new).collect(),
757 partcollation: pg_partitioned_table.partcollation.map(maybe_str).collect(),
758 partexprs: pg_partitioned_table.partexprs.map(Into::into),
759 }
760 })
761 .iter().await?.try_collect()
762 .await?;
763
764 Ok(pg_partitioned_table_coll)
765}
766
767
768pub async fn reflect_pg_policy(
770 client: &PgClient
771) -> Result<Vec<PgPolicy>, postgres::Error> {
772 let pg_policy_coll = queries_crate::queries::query_gen::reflect_pg_policy().bind(client)
773 .map(|pg_policy| {
774 PgPolicy {
775 polname: pg_policy.polname.into(),
776 polrelid: pg_policy.polrelid.into(),
777 polcmd: PgPolicyPolcmd::pg_from_char(pg_policy.polcmd),
778 polpermissive: pg_policy.polpermissive,
779 polroles: pg_policy.polroles.map(|item| item.map(Into::into)).collect(),
780 polqual: pg_policy.polqual.map(Into::into),
781 polwithcheck: pg_policy.polwithcheck.map(Into::into),
782 description: pg_policy.description.map(Into::into),
783 }
784 })
785 .iter().await?.try_collect()
786 .await?;
787
788 Ok(pg_policy_coll)
789}
790
791
792pub async fn reflect_pg_publication(
794 client: &PgClient
795) -> Result<Set<PgPublication>, postgres::Error> {
796 let pg_publication_coll = queries_crate::queries::query_gen::reflect_pg_publication().bind(client)
797 .map(|pg_publication| {
798 PgPublication {
799 pubname: pg_publication.pubname.into(),
800 pubowner: pg_publication.pubowner.into(),
801 puballtables: pg_publication.puballtables,
802 pubinsert: pg_publication.pubinsert,
803 pubupdate: pg_publication.pubupdate,
804 pubdelete: pg_publication.pubdelete,
805 pubtruncate: pg_publication.pubtruncate,
806 pubviaroot: pg_publication.pubviaroot,
807 description: pg_publication.description.map(Into::into),
808 seclabel: pg_publication.seclabel.map(Into::into),
809 seclabel_provider: pg_publication.seclabel_provider.map(Into::into),
810 }
811 })
812 .iter().await?.try_collect()
813 .await?;
814
815 Ok(pg_publication_coll)
816}
817
818
819pub async fn reflect_pg_publication_namespace(
821 client: &PgClient
822) -> Result<Vec<PgPublicationNamespace>, postgres::Error> {
823 let pg_publication_namespace_coll = queries_crate::queries::query_gen::reflect_pg_publication_namespace().bind(client)
824 .map(|pg_publication_namespace| {
825 PgPublicationNamespace {
826 pnpubid: pg_publication_namespace.pnpubid.into(),
827 pnnspid: pg_publication_namespace.pnnspid.into(),
828 }
829 })
830 .iter().await?.try_collect()
831 .await?;
832
833 Ok(pg_publication_namespace_coll)
834}
835
836
837pub async fn reflect_pg_publication_rel(
839 client: &PgClient
840) -> Result<Vec<PgPublicationRel>, postgres::Error> {
841 let pg_publication_rel_coll = queries_crate::queries::query_gen::reflect_pg_publication_rel().bind(client)
842 .map(|pg_publication_rel| {
843 PgPublicationRel {
844 prpubid: pg_publication_rel.prpubid.into(),
845 prrelid: pg_publication_rel.prrelid.into(),
846 prqual: pg_publication_rel.prqual.map(Into::into),
847 prattrs: pg_publication_rel.prattrs.map(|items| items.map(i16::unsigned_abs).collect()),
848 }
849 })
850 .iter().await?.try_collect()
851 .await?;
852
853 Ok(pg_publication_rel_coll)
854}
855
856
857pub async fn reflect_pg_range(
859 client: &PgClient
860) -> Result<Vec<PgRange>, postgres::Error> {
861 let pg_range_coll = queries_crate::queries::query_gen::reflect_pg_range().bind(client)
862 .map(|pg_range| {
863 PgRange {
864 rngtypid: pg_range.rngtypid.into(),
865 rngsubtype: pg_range.rngsubtype.into(),
866 rngmultitypid: pg_range.rngmultitypid.into(),
867 rngcollation: pg_range.rngcollation.map(Into::into),
868 rngsubopc: pg_range.rngsubopc.into(),
869 rngcanonical: pg_range.rngcanonical.map(Into::into),
870 rngsubdiff: pg_range.rngsubdiff.map(Into::into),
871 }
872 })
873 .iter().await?.try_collect()
874 .await?;
875
876 Ok(pg_range_coll)
877}
878
879
880pub async fn reflect_pg_rules(
882 client: &PgClient
883) -> Result<Vec<PgRules>, postgres::Error> {
884 let pg_rules_coll = queries_crate::queries::query_gen::reflect_pg_rules().bind(client)
885 .map(|pg_rules| {
886 PgRules {
887 schemaname: pg_rules.schemaname.into(),
888 tablename: pg_rules.tablename.into(),
889 rulename: pg_rules.rulename.into(),
890 definition: pg_rules.definition.into(),
891 description: pg_rules.description.map(Into::into),
892 }
893 })
894 .iter().await?.try_collect()
895 .await?;
896
897 Ok(pg_rules_coll)
898}
899
900
901pub async fn reflect_pg_views(
903 client: &PgClient
904) -> Result<Vec<PgViews>, postgres::Error> {
905 let pg_views_coll = queries_crate::queries::query_gen::reflect_pg_views().bind(client)
906 .map(|pg_views| {
907 PgViews {
908 schemaname: pg_views.schemaname.into(),
909 viewname: pg_views.viewname.into(),
910 viewowner: pg_views.viewowner.into(),
911 definition: pg_views.definition.into(),
912 }
913 })
914 .iter().await?.try_collect()
915 .await?;
916
917 Ok(pg_views_coll)
918}
919
920
921pub async fn reflect_pg_matviews(
923 client: &PgClient
924) -> Result<Vec<PgMatviews>, postgres::Error> {
925 let pg_matviews_coll = queries_crate::queries::query_gen::reflect_pg_matviews().bind(client)
926 .map(|pg_matviews| {
927 PgMatviews {
928 schemaname: pg_matviews.schemaname.into(),
929 matviewname: pg_matviews.matviewname.into(),
930 matviewowner: pg_matviews.matviewowner.into(),
931 definition: pg_matviews.definition.into(),
932 }
933 })
934 .iter().await?.try_collect()
935 .await?;
936
937 Ok(pg_matviews_coll)
938}
939
940
941pub async fn reflect_pg_sequence(
943 client: &PgClient
944) -> Result<Vec<PgSequence>, postgres::Error> {
945 let pg_sequence_coll = queries_crate::queries::query_gen::reflect_pg_sequence().bind(client)
946 .map(|pg_sequence| {
947 PgSequence {
948 seqrelid: pg_sequence.seqrelid.into(),
949 seqtypid: pg_sequence.seqtypid.into(),
950 seqstart: pg_sequence.seqstart,
951 seqincrement: pg_sequence.seqincrement,
952 seqmax: pg_sequence.seqmax,
953 seqmin: pg_sequence.seqmin,
954 seqcache: pg_sequence.seqcache,
955 seqcycle: pg_sequence.seqcycle,
956 }
957 })
958 .iter().await?.try_collect()
959 .await?;
960
961 Ok(pg_sequence_coll)
962}
963
964
965pub async fn reflect_pg_statistic_ext(
967 client: &PgClient
968) -> Result<Vec<PgStatisticExt>, postgres::Error> {
969 let pg_statistic_ext_coll = queries_crate::queries::query_gen::reflect_pg_statistic_ext().bind(client)
970 .map(|pg_statistic_ext| {
971 PgStatisticExt {
972 stxrelid: pg_statistic_ext.stxrelid.into(),
973 stxname: pg_statistic_ext.stxname.into(),
974 stxnamespace: pg_statistic_ext.stxnamespace.into(),
975 stxowner: pg_statistic_ext.stxowner.into(),
976 stxkeys: pg_statistic_ext.stxkeys.map(i16::unsigned_abs).collect(),
977 stxstattarget: pg_statistic_ext.stxstattarget.map(i16::unsigned_abs),
978 stxkind: pg_statistic_ext.stxkind.map(PgStatisticExtStxkind::pg_from_char).collect(),
979 stxexprs: pg_statistic_ext.stxexprs.map(Into::into),
980 description: pg_statistic_ext.description.map(Into::into),
981 }
982 })
983 .iter().await?.try_collect()
984 .await?;
985
986 Ok(pg_statistic_ext_coll)
987}
988
989
990pub async fn reflect_pg_subscription(
992 client: &PgClient
993) -> Result<Vec<PgSubscription>, postgres::Error> {
994 let pg_subscription_coll = queries_crate::queries::query_gen::reflect_pg_subscription().bind(client)
995 .map(|pg_subscription| {
996 PgSubscription {
997 subname: pg_subscription.subname.into(),
998 subowner: pg_subscription.subowner.into(),
999 subenabled: pg_subscription.subenabled,
1000 subbinary: pg_subscription.subbinary,
1001 substream: PgSubscriptionSubstream::pg_from_char(pg_subscription.substream),
1002 subtwophasestate: PgSubscriptionSubtwophasestate::pg_from_char(pg_subscription.subtwophasestate),
1003 subdisableonerr: pg_subscription.subdisableonerr,
1004 subpasswordrequired: pg_subscription.subpasswordrequired,
1005 subrunasowner: pg_subscription.subrunasowner,
1006 subfailover: pg_subscription.subfailover,
1007 subconninfo: pg_subscription.subconninfo.into(),
1008 subslotname: pg_subscription.subslotname.map(Into::into),
1009 subsynccommit: pg_subscription.subsynccommit.into(),
1010 subpublications: pg_subscription.subpublications.map(Into::into).collect(),
1011 suborigin: pg_subscription.suborigin.map(Into::into),
1012 description: pg_subscription.description.map(Into::into),
1013 seclabel: pg_subscription.seclabel.map(Into::into),
1014 seclabel_provider: pg_subscription.seclabel_provider.map(Into::into),
1015 }
1016 })
1017 .iter().await?.try_collect()
1018 .await?;
1019
1020 Ok(pg_subscription_coll)
1021}
1022
1023
1024pub async fn reflect_pg_transform(
1026 client: &PgClient
1027) -> Result<Vec<PgTransform>, postgres::Error> {
1028 let pg_transform_coll = queries_crate::queries::query_gen::reflect_pg_transform().bind(client)
1029 .map(|pg_transform| {
1030 PgTransform {
1031 trftype: pg_transform.trftype.into(),
1032 trflang: pg_transform.trflang.into(),
1033 trffromsql: pg_transform.trffromsql.map(Into::into),
1034 trftosql: pg_transform.trftosql.map(Into::into),
1035 }
1036 })
1037 .iter().await?.try_collect()
1038 .await?;
1039
1040 Ok(pg_transform_coll)
1041}
1042
1043
1044pub async fn reflect_pg_trigger(
1046 client: &PgClient
1047) -> Result<Vec<PgTrigger>, postgres::Error> {
1048 let pg_trigger_coll = queries_crate::queries::query_gen::reflect_pg_trigger().bind(client)
1049 .map(|pg_trigger| {
1050 PgTrigger {
1051 tgrelid: pg_trigger.tgrelid.into(),
1052 tgparentid: pg_trigger.tgparentid.map(Into::into),
1053 tgname: pg_trigger.tgname.into(),
1054 tgfoid: pg_trigger.tgfoid.into(),
1055 tgtype: pg_trigger.tgtype,
1056 tgenabled: PgTriggerTgenabled::pg_from_char(pg_trigger.tgenabled),
1057 tgisinternal: pg_trigger.tgisinternal,
1058 tgconstrrelid: pg_trigger.tgconstrrelid.map(Into::into),
1059 tgconstrindid: pg_trigger.tgconstrindid.map(Into::into),
1060 tgconstraint: pg_trigger.tgconstraint.map(Into::into),
1061 tgdeferrable: pg_trigger.tgdeferrable,
1062 tginitdeferred: pg_trigger.tginitdeferred,
1063 tgnargs: pg_trigger.tgnargs.unsigned_abs(),
1064 tgattr: pg_trigger.tgattr.map(i16::unsigned_abs).collect(),
1065 tgargs: pg_trigger.tgargs.into(),
1066 tgqual: pg_trigger.tgqual.map(Into::into),
1067 tgoldtable: pg_trigger.tgoldtable.map(Into::into),
1068 tgnewtable: pg_trigger.tgnewtable.map(Into::into),
1069 description: pg_trigger.description.map(Into::into),
1070 seclabel: pg_trigger.seclabel.map(Into::into),
1071 seclabel_provider: pg_trigger.seclabel_provider.map(Into::into),
1072 }
1073 })
1074 .iter().await?.try_collect()
1075 .await?;
1076
1077 Ok(pg_trigger_coll)
1078}
1079
1080
1081pub async fn reflect_pg_ts_config(
1083 client: &PgClient
1084) -> Result<Set<PgTsConfig>, postgres::Error> {
1085 let pg_ts_config_coll = queries_crate::queries::query_gen::reflect_pg_ts_config().bind(client)
1086 .map(|pg_ts_config| {
1087 PgTsConfig {
1088 oid: pg_ts_config.oid.into(),
1089 cfgname: pg_ts_config.cfgname.into(),
1090 cfgnamespace: pg_ts_config.cfgnamespace.into(),
1091 cfgowner: pg_ts_config.cfgowner.into(),
1092 description: pg_ts_config.description.map(Into::into),
1093 seclabel: pg_ts_config.seclabel.map(Into::into),
1094 seclabel_provider: pg_ts_config.seclabel_provider.map(Into::into),
1095 }
1096 })
1097 .iter().await?.try_collect()
1098 .await?;
1099
1100 Ok(pg_ts_config_coll)
1101}
1102
1103
1104pub async fn reflect_pg_ts_config_map(
1106 client: &PgClient
1107) -> Result<Vec<PgTsConfigMap>, postgres::Error> {
1108 let pg_ts_config_map_coll = queries_crate::queries::query_gen::reflect_pg_ts_config_map().bind(client)
1109 .map(|pg_ts_config_map| {
1110 PgTsConfigMap {
1111 mapcfg: pg_ts_config_map.mapcfg.into(),
1112 maptokentype: pg_ts_config_map.maptokentype,
1113 mapseqno: pg_ts_config_map.mapseqno,
1114 mapdict: pg_ts_config_map.mapdict.into(),
1115 }
1116 })
1117 .iter().await?.try_collect()
1118 .await?;
1119
1120 Ok(pg_ts_config_map_coll)
1121}
1122
1123
1124pub async fn reflect_pg_ts_dict(
1126 client: &PgClient
1127) -> Result<Set<PgTsDict>, postgres::Error> {
1128 let pg_ts_dict_coll = queries_crate::queries::query_gen::reflect_pg_ts_dict().bind(client)
1129 .map(|pg_ts_dict| {
1130 PgTsDict {
1131 oid: pg_ts_dict.oid.into(),
1132 dictname: pg_ts_dict.dictname.into(),
1133 dictnamespace: pg_ts_dict.dictnamespace.into(),
1134 dictowner: pg_ts_dict.dictowner.into(),
1135 dictinitoption: pg_ts_dict.dictinitoption.map(Into::into),
1136 description: pg_ts_dict.description.map(Into::into),
1137 seclabel: pg_ts_dict.seclabel.map(Into::into),
1138 seclabel_provider: pg_ts_dict.seclabel_provider.map(Into::into),
1139 }
1140 })
1141 .iter().await?.try_collect()
1142 .await?;
1143
1144 Ok(pg_ts_dict_coll)
1145}
1146
1147
1148pub async fn reflect_pg_ts_parser(
1150 client: &PgClient
1151) -> Result<Vec<PgTsParser>, postgres::Error> {
1152 let pg_ts_parser_coll = queries_crate::queries::query_gen::reflect_pg_ts_parser().bind(client)
1153 .map(|pg_ts_parser| {
1154 PgTsParser {
1155 prsname: pg_ts_parser.prsname.into(),
1156 prsnamespace: pg_ts_parser.prsnamespace.into(),
1157 prsstart: pg_ts_parser.prsstart.into(),
1158 prstoken: pg_ts_parser.prstoken.into(),
1159 prsend: pg_ts_parser.prsend.into(),
1160 prsheadline: pg_ts_parser.prsheadline.map(Into::into),
1161 prslextype: pg_ts_parser.prslextype.into(),
1162 }
1163 })
1164 .iter().await?.try_collect()
1165 .await?;
1166
1167 Ok(pg_ts_parser_coll)
1168}
1169
1170
1171pub async fn reflect_pg_ts_template(
1173 client: &PgClient
1174) -> Result<Vec<PgTsTemplate>, postgres::Error> {
1175 let pg_ts_template_coll = queries_crate::queries::query_gen::reflect_pg_ts_template().bind(client)
1176 .map(|pg_ts_template| {
1177 PgTsTemplate {
1178 tmplname: pg_ts_template.tmplname.into(),
1179 tmplnamespace: pg_ts_template.tmplnamespace.into(),
1180 tmplinit: pg_ts_template.tmplinit.map(Into::into),
1181 tmpllexize: pg_ts_template.tmpllexize.into(),
1182 }
1183 })
1184 .iter().await?.try_collect()
1185 .await?;
1186
1187 Ok(pg_ts_template_coll)
1188}
1189
1190
1191pub async fn reflect_pg_type(
1193 client: &PgClient
1194) -> Result<Set<PgType>, postgres::Error> {
1195 let pg_type_coll = queries_crate::queries::query_gen::reflect_pg_type().bind(client)
1196 .map(|pg_type| {
1197 PgType {
1198 oid: pg_type.oid.into(),
1199 typname: pg_type.typname.into(),
1200 typnamespace: pg_type.typnamespace.into(),
1201 typowner: pg_type.typowner.into(),
1202 typlen: pg_type.typlen,
1203 typbyval: pg_type.typbyval,
1204 typtype: PgTypeTyptype::pg_from_char(pg_type.typtype),
1205 typispreferred: pg_type.typispreferred,
1206 typisdefined: pg_type.typisdefined,
1207 typdelim: pg_type.typdelim,
1208 typrelid: pg_type.typrelid.map(Into::into),
1209 typsubscript: pg_type.typsubscript.map(Into::into),
1210 typelem: pg_type.typelem.map(Into::into),
1211 typarray: pg_type.typarray.map(Into::into),
1212 typinput: pg_type.typinput.into(),
1213 typoutput: pg_type.typoutput.into(),
1214 typreceive: pg_type.typreceive.map(Into::into),
1215 typsend: pg_type.typsend.map(Into::into),
1216 typmodin: pg_type.typmodin.map(Into::into),
1217 typmodout: pg_type.typmodout.map(Into::into),
1218 typanalyze: pg_type.typanalyze.map(Into::into),
1219 typalign: PgTypeTypalign::pg_from_char(pg_type.typalign),
1220 typstorage: PgTypeTypstorage::pg_from_char(pg_type.typstorage),
1221 typnotnull: pg_type.typnotnull,
1222 typbasetype: pg_type.typbasetype.map(Into::into),
1223 typtypmod: pg_type.typtypmod.map(i32::unsigned_abs),
1224 typndims: pg_type.typndims.unsigned_abs(),
1225 typcollation: pg_type.typcollation.map(Into::into),
1226 typdefaultbin: pg_type.typdefaultbin.map(Into::into),
1227 typdefault: pg_type.typdefault.map(Into::into),
1228 typacl: pg_type.typacl.map(|typacl| typacl.map(|acl| aclitems!(acl, TypeAclItem, TypeGrant)).collect()),
1229 description: pg_type.description.map(Into::into),
1230 seclabel: pg_type.seclabel.map(Into::into),
1231 seclabel_provider: pg_type.seclabel_provider.map(Into::into),
1232 initprivs: pg_type.initprivs.map(|initprivs| initprivs.map(|acl| aclitems!(acl, TypeAclItem, TypeGrant)).collect()),
1233 initprivs_type: pg_type.initprivs_type.map(PgTypeInitprivsType::pg_from_char),
1234 }
1235 })
1236 .iter().await?.try_collect()
1237 .await?;
1238
1239 Ok(pg_type_coll)
1240}
1241
1242
1243pub async fn reflect_pg_user_mappings(
1245 client: &PgClient
1246) -> Result<Vec<PgUserMappings>, postgres::Error> {
1247 let pg_user_mappings_coll = queries_crate::queries::query_gen::reflect_pg_user_mappings().bind(client)
1248 .map(|pg_user_mappings| {
1249 PgUserMappings {
1250 srvname: pg_user_mappings.srvname.into(),
1251 umuser: pg_user_mappings.umuser.map(Into::into),
1252 usename: pg_user_mappings.usename.into(),
1253 umoptions: pg_user_mappings.umoptions.map(|items| items.map(Into::into).collect()),
1254 }
1255 })
1256 .iter().await?.try_collect()
1257 .await?;
1258
1259 Ok(pg_user_mappings_coll)
1260}
1261