-
Notifications
You must be signed in to change notification settings - Fork 244
/
model.rs
1195 lines (1180 loc) · 43.9 KB
/
model.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub enum Field {
/// <p>An array of values.</p>
ArrayValue(crate::model::ArrayValue),
/// <p>A value of BLOB data type.</p>
BlobValue(smithy_types::Blob),
/// <p>A value of Boolean data type.</p>
BooleanValue(bool),
/// <p>A value of double data type.</p>
DoubleValue(f64),
/// <p>A NULL value.</p>
IsNull(bool),
/// <p>A value of long data type.</p>
LongValue(i64),
/// <p>A value of string data type.</p>
StringValue(std::string::String),
}
impl Field {
pub fn as_array_value(&self) -> std::result::Result<&crate::model::ArrayValue, &Self> {
if let Field::ArrayValue(val) = &self {
Ok(&val)
} else {
Err(&self)
}
}
pub fn is_array_value(&self) -> bool {
self.as_array_value().is_ok()
}
pub fn as_blob_value(&self) -> std::result::Result<&smithy_types::Blob, &Self> {
if let Field::BlobValue(val) = &self {
Ok(&val)
} else {
Err(&self)
}
}
pub fn is_blob_value(&self) -> bool {
self.as_blob_value().is_ok()
}
pub fn as_boolean_value(&self) -> std::result::Result<&bool, &Self> {
if let Field::BooleanValue(val) = &self {
Ok(&val)
} else {
Err(&self)
}
}
pub fn is_boolean_value(&self) -> bool {
self.as_boolean_value().is_ok()
}
pub fn as_double_value(&self) -> std::result::Result<&f64, &Self> {
if let Field::DoubleValue(val) = &self {
Ok(&val)
} else {
Err(&self)
}
}
pub fn is_double_value(&self) -> bool {
self.as_double_value().is_ok()
}
pub fn as_is_null(&self) -> std::result::Result<&bool, &Self> {
if let Field::IsNull(val) = &self {
Ok(&val)
} else {
Err(&self)
}
}
pub fn is_is_null(&self) -> bool {
self.as_is_null().is_ok()
}
pub fn as_long_value(&self) -> std::result::Result<&i64, &Self> {
if let Field::LongValue(val) = &self {
Ok(&val)
} else {
Err(&self)
}
}
pub fn is_long_value(&self) -> bool {
self.as_long_value().is_ok()
}
pub fn as_string_value(&self) -> std::result::Result<&std::string::String, &Self> {
if let Field::StringValue(val) = &self {
Ok(&val)
} else {
Err(&self)
}
}
pub fn is_string_value(&self) -> bool {
self.as_string_value().is_ok()
}
}
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub enum ArrayValue {
/// <p>An array of arrays.</p>
ArrayValues(std::vec::Vec<crate::model::ArrayValue>),
/// <p>An array of Boolean values.</p>
BooleanValues(std::vec::Vec<bool>),
/// <p>An array of integers.</p>
DoubleValues(std::vec::Vec<f64>),
/// <p>An array of floating point numbers.</p>
LongValues(std::vec::Vec<i64>),
/// <p>An array of strings.</p>
StringValues(std::vec::Vec<std::string::String>),
}
impl ArrayValue {
pub fn as_array_values(
&self,
) -> std::result::Result<&std::vec::Vec<crate::model::ArrayValue>, &Self> {
if let ArrayValue::ArrayValues(val) = &self {
Ok(&val)
} else {
Err(&self)
}
}
pub fn is_array_values(&self) -> bool {
self.as_array_values().is_ok()
}
pub fn as_boolean_values(&self) -> std::result::Result<&std::vec::Vec<bool>, &Self> {
if let ArrayValue::BooleanValues(val) = &self {
Ok(&val)
} else {
Err(&self)
}
}
pub fn is_boolean_values(&self) -> bool {
self.as_boolean_values().is_ok()
}
pub fn as_double_values(&self) -> std::result::Result<&std::vec::Vec<f64>, &Self> {
if let ArrayValue::DoubleValues(val) = &self {
Ok(&val)
} else {
Err(&self)
}
}
pub fn is_double_values(&self) -> bool {
self.as_double_values().is_ok()
}
pub fn as_long_values(&self) -> std::result::Result<&std::vec::Vec<i64>, &Self> {
if let ArrayValue::LongValues(val) = &self {
Ok(&val)
} else {
Err(&self)
}
}
pub fn is_long_values(&self) -> bool {
self.as_long_values().is_ok()
}
pub fn as_string_values(
&self,
) -> std::result::Result<&std::vec::Vec<std::string::String>, &Self> {
if let ArrayValue::StringValues(val) = &self {
Ok(&val)
} else {
Err(&self)
}
}
pub fn is_string_values(&self) -> bool {
self.as_string_values().is_ok()
}
}
/// <p>Contains the metadata for a column.</p>
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq)]
pub struct ColumnMetadata {
/// <p>The name of the column.</p>
pub name: std::option::Option<std::string::String>,
/// <p>The type of the column.</p>
pub r#type: i32,
/// <p>The database-specific data type of the column.</p>
pub type_name: std::option::Option<std::string::String>,
/// <p>The label for the column.</p>
pub label: std::option::Option<std::string::String>,
/// <p>The name of the schema that owns the table that includes the column.</p>
pub schema_name: std::option::Option<std::string::String>,
/// <p>The name of the table that includes the column.</p>
pub table_name: std::option::Option<std::string::String>,
/// <p>A value that indicates whether the column increments automatically.</p>
pub is_auto_increment: bool,
/// <p>A value that indicates whether an integer column is signed.</p>
pub is_signed: bool,
/// <p>A value that indicates whether the column contains currency values.</p>
pub is_currency: bool,
/// <p>A value that indicates whether the column is case-sensitive.</p>
pub is_case_sensitive: bool,
/// <p>A value that indicates whether the column is nullable.</p>
pub nullable: i32,
/// <p>The precision value of a decimal number column.</p>
pub precision: i32,
/// <p>The scale value of a decimal number column.</p>
pub scale: i32,
/// <p>The type of the column.</p>
pub array_base_column_type: i32,
}
impl std::fmt::Debug for ColumnMetadata {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut formatter = f.debug_struct("ColumnMetadata");
formatter.field("name", &self.name);
formatter.field("r#type", &self.r#type);
formatter.field("type_name", &self.type_name);
formatter.field("label", &self.label);
formatter.field("schema_name", &self.schema_name);
formatter.field("table_name", &self.table_name);
formatter.field("is_auto_increment", &self.is_auto_increment);
formatter.field("is_signed", &self.is_signed);
formatter.field("is_currency", &self.is_currency);
formatter.field("is_case_sensitive", &self.is_case_sensitive);
formatter.field("nullable", &self.nullable);
formatter.field("precision", &self.precision);
formatter.field("scale", &self.scale);
formatter.field("array_base_column_type", &self.array_base_column_type);
formatter.finish()
}
}
/// See [`ColumnMetadata`](crate::model::ColumnMetadata)
pub mod column_metadata {
/// A builder for [`ColumnMetadata`](crate::model::ColumnMetadata)
#[non_exhaustive]
#[derive(std::default::Default, std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct Builder {
pub(crate) name: std::option::Option<std::string::String>,
pub(crate) r#type: std::option::Option<i32>,
pub(crate) type_name: std::option::Option<std::string::String>,
pub(crate) label: std::option::Option<std::string::String>,
pub(crate) schema_name: std::option::Option<std::string::String>,
pub(crate) table_name: std::option::Option<std::string::String>,
pub(crate) is_auto_increment: std::option::Option<bool>,
pub(crate) is_signed: std::option::Option<bool>,
pub(crate) is_currency: std::option::Option<bool>,
pub(crate) is_case_sensitive: std::option::Option<bool>,
pub(crate) nullable: std::option::Option<i32>,
pub(crate) precision: std::option::Option<i32>,
pub(crate) scale: std::option::Option<i32>,
pub(crate) array_base_column_type: std::option::Option<i32>,
}
impl Builder {
/// <p>The name of the column.</p>
pub fn name(mut self, input: impl Into<std::string::String>) -> Self {
self.name = Some(input.into());
self
}
pub fn set_name(mut self, input: std::option::Option<std::string::String>) -> Self {
self.name = input;
self
}
/// <p>The type of the column.</p>
pub fn r#type(mut self, input: i32) -> Self {
self.r#type = Some(input);
self
}
pub fn set_type(mut self, input: std::option::Option<i32>) -> Self {
self.r#type = input;
self
}
/// <p>The database-specific data type of the column.</p>
pub fn type_name(mut self, input: impl Into<std::string::String>) -> Self {
self.type_name = Some(input.into());
self
}
pub fn set_type_name(mut self, input: std::option::Option<std::string::String>) -> Self {
self.type_name = input;
self
}
/// <p>The label for the column.</p>
pub fn label(mut self, input: impl Into<std::string::String>) -> Self {
self.label = Some(input.into());
self
}
pub fn set_label(mut self, input: std::option::Option<std::string::String>) -> Self {
self.label = input;
self
}
/// <p>The name of the schema that owns the table that includes the column.</p>
pub fn schema_name(mut self, input: impl Into<std::string::String>) -> Self {
self.schema_name = Some(input.into());
self
}
pub fn set_schema_name(mut self, input: std::option::Option<std::string::String>) -> Self {
self.schema_name = input;
self
}
/// <p>The name of the table that includes the column.</p>
pub fn table_name(mut self, input: impl Into<std::string::String>) -> Self {
self.table_name = Some(input.into());
self
}
pub fn set_table_name(mut self, input: std::option::Option<std::string::String>) -> Self {
self.table_name = input;
self
}
/// <p>A value that indicates whether the column increments automatically.</p>
pub fn is_auto_increment(mut self, input: bool) -> Self {
self.is_auto_increment = Some(input);
self
}
pub fn set_is_auto_increment(mut self, input: std::option::Option<bool>) -> Self {
self.is_auto_increment = input;
self
}
/// <p>A value that indicates whether an integer column is signed.</p>
pub fn is_signed(mut self, input: bool) -> Self {
self.is_signed = Some(input);
self
}
pub fn set_is_signed(mut self, input: std::option::Option<bool>) -> Self {
self.is_signed = input;
self
}
/// <p>A value that indicates whether the column contains currency values.</p>
pub fn is_currency(mut self, input: bool) -> Self {
self.is_currency = Some(input);
self
}
pub fn set_is_currency(mut self, input: std::option::Option<bool>) -> Self {
self.is_currency = input;
self
}
/// <p>A value that indicates whether the column is case-sensitive.</p>
pub fn is_case_sensitive(mut self, input: bool) -> Self {
self.is_case_sensitive = Some(input);
self
}
pub fn set_is_case_sensitive(mut self, input: std::option::Option<bool>) -> Self {
self.is_case_sensitive = input;
self
}
/// <p>A value that indicates whether the column is nullable.</p>
pub fn nullable(mut self, input: i32) -> Self {
self.nullable = Some(input);
self
}
pub fn set_nullable(mut self, input: std::option::Option<i32>) -> Self {
self.nullable = input;
self
}
/// <p>The precision value of a decimal number column.</p>
pub fn precision(mut self, input: i32) -> Self {
self.precision = Some(input);
self
}
pub fn set_precision(mut self, input: std::option::Option<i32>) -> Self {
self.precision = input;
self
}
/// <p>The scale value of a decimal number column.</p>
pub fn scale(mut self, input: i32) -> Self {
self.scale = Some(input);
self
}
pub fn set_scale(mut self, input: std::option::Option<i32>) -> Self {
self.scale = input;
self
}
/// <p>The type of the column.</p>
pub fn array_base_column_type(mut self, input: i32) -> Self {
self.array_base_column_type = Some(input);
self
}
pub fn set_array_base_column_type(mut self, input: std::option::Option<i32>) -> Self {
self.array_base_column_type = input;
self
}
/// Consumes the builder and constructs a [`ColumnMetadata`](crate::model::ColumnMetadata)
pub fn build(self) -> crate::model::ColumnMetadata {
crate::model::ColumnMetadata {
name: self.name,
r#type: self.r#type.unwrap_or_default(),
type_name: self.type_name,
label: self.label,
schema_name: self.schema_name,
table_name: self.table_name,
is_auto_increment: self.is_auto_increment.unwrap_or_default(),
is_signed: self.is_signed.unwrap_or_default(),
is_currency: self.is_currency.unwrap_or_default(),
is_case_sensitive: self.is_case_sensitive.unwrap_or_default(),
nullable: self.nullable.unwrap_or_default(),
precision: self.precision.unwrap_or_default(),
scale: self.scale.unwrap_or_default(),
array_base_column_type: self.array_base_column_type.unwrap_or_default(),
}
}
}
}
impl ColumnMetadata {
/// Creates a new builder-style object to manufacture [`ColumnMetadata`](crate::model::ColumnMetadata)
pub fn builder() -> crate::model::column_metadata::Builder {
crate::model::column_metadata::Builder::default()
}
}
/// <p>Options that control how the result set is returned.</p>
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq)]
pub struct ResultSetOptions {
/// <p>A value that indicates how a field of <code>DECIMAL</code> type is represented
/// in the response. The value of <code>STRING</code>, the default, specifies that
/// it is converted to a String value. The value of <code>DOUBLE_OR_LONG</code>
/// specifies that it is converted to a Long value if its scale is 0, or to a Double
/// value otherwise.</p>
/// <important>
/// <p>Conversion to Double or Long can result in roundoff errors due to precision loss.
/// We recommend converting to String, especially when working with currency values.</p>
/// </important>
pub decimal_return_type: std::option::Option<crate::model::DecimalReturnType>,
}
impl std::fmt::Debug for ResultSetOptions {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut formatter = f.debug_struct("ResultSetOptions");
formatter.field("decimal_return_type", &self.decimal_return_type);
formatter.finish()
}
}
/// See [`ResultSetOptions`](crate::model::ResultSetOptions)
pub mod result_set_options {
/// A builder for [`ResultSetOptions`](crate::model::ResultSetOptions)
#[non_exhaustive]
#[derive(std::default::Default, std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct Builder {
pub(crate) decimal_return_type: std::option::Option<crate::model::DecimalReturnType>,
}
impl Builder {
/// <p>A value that indicates how a field of <code>DECIMAL</code> type is represented
/// in the response. The value of <code>STRING</code>, the default, specifies that
/// it is converted to a String value. The value of <code>DOUBLE_OR_LONG</code>
/// specifies that it is converted to a Long value if its scale is 0, or to a Double
/// value otherwise.</p>
/// <important>
/// <p>Conversion to Double or Long can result in roundoff errors due to precision loss.
/// We recommend converting to String, especially when working with currency values.</p>
/// </important>
pub fn decimal_return_type(mut self, input: crate::model::DecimalReturnType) -> Self {
self.decimal_return_type = Some(input);
self
}
pub fn set_decimal_return_type(
mut self,
input: std::option::Option<crate::model::DecimalReturnType>,
) -> Self {
self.decimal_return_type = input;
self
}
/// Consumes the builder and constructs a [`ResultSetOptions`](crate::model::ResultSetOptions)
pub fn build(self) -> crate::model::ResultSetOptions {
crate::model::ResultSetOptions {
decimal_return_type: self.decimal_return_type,
}
}
}
}
impl ResultSetOptions {
/// Creates a new builder-style object to manufacture [`ResultSetOptions`](crate::model::ResultSetOptions)
pub fn builder() -> crate::model::result_set_options::Builder {
crate::model::result_set_options::Builder::default()
}
}
#[non_exhaustive]
#[derive(
std::clone::Clone,
std::cmp::Eq,
std::cmp::Ord,
std::cmp::PartialEq,
std::cmp::PartialOrd,
std::fmt::Debug,
std::hash::Hash,
)]
pub enum DecimalReturnType {
DoubleOrLong,
String,
/// Unknown contains new variants that have been added since this code was generated.
Unknown(String),
}
impl std::convert::From<&str> for DecimalReturnType {
fn from(s: &str) -> Self {
match s {
"DOUBLE_OR_LONG" => DecimalReturnType::DoubleOrLong,
"STRING" => DecimalReturnType::String,
other => DecimalReturnType::Unknown(other.to_owned()),
}
}
}
impl std::str::FromStr for DecimalReturnType {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
Ok(DecimalReturnType::from(s))
}
}
impl DecimalReturnType {
pub fn as_str(&self) -> &str {
match self {
DecimalReturnType::DoubleOrLong => "DOUBLE_OR_LONG",
DecimalReturnType::String => "STRING",
DecimalReturnType::Unknown(s) => s.as_ref(),
}
}
pub fn values() -> &'static [&'static str] {
&["DOUBLE_OR_LONG", "STRING"]
}
}
impl AsRef<str> for DecimalReturnType {
fn as_ref(&self) -> &str {
self.as_str()
}
}
/// <p>A parameter used in a SQL statement.</p>
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq)]
pub struct SqlParameter {
/// <p>The name of the parameter.</p>
pub name: std::option::Option<std::string::String>,
/// <p>The value of the parameter.</p>
pub value: std::option::Option<crate::model::Field>,
/// <p>A hint that specifies the correct object type for data type mapping. Possible values
/// are as follows:</p>
/// <ul>
/// <li>
/// <p>
/// <code>DATE</code> - The corresponding <code>String</code> parameter value is sent as an object
/// of <code>DATE</code> type to the database. The accepted format is <code>YYYY-MM-DD</code>.</p>
/// </li>
/// <li>
/// <p>
/// <code>DECIMAL</code> - The corresponding <code>String</code> parameter value is sent as an object
/// of <code>DECIMAL</code> type to the database.</p>
/// </li>
/// <li>
/// <p>
/// <code>JSON</code> - The corresponding <code>String</code> parameter value is sent as an
/// object of <code>JSON</code> type to the database.</p>
/// </li>
/// <li>
/// <p>
/// <code>TIME</code> - The corresponding <code>String</code> parameter value is sent as an object
/// of <code>TIME</code> type to the database. The accepted format is <code>HH:MM:SS[.FFF]</code>.</p>
/// </li>
/// <li>
/// <p>
/// <code>TIMESTAMP</code> - The corresponding <code>String</code> parameter value is sent as an object
/// of <code>TIMESTAMP</code> type to the database. The accepted format is <code>YYYY-MM-DD HH:MM:SS[.FFF]</code>.</p>
/// </li>
/// <li>
/// <p>
/// <code>UUID</code> - The corresponding <code>String</code> parameter value is sent as an object of
/// <code>UUID</code> type to the database.
/// </p>
/// </li>
/// </ul>
pub type_hint: std::option::Option<crate::model::TypeHint>,
}
impl std::fmt::Debug for SqlParameter {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut formatter = f.debug_struct("SqlParameter");
formatter.field("name", &self.name);
formatter.field("value", &self.value);
formatter.field("type_hint", &self.type_hint);
formatter.finish()
}
}
/// See [`SqlParameter`](crate::model::SqlParameter)
pub mod sql_parameter {
/// A builder for [`SqlParameter`](crate::model::SqlParameter)
#[non_exhaustive]
#[derive(std::default::Default, std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct Builder {
pub(crate) name: std::option::Option<std::string::String>,
pub(crate) value: std::option::Option<crate::model::Field>,
pub(crate) type_hint: std::option::Option<crate::model::TypeHint>,
}
impl Builder {
/// <p>The name of the parameter.</p>
pub fn name(mut self, input: impl Into<std::string::String>) -> Self {
self.name = Some(input.into());
self
}
pub fn set_name(mut self, input: std::option::Option<std::string::String>) -> Self {
self.name = input;
self
}
/// <p>The value of the parameter.</p>
pub fn value(mut self, input: crate::model::Field) -> Self {
self.value = Some(input);
self
}
pub fn set_value(mut self, input: std::option::Option<crate::model::Field>) -> Self {
self.value = input;
self
}
/// <p>A hint that specifies the correct object type for data type mapping. Possible values
/// are as follows:</p>
/// <ul>
/// <li>
/// <p>
/// <code>DATE</code> - The corresponding <code>String</code> parameter value is sent as an object
/// of <code>DATE</code> type to the database. The accepted format is <code>YYYY-MM-DD</code>.</p>
/// </li>
/// <li>
/// <p>
/// <code>DECIMAL</code> - The corresponding <code>String</code> parameter value is sent as an object
/// of <code>DECIMAL</code> type to the database.</p>
/// </li>
/// <li>
/// <p>
/// <code>JSON</code> - The corresponding <code>String</code> parameter value is sent as an
/// object of <code>JSON</code> type to the database.</p>
/// </li>
/// <li>
/// <p>
/// <code>TIME</code> - The corresponding <code>String</code> parameter value is sent as an object
/// of <code>TIME</code> type to the database. The accepted format is <code>HH:MM:SS[.FFF]</code>.</p>
/// </li>
/// <li>
/// <p>
/// <code>TIMESTAMP</code> - The corresponding <code>String</code> parameter value is sent as an object
/// of <code>TIMESTAMP</code> type to the database. The accepted format is <code>YYYY-MM-DD HH:MM:SS[.FFF]</code>.</p>
/// </li>
/// <li>
/// <p>
/// <code>UUID</code> - The corresponding <code>String</code> parameter value is sent as an object of
/// <code>UUID</code> type to the database.
/// </p>
/// </li>
/// </ul>
pub fn type_hint(mut self, input: crate::model::TypeHint) -> Self {
self.type_hint = Some(input);
self
}
pub fn set_type_hint(mut self, input: std::option::Option<crate::model::TypeHint>) -> Self {
self.type_hint = input;
self
}
/// Consumes the builder and constructs a [`SqlParameter`](crate::model::SqlParameter)
pub fn build(self) -> crate::model::SqlParameter {
crate::model::SqlParameter {
name: self.name,
value: self.value,
type_hint: self.type_hint,
}
}
}
}
impl SqlParameter {
/// Creates a new builder-style object to manufacture [`SqlParameter`](crate::model::SqlParameter)
pub fn builder() -> crate::model::sql_parameter::Builder {
crate::model::sql_parameter::Builder::default()
}
}
#[non_exhaustive]
#[derive(
std::clone::Clone,
std::cmp::Eq,
std::cmp::Ord,
std::cmp::PartialEq,
std::cmp::PartialOrd,
std::fmt::Debug,
std::hash::Hash,
)]
pub enum TypeHint {
Date,
Decimal,
Json,
Time,
Timestamp,
Uuid,
/// Unknown contains new variants that have been added since this code was generated.
Unknown(String),
}
impl std::convert::From<&str> for TypeHint {
fn from(s: &str) -> Self {
match s {
"DATE" => TypeHint::Date,
"DECIMAL" => TypeHint::Decimal,
"JSON" => TypeHint::Json,
"TIME" => TypeHint::Time,
"TIMESTAMP" => TypeHint::Timestamp,
"UUID" => TypeHint::Uuid,
other => TypeHint::Unknown(other.to_owned()),
}
}
}
impl std::str::FromStr for TypeHint {
type Err = std::convert::Infallible;
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
Ok(TypeHint::from(s))
}
}
impl TypeHint {
pub fn as_str(&self) -> &str {
match self {
TypeHint::Date => "DATE",
TypeHint::Decimal => "DECIMAL",
TypeHint::Json => "JSON",
TypeHint::Time => "TIME",
TypeHint::Timestamp => "TIMESTAMP",
TypeHint::Uuid => "UUID",
TypeHint::Unknown(s) => s.as_ref(),
}
}
pub fn values() -> &'static [&'static str] {
&["DATE", "DECIMAL", "JSON", "TIME", "TIMESTAMP", "UUID"]
}
}
impl AsRef<str> for TypeHint {
fn as_ref(&self) -> &str {
self.as_str()
}
}
/// <p>The result of a SQL statement.</p>
/// <important>
/// <p>This data type is deprecated.</p>
/// </important>
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq)]
pub struct SqlStatementResult {
/// <p>The result set of the SQL statement.</p>
pub result_frame: std::option::Option<crate::model::ResultFrame>,
/// <p>The number of records updated by a SQL statement.</p>
pub number_of_records_updated: i64,
}
impl std::fmt::Debug for SqlStatementResult {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut formatter = f.debug_struct("SqlStatementResult");
formatter.field("result_frame", &self.result_frame);
formatter.field("number_of_records_updated", &self.number_of_records_updated);
formatter.finish()
}
}
/// See [`SqlStatementResult`](crate::model::SqlStatementResult)
pub mod sql_statement_result {
/// A builder for [`SqlStatementResult`](crate::model::SqlStatementResult)
#[non_exhaustive]
#[derive(std::default::Default, std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct Builder {
pub(crate) result_frame: std::option::Option<crate::model::ResultFrame>,
pub(crate) number_of_records_updated: std::option::Option<i64>,
}
impl Builder {
/// <p>The result set of the SQL statement.</p>
pub fn result_frame(mut self, input: crate::model::ResultFrame) -> Self {
self.result_frame = Some(input);
self
}
pub fn set_result_frame(
mut self,
input: std::option::Option<crate::model::ResultFrame>,
) -> Self {
self.result_frame = input;
self
}
/// <p>The number of records updated by a SQL statement.</p>
pub fn number_of_records_updated(mut self, input: i64) -> Self {
self.number_of_records_updated = Some(input);
self
}
pub fn set_number_of_records_updated(mut self, input: std::option::Option<i64>) -> Self {
self.number_of_records_updated = input;
self
}
/// Consumes the builder and constructs a [`SqlStatementResult`](crate::model::SqlStatementResult)
pub fn build(self) -> crate::model::SqlStatementResult {
crate::model::SqlStatementResult {
result_frame: self.result_frame,
number_of_records_updated: self.number_of_records_updated.unwrap_or_default(),
}
}
}
}
impl SqlStatementResult {
/// Creates a new builder-style object to manufacture [`SqlStatementResult`](crate::model::SqlStatementResult)
pub fn builder() -> crate::model::sql_statement_result::Builder {
crate::model::sql_statement_result::Builder::default()
}
}
/// <p>The result set returned by a SQL statement.</p>
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq)]
pub struct ResultFrame {
/// <p>The result-set metadata in the result set.</p>
pub result_set_metadata: std::option::Option<crate::model::ResultSetMetadata>,
/// <p>The records in the result set.</p>
pub records: std::option::Option<std::vec::Vec<crate::model::Record>>,
}
impl std::fmt::Debug for ResultFrame {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut formatter = f.debug_struct("ResultFrame");
formatter.field("result_set_metadata", &self.result_set_metadata);
formatter.field("records", &self.records);
formatter.finish()
}
}
/// See [`ResultFrame`](crate::model::ResultFrame)
pub mod result_frame {
/// A builder for [`ResultFrame`](crate::model::ResultFrame)
#[non_exhaustive]
#[derive(std::default::Default, std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct Builder {
pub(crate) result_set_metadata: std::option::Option<crate::model::ResultSetMetadata>,
pub(crate) records: std::option::Option<std::vec::Vec<crate::model::Record>>,
}
impl Builder {
/// <p>The result-set metadata in the result set.</p>
pub fn result_set_metadata(mut self, input: crate::model::ResultSetMetadata) -> Self {
self.result_set_metadata = Some(input);
self
}
pub fn set_result_set_metadata(
mut self,
input: std::option::Option<crate::model::ResultSetMetadata>,
) -> Self {
self.result_set_metadata = input;
self
}
pub fn records(mut self, input: impl Into<crate::model::Record>) -> Self {
let mut v = self.records.unwrap_or_default();
v.push(input.into());
self.records = Some(v);
self
}
pub fn set_records(
mut self,
input: std::option::Option<std::vec::Vec<crate::model::Record>>,
) -> Self {
self.records = input;
self
}
/// Consumes the builder and constructs a [`ResultFrame`](crate::model::ResultFrame)
pub fn build(self) -> crate::model::ResultFrame {
crate::model::ResultFrame {
result_set_metadata: self.result_set_metadata,
records: self.records,
}
}
}
}
impl ResultFrame {
/// Creates a new builder-style object to manufacture [`ResultFrame`](crate::model::ResultFrame)
pub fn builder() -> crate::model::result_frame::Builder {
crate::model::result_frame::Builder::default()
}
}
/// <p>A record returned by a call.</p>
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq)]
pub struct Record {
/// <p>The values returned in the record.</p>
pub values: std::option::Option<std::vec::Vec<crate::model::Value>>,
}
impl std::fmt::Debug for Record {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut formatter = f.debug_struct("Record");
formatter.field("values", &self.values);
formatter.finish()
}
}
/// See [`Record`](crate::model::Record)
pub mod record {
/// A builder for [`Record`](crate::model::Record)
#[non_exhaustive]
#[derive(std::default::Default, std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct Builder {
pub(crate) values: std::option::Option<std::vec::Vec<crate::model::Value>>,
}
impl Builder {
pub fn values(mut self, input: impl Into<crate::model::Value>) -> Self {
let mut v = self.values.unwrap_or_default();
v.push(input.into());
self.values = Some(v);
self
}
pub fn set_values(
mut self,
input: std::option::Option<std::vec::Vec<crate::model::Value>>,
) -> Self {
self.values = input;
self
}
/// Consumes the builder and constructs a [`Record`](crate::model::Record)
pub fn build(self) -> crate::model::Record {
crate::model::Record {
values: self.values,
}
}
}
}
impl Record {
/// Creates a new builder-style object to manufacture [`Record`](crate::model::Record)
pub fn builder() -> crate::model::record::Builder {
crate::model::record::Builder::default()
}
}
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub enum Value {
/// <p>An array of column values.</p>
ArrayValues(std::vec::Vec<crate::model::Value>),
/// <p>A value for a column of big integer data type.</p>
BigIntValue(i64),
/// <p>A value for a column of BIT data type.</p>
BitValue(bool),
/// <p>A value for a column of BLOB data type.</p>
BlobValue(smithy_types::Blob),
/// <p>A value for a column of double data type.</p>
DoubleValue(f64),
/// <p>A value for a column of integer data type.</p>
IntValue(i32),
/// <p>A NULL value.</p>
IsNull(bool),
/// <p>A value for a column of real data type.</p>
RealValue(f32),
/// <p>A value for a column of string data type.</p>
StringValue(std::string::String),
/// <p>A value for a column of STRUCT data type.</p>
StructValue(crate::model::StructValue),
}
impl Value {
pub fn as_array_values(
&self,
) -> std::result::Result<&std::vec::Vec<crate::model::Value>, &Self> {
if let Value::ArrayValues(val) = &self {
Ok(&val)
} else {
Err(&self)
}
}
pub fn is_array_values(&self) -> bool {
self.as_array_values().is_ok()
}
pub fn as_big_int_value(&self) -> std::result::Result<&i64, &Self> {
if let Value::BigIntValue(val) = &self {
Ok(&val)
} else {
Err(&self)
}
}
pub fn is_big_int_value(&self) -> bool {
self.as_big_int_value().is_ok()
}
pub fn as_bit_value(&self) -> std::result::Result<&bool, &Self> {
if let Value::BitValue(val) = &self {
Ok(&val)
} else {
Err(&self)
}
}
pub fn is_bit_value(&self) -> bool {
self.as_bit_value().is_ok()
}
pub fn as_blob_value(&self) -> std::result::Result<&smithy_types::Blob, &Self> {
if let Value::BlobValue(val) = &self {
Ok(&val)
} else {
Err(&self)
}
}
pub fn is_blob_value(&self) -> bool {
self.as_blob_value().is_ok()
}
pub fn as_double_value(&self) -> std::result::Result<&f64, &Self> {
if let Value::DoubleValue(val) = &self {
Ok(&val)
} else {
Err(&self)
}
}
pub fn is_double_value(&self) -> bool {
self.as_double_value().is_ok()
}
pub fn as_int_value(&self) -> std::result::Result<&i32, &Self> {
if let Value::IntValue(val) = &self {
Ok(&val)
} else {
Err(&self)
}
}
pub fn is_int_value(&self) -> bool {
self.as_int_value().is_ok()
}
pub fn as_is_null(&self) -> std::result::Result<&bool, &Self> {
if let Value::IsNull(val) = &self {
Ok(&val)
} else {
Err(&self)
}
}
pub fn is_is_null(&self) -> bool {
self.as_is_null().is_ok()
}
pub fn as_real_value(&self) -> std::result::Result<&f32, &Self> {
if let Value::RealValue(val) = &self {
Ok(&val)
} else {