Skip to content
Source
Sign inSign up
TanStack/db
Open History to see the last commit

SyncConfig.md

110 lines1.8 KB

1---
2id: SyncConfig
3title: SyncConfig
4---
5​
6# Interface: SyncConfig\<T, TKey\>
7​
8Defined in: [packages/db/src/types.ts:327](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L327)
9​
10## Type Parameters
11​
12### T
13​
14`T` *extends* `object` = `Record`\<`string`, `unknown`\>
15​
16### TKey
17​
18`TKey` *extends* `string` \| `number` = `string` \| `number`
19​
20## Properties
21​
22### getSyncMetadata()?
23​
24```ts
25optional getSyncMetadata: () => Record<string, unknown>;
26```
27​
28Defined in: [packages/db/src/types.ts:350](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L350)
29​
30Get the sync metadata for insert operations
31​
32#### Returns
33​
34`Record`\<`string`, `unknown`\>
35​
36Record containing relation information
37​
38***
39​
40### rowUpdateMode?
41​
42```ts
43optional rowUpdateMode: "full" | "partial";
44```
45​
46Defined in: [packages/db/src/types.ts:359](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L359)
47​
48The row update mode used to sync to the collection.
49​
50#### Default
51​
52`partial`
53​
54#### Description
55​
56- `partial`: Updates contain only the changes to the row.
57- `full`: Updates contain the entire row.
58​
59***
60​
61### sync()
62​
63```ts
64sync: (params) =>
65 | void
66 | CleanupFn
67 | SyncConfigRes;
68```
69​
70Defined in: [packages/db/src/types.ts:331](https://github.com/TanStack/db/blob/main/packages/db/src/types.ts#L331)
71​
72#### Parameters
73​
74##### params
75​
76###### begin
77​
78(`options?`) => `void`
79​
80Begin a new sync transaction.
81​
82###### collection
83​
84[`Collection`](Collection.md)\<`T`, `TKey`, `any`, `any`, `any`\>
85​
86###### commit
87​
88() => `void`
89​
90###### markReady
91​
92() => `void`
93​
94###### metadata?
95​
96[`SyncMetadataApi`](SyncMetadataApi.md)\<`TKey`\>
97​
98###### truncate
99​
100() => `void`
101​
102###### write
103​
104(`message`) => `void`
105​
106#### Returns
107​
108 \| `void`
109 \| [`CleanupFn`](../type-aliases/CleanupFn.md)
110 \| [`SyncConfigRes`](../type-aliases/SyncConfigRes.md)