Tableclass

A database table. Operations always fetch current data and never cache records.

object→Table
Namespace
global
Assembly
Sandbox.Engine
Declaration
public sealed class Sandbox.Services.Database.Table

Methods5

Showing 5 methods

public System.Threading.Tasks.Task`1<Sandbox.Services.Database.Record> Create(string key, string value, string group = null, bool isPublic = False)PUBLIC

Create a record without overwriting an existing key (status 409 on duplicate). Keys and optional immutable group keys are case-sensitive, up to 128 characters. Records are private by default. Public records can be read by anyone; only the owner can update them.

ParameterTypeDescription
keystringA key unique within your package and table, up to 128 characters, regardless of group.
valuestringThe text to store, up to 65536 UTF-8 bytes.
group = nullstringAn optional immutable group label, up to 128 characters.
isPublic = FalseboolWhether other players can read this record. Defaults to false.
Returns:Task<Record>—

public System.Threading.Tasks.Task`1<Sandbox.Services.Database.Record> Get(long id)PUBLIC

Read a public record or one owned by the signed-in player. Missing or inaccessible records fail with status 404.

ParameterTypeDescription
idlongThe stable ID of the record to read.
Returns:Task<Record>—

public System.Threading.Tasks.Task`1<System.Collections.Generic.IReadOnlyDictionary`2<string,Sandbox.Services.Database.GroupInfo>> GetPublicGroupInfo(string[] groups)PUBLIC

Get public record counts and creation-time ranges for up to 100 group keys. Empty groups are included with a zero count and null dates; duplicate keys appear once.

ParameterTypeDescription
groupsstring[]One to 100 group labels. Duplicate labels are counted once.
Returns:Task<IReadOnlyDictionary<string,GroupInfo>>—

public System.Threading.Tasks.Task`1<Sandbox.Services.Database.Page> List(string group = null, long cursor = 0, int pageSize = 20)PUBLIC

Get public records in one group. A null group selects ungrouped records, not every group. Page size must be 1–100. Pass NextCursor as cursor with the same group to get the next page.

ParameterTypeDescription
group = nullstringThe group to list. Null selects only ungrouped records.
cursor = 0longThe previous page’s NextCursor, or zero for the first page.
pageSize = 20intThe maximum number of records to return, from 1 to 100.
Returns:Task<Page>—

public System.Threading.Tasks.Task`1<Sandbox.Services.Database.Page> ListOwned(string group = null, long cursor = 0, int pageSize = 20)PUBLIC

Get your records in one group, including private records. A null group selects ungrouped records. Page size must be 1–100. Pass NextCursor as cursor with the same group to get the next page.

ParameterTypeDescription
group = nullstringThe group to list. Null selects only ungrouped records.
cursor = 0longThe previous page’s NextCursor, or zero for the first page.
pageSize = 20intThe maximum number of records to return, from 1 to 100.
Returns:Task<Page>—

Properties2

Showing 2 properties

public string Sandbox.Services.Database.Table.Name { get; set; }PUBLICGETSET

The case-sensitive name of this table.

Returns:string—

public string Sandbox.Services.Database.Table.Package { get; set; }PUBLICGETSET

The package that owns this table.

Returns:string—

On this page