1use serde::{Deserialize, Serialize};
9
10#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
12#[serde(rename_all = "snake_case")]
13pub struct IntFieldUpdate {
14 pub set: Option<i64>,
16 pub increment: Option<i64>,
18 pub decrement: Option<i64>,
20 pub multiply: Option<i64>,
22 pub divide: Option<i64>,
24}
25
26impl From<i32> for IntFieldUpdate {
27 fn from(v: i32) -> Self {
28 Self {
29 set: Some(v as i64),
30 ..Default::default()
31 }
32 }
33}
34impl From<i64> for IntFieldUpdate {
35 fn from(v: i64) -> Self {
36 Self {
37 set: Some(v),
38 ..Default::default()
39 }
40 }
41}
42
43#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
45#[serde(rename_all = "snake_case")]
46pub struct IntNullableFieldUpdate {
47 pub set: Option<i64>,
49 pub increment: Option<i64>,
51 pub decrement: Option<i64>,
53 pub multiply: Option<i64>,
55 pub divide: Option<i64>,
57 pub unset: Option<bool>,
59}
60
61#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
63#[serde(rename_all = "snake_case")]
64pub struct BigIntFieldUpdate {
65 pub set: Option<i64>,
67 pub increment: Option<i64>,
69 pub decrement: Option<i64>,
71 pub multiply: Option<i64>,
73 pub divide: Option<i64>,
75}
76
77impl From<i64> for BigIntFieldUpdate {
78 fn from(v: i64) -> Self {
79 Self {
80 set: Some(v),
81 ..Default::default()
82 }
83 }
84}
85
86#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
88#[serde(rename_all = "snake_case")]
89pub struct BigIntNullableFieldUpdate {
90 pub set: Option<i64>,
92 pub increment: Option<i64>,
94 pub decrement: Option<i64>,
96 pub multiply: Option<i64>,
98 pub divide: Option<i64>,
100 pub unset: Option<bool>,
102}
103
104#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
106#[serde(rename_all = "snake_case")]
107pub struct FloatFieldUpdate {
108 pub set: Option<f64>,
110 pub increment: Option<f64>,
112 pub decrement: Option<f64>,
114 pub multiply: Option<f64>,
116 pub divide: Option<f64>,
118}
119
120impl From<f64> for FloatFieldUpdate {
121 fn from(v: f64) -> Self {
122 Self {
123 set: Some(v),
124 ..Default::default()
125 }
126 }
127}
128
129#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
131#[serde(rename_all = "snake_case")]
132pub struct FloatNullableFieldUpdate {
133 pub set: Option<f64>,
135 pub increment: Option<f64>,
137 pub decrement: Option<f64>,
139 pub multiply: Option<f64>,
141 pub divide: Option<f64>,
143 pub unset: Option<bool>,
145}
146
147#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
149#[serde(rename_all = "snake_case")]
150pub struct DecimalFieldUpdate {
151 pub set: Option<String>,
153 pub increment: Option<String>,
155 pub decrement: Option<String>,
157 pub multiply: Option<String>,
159 pub divide: Option<String>,
161}
162
163#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
165#[serde(rename_all = "snake_case")]
166pub struct DecimalNullableFieldUpdate {
167 pub set: Option<String>,
169 pub increment: Option<String>,
171 pub decrement: Option<String>,
173 pub multiply: Option<String>,
175 pub divide: Option<String>,
177 pub unset: Option<bool>,
179}
180
181#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
183#[serde(rename_all = "snake_case")]
184pub struct StringFieldUpdate {
185 pub set: Option<String>,
187}
188
189impl From<&str> for StringFieldUpdate {
190 fn from(v: &str) -> Self {
191 Self {
192 set: Some(v.into()),
193 }
194 }
195}
196impl From<String> for StringFieldUpdate {
197 fn from(v: String) -> Self {
198 Self { set: Some(v) }
199 }
200}
201
202#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
204#[serde(rename_all = "snake_case")]
205pub struct StringNullableFieldUpdate {
206 pub set: Option<String>,
208 pub unset: Option<bool>,
210}
211
212impl From<&str> for StringNullableFieldUpdate {
213 fn from(v: &str) -> Self {
214 Self {
215 set: Some(v.into()),
216 unset: None,
217 }
218 }
219}
220impl From<String> for StringNullableFieldUpdate {
221 fn from(v: String) -> Self {
222 Self {
223 set: Some(v),
224 unset: None,
225 }
226 }
227}
228
229#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
231#[serde(rename_all = "snake_case")]
232pub struct BoolFieldUpdate {
233 pub set: Option<bool>,
235}
236
237impl From<bool> for BoolFieldUpdate {
238 fn from(v: bool) -> Self {
239 Self { set: Some(v) }
240 }
241}
242
243#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
245#[serde(rename_all = "snake_case")]
246pub struct BoolNullableFieldUpdate {
247 pub set: Option<bool>,
249 pub unset: Option<bool>,
251}
252
253#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
255#[serde(
256 rename_all = "snake_case",
257 bound = "E: Serialize + for<'de2> Deserialize<'de2>"
258)]
259pub struct EnumFieldUpdate<E> {
260 pub set: Option<E>,
262}
263
264#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
266#[serde(
267 rename_all = "snake_case",
268 bound = "E: Serialize + for<'de2> Deserialize<'de2>"
269)]
270pub struct EnumNullableFieldUpdate<E> {
271 pub set: Option<E>,
273 pub unset: Option<bool>,
275}
276
277#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
279#[serde(rename_all = "snake_case")]
280pub struct DateTimeFieldUpdate {
281 pub set: Option<String>,
283}
284
285#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
287#[serde(rename_all = "snake_case")]
288pub struct DateTimeNullableFieldUpdate {
289 pub set: Option<String>,
291 pub unset: Option<bool>,
293}
294
295#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
297#[serde(rename_all = "snake_case")]
298pub struct BytesFieldUpdate {
299 pub set: Option<String>,
301}
302
303#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
305#[serde(rename_all = "snake_case")]
306pub struct BytesNullableFieldUpdate {
307 pub set: Option<String>,
309 pub unset: Option<bool>,
311}
312
313#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
315#[serde(rename_all = "snake_case")]
316pub struct UuidFieldUpdate {
317 pub set: Option<String>,
319}
320
321#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
323#[serde(rename_all = "snake_case")]
324pub struct UuidNullableFieldUpdate {
325 pub set: Option<String>,
327 pub unset: Option<bool>,
329}
330
331#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
333#[serde(rename_all = "snake_case")]
334pub struct JsonFieldUpdate {
335 pub set: Option<serde_json::Value>,
337}
338
339#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
341#[serde(rename_all = "snake_case")]
342pub struct JsonNullableFieldUpdate {
343 pub set: Option<serde_json::Value>,
345 pub unset: Option<bool>,
347}