Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 65 additions & 6 deletions client-sdks/advanced/raw-tables.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ This eliminates overhead associated with extracting values from the JSON data an
- **Dart**: Version 1.18.0 of `package:powersync`.
- **Kotlin**: Version 1.11.0.
- **Swift**: Version 1.12.0.
- **.NET**: Version 1.0.1.
- **Rust**: Version 0.0.4.
- This feature is not yet available on our .NET SDK.
</Note>

## When to Use Raw Tables
Expand Down Expand Up @@ -133,7 +133,13 @@ let schema = Schema(lists)
```

```csharp .NET
Unfortunately, raw tables are not yet available in the .NET SDK.
// To define a raw table, include it in the list of tables passed to the Schema
var lists = new RawTable(
name: "todo_lists",
schema: new RawTableSchema()
);

var schema = new Schema(lists);
```

```rust Rust
Expand Down Expand Up @@ -270,7 +276,28 @@ let schema = Schema(lists)
```

```csharp .NET
Unfortunately, raw tables are not yet available in the .NET SDK.
// To define a raw table, include it in the list of tables passed to the Schema
var lists = new RawTable(
name: "todo_lists",
put: new PendingStatement
{
SQL = "INSERT OR REPLACE INTO todo_lists (id, created_by, title, content) VALUES (?, ?, ?, ?)",
Parameters =
[
PendingStatementParameter.Id,
PendingStatementParameter.Column("created_by"),
PendingStatementParameter.Column("title"),
PendingStatementParameter.Column("content"),
],
},
delete: new PendingStatement
{
SQL = "DELETE FROM todo_lists WHERE id = ?",
Parameters = [PendingStatementParameter.Id],
}
);

var schema = new Schema(lists);
```

```rust Rust
Expand Down Expand Up @@ -407,7 +434,19 @@ for write in ["INSERT", "UPDATE", "DELETE"] {
```

```csharp .NET
Unfortunately, raw tables are not yet available in the .NET SDK.
var lists = new RawTable(
name: "todo_lists",
schema: new RawTableSchema()
);

await database.Execute("CREATE TABLE todo_lists (...)");
foreach (var write in new string[] { "INSERT", "UPDATE", "DELETE" })
{
await database.Execute(
"SELECT powersync_create_raw_table_crud_trigger(?, ?, ?)",
[lists.JsonDescription(), $"todo_lists_{write}", write]
);
}
```

```rust Rust
Expand Down Expand Up @@ -560,7 +599,12 @@ let lists = RawTable(
```

```csharp .NET
Unfortunately, raw tables are not yet available in the .NET SDK.
var lists = new RawTable(
name: "todo_lists",
schema: new RawTableSchema(
syncedColumns: ["created_by", "title", "content"]
)
);
```

```rust Rust
Expand Down Expand Up @@ -877,7 +921,22 @@ let lists = RawTable(
```

```csharp .NET
Unfortunately, raw tables are not yet available in the .NET SDK.
var lists = new RawTable(
name: "todo_lists",
put: new PendingStatement
{
SQL = "INSERT OR REPLACE INTO todo_lists (id, created_by, title, content, _extra) VALUES (?, ?, ?, ?, ?)",
Parameters =
[
PendingStatementParameter.Id,
PendingStatementParameter.Column("created_by"),
PendingStatementParameter.Column("title"),
PendingStatementParameter.Column("content"),
PendingStatementParameter.Rest,
],
},
delete: ...
);
```

```rust Rust
Expand Down
Loading