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
use chrono::{DateTime, NaiveDate, NaiveDateTime, NaiveTime, Utc};
use time::{Date, OffsetDateTime, PrimitiveDateTime, Time};
use uuid::Uuid;
/// This enum represents a [Null](Value::Null)'s type
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum NullType {
/// String representation
String,
/// Choice representation
Choice,
/// i64 representation
I64,
/// i32 representation
I32,
/// i16 representation
I16,
/// Bool representation
Bool,
/// f64 representation
F64,
/// f32 representation
F32,
/// binary representation
Binary,
/// Naive Time representation
ChronoNaiveTime,
/// Naive Date representation
ChronoNaiveDate,
/// Naive DateTime representation
ChronoNaiveDateTime,
/// Chrono timezone aware date time representation
ChronoDateTime,
/// time's date representation
TimeDate,
/// time's time representation
TimeTime,
/// time's offset datetime representation
TimeOffsetDateTime,
/// time's primitive datetime representation
TimePrimitiveDateTime,
/// Uuid representation
Uuid,
/// Uuid in hyphenated representation
UuidHyphenated,
/// Uuid in simple text representation
UuidSimple,
/// serde_json's Value representation
JsonValue,
/// Mac address representation
#[cfg(feature = "postgres-only")]
MacAddress,
/// IP network presentation
#[cfg(feature = "postgres-only")]
IpNetwork,
/// Bit vec representation
#[cfg(feature = "postgres-only")]
BitVec,
}
/**
This enum represents a value
*/
#[derive(Copy, Clone, Debug, PartialEq)]
pub enum Value<'a> {
/// null representation
Null(NullType),
/// Representation of an identifier, e.g. a column.
/// This variant will not be escaped, so do not
/// pass unchecked data to it.
#[deprecated(note = "Is this still used?")]
Ident(&'a str),
/// Representation of a column name with
/// an optional table name
Column {
/// Name of the table
table_name: Option<&'a str>,
/// Name of the column
column_name: &'a str,
},
/// Representation of choices
Choice(&'a str),
/// String representation
String(&'a str),
/// i64 representation
I64(i64),
/// i32 representation
I32(i32),
/// i16 representation
I16(i16),
/// Bool representation
Bool(bool),
/// f64 representation
F64(f64),
/// f32 representation
F32(f32),
/// binary representation
Binary(&'a [u8]),
/// chrono's Naive Time representation
ChronoNaiveTime(NaiveTime),
/// chrono's Naive Date representation
ChronoNaiveDate(NaiveDate),
/// chrono's Naive DateTime representation
ChronoNaiveDateTime(NaiveDateTime),
/// chrono's Timezone aware datetime
ChronoDateTime(DateTime<Utc>),
/// time's date representation
TimeDate(Date),
/// time's time representation
TimeTime(Time),
/// time's offset datetime representation
TimeOffsetDateTime(OffsetDateTime),
/// time's primitive datetime representation
TimePrimitiveDateTime(PrimitiveDateTime),
/// Uuid representation
Uuid(Uuid),
/// Uuid in hyphenated representation
#[deprecated(note = "Was this ever used?")]
UuidHyphenated(Uuid),
/// Uuid in simple text representation
#[deprecated(note = "Was this ever used?")]
UuidSimple(Uuid),
/// serde_json's Value representation
JsonValue(&'a serde_json::Value),
/// Mac address representation
#[cfg(feature = "postgres-only")]
MacAddress(mac_address::MacAddress),
/// IP network presentation
#[cfg(feature = "postgres-only")]
IpNetwork(ipnetwork::IpNetwork),
/// Bit vec representation
#[cfg(feature = "postgres-only")]
BitVec(&'a bit_vec::BitVec),
/// null representation
#[cfg(feature = "postgres-only")]
ArrayNull(NullType),
/// String representation
#[cfg(feature = "postgres-only")]
ArrayString(&'a [&'a str]),
/// i64 representation
#[cfg(feature = "postgres-only")]
ArrayI64(&'a [i64]),
/// i32 representation
#[cfg(feature = "postgres-only")]
ArrayI32(&'a [i32]),
/// i16 representation
#[cfg(feature = "postgres-only")]
ArrayI16(&'a [i16]),
/// Bool representation
#[cfg(feature = "postgres-only")]
ArrayBool(&'a [bool]),
/// f64 representation
#[cfg(feature = "postgres-only")]
ArrayF64(&'a [f64]),
/// f32 representation
#[cfg(feature = "postgres-only")]
ArrayF32(&'a [f32]),
/// binary representation
#[cfg(feature = "postgres-only")]
ArrayBinary(&'a [&'a [u8]]),
/// chrono's Naive Time representation
#[cfg(feature = "postgres-only")]
ArrayChronoNaiveTime(&'a [NaiveTime]),
/// chrono's Naive Date representation
#[cfg(feature = "postgres-only")]
ArrayChronoNaiveDate(&'a [NaiveDate]),
/// chrono's Naive DateTime representation
#[cfg(feature = "postgres-only")]
ArrayChronoNaiveDateTime(&'a [NaiveDateTime]),
/// chrono's Timezone aware datetime
#[cfg(feature = "postgres-only")]
ArrayChronoDateTime(&'a [DateTime<Utc>]),
/// time's date representation
#[cfg(feature = "postgres-only")]
ArrayTimeDate(&'a [Date]),
/// time's time representation
#[cfg(feature = "postgres-only")]
ArrayTimeTime(&'a [Time]),
/// time's offset datetime representation
#[cfg(feature = "postgres-only")]
ArrayTimeOffsetDateTime(&'a [OffsetDateTime]),
/// time's primitive datetime representation
#[cfg(feature = "postgres-only")]
ArrayTimePrimitiveDateTime(&'a [PrimitiveDateTime]),
/// Uuid representation
#[cfg(feature = "postgres-only")]
ArrayUuid(&'a [Uuid]),
/// serde_json's Value representation
#[cfg(feature = "postgres-only")]
ArrayJsonValue(&'a [&'a serde_json::Value]),
/// Mac address representation
#[cfg(feature = "postgres-only")]
ArrayMacAddress(&'a [mac_address::MacAddress]),
/// IP network presentation
#[cfg(feature = "postgres-only")]
ArrayIpNetwork(&'a [ipnetwork::IpNetwork]),
/// Bit vec representation
#[cfg(feature = "postgres-only")]
ArrayBitVec(&'a [&'a bit_vec::BitVec]),
}