You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+38-14Lines changed: 38 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -185,6 +185,44 @@ In combination with a `SerialName` specified for the child class, you have full
185
185
}
186
186
```
187
187
188
+
<h4>Serialization of Updates</h4>
189
+
Firestore contains update methods that allow for multiple fields to be updated at the same time.
190
+
This sdk offers special update methods that allow for applying custom serialization to each individual field though an update builder.
191
+
Where an `update` method exists, an `updateFields` method will also be available. In this, each value can have its serializer customized:
192
+
193
+
```kotlin
194
+
documentRef.updateFields {
195
+
"field" to "value"
196
+
// Set the value of otherField to "1" using a custom Serializer
197
+
"otherField".to(IntAsStringSerializer(), 1)
198
+
199
+
// Overwrite build settings. All fields added after this will have these build settings applied
200
+
buildSettings = {
201
+
encodeDefaults =true
202
+
serializersModule = module
203
+
}
204
+
"city" to abstractCity
205
+
}
206
+
```
207
+
208
+
Similarly, the `Query` methods `startAt`/`startAfter`/`endAt`/`endBefore` have an alternative method in `startAtFieldValues`/`startAfterFieldValues`/`endAtFieldValues`/`endBeforeFieldValues`
209
+
210
+
```kotlin
211
+
query.orderBy("field", "otherField", "city").startAtFieldValues { // similar syntax for startAfter/endAt/endBefore
212
+
add("Value")
213
+
214
+
// Starts at "1" for the otherField value
215
+
add(1, IntAsStringSerializer())
216
+
217
+
// Overwrite build settings. All field values added after this will have these build settings applied
0 commit comments