Skip to content

Delete

Delete allows you to remove Items by one of their key paths. You can use any of the Item’s key paths and the Item will be deleted from all of them. Delete doesn’t return anything, whether or not anything was actually deleted (e.g. if there wasn’t any Item at the given key path). Delete also supports batches of up to 50 key paths at a time.

For this example we’ll use the schema defined in Example: Movies Schema, which defines Movie as an Item Type with the key path /movies-:id.

15 collapsed lines
1
package main
2
3
import (
4
"context"
5
"fmt"
6
"os"
7
"slices"
8
"strconv"
9
"time"
10
11
"github.com/StatelyCloud/go-sdk/stately"
12
// This is the code you generated from schema
13
"github.com/StatelyCloud/stately/go-sdk-sample/schema"
14
)
15
16
func sampleDelete(
17
ctx context.Context,
18
client stately.Client,
19
movieID []byte,
20
) error {
21
return client.Delete(ctx, "/movie-"+stately.ToKeyID(movieID))
22
}

Tombstones

Deleted Items leave behind a “tombstone” record which lets you know that they have been deleted. You can’t interact with the tombstone through any of our APIs, but it’s important that they exist to allow SyncList to tell you about Items that have been deleted since your last sync. Tombstones take up very little space and are automatically cleaned up after some time (on the order of weeks).