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
package main
import (
"context"
"fmt"
"os"
"slices"
"strconv"
"time"
"github.com/StatelyCloud/go-sdk/stately"
// This is the code you generated from schema
"github.com/StatelyCloud/stately/go-sdk-sample/schema"
)
func sampleDelete(
ctx context.Context,
client stately.Client,
movieID []byte,
) error {
return client.Delete(ctx, "/movie-"+stately.ToKeyID(movieID))
}

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).