Skip to content

Commit e255a8d

Browse files
committed
ts: name -> accessor
1 parent 3b3b287 commit e255a8d

6 files changed

Lines changed: 19 additions & 19 deletions

File tree

crates/bindings-typescript/src/lib/table.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,14 +156,14 @@ type NormalizeIndexColumns<
156156

157157
/**
158158
* Options for configuring a database table.
159-
* - `name`: The name of the table.
159+
* - `accessor`: The name of the table.
160160
* - `public`: Whether the table is publicly accessible. Defaults to `false`.
161161
* - `indexes`: An array of index configurations for the table.
162162
* - `constraints`: An array of constraint configurations for the table.
163163
* - `scheduled`: The name of the reducer to be executed based on the scheduled rows in this table.
164164
*/
165165
export type TableOpts<Row extends RowObj> = {
166-
name: string;
166+
accessor: string;
167167
public?: boolean;
168168
indexes?: IndexOpts<keyof Row & string>[]; // declarative multi‑column indexes
169169
constraints?: ConstraintOpts<keyof Row & string>[];
@@ -234,17 +234,17 @@ export interface TableMethods<TableDef extends UntypedTableDef>
234234
/**
235235
* Defines a database table with schema and options.
236236
*
237-
* @param opts - Table configuration including name, indexes, and access control
237+
* @param opts - Table configuration including accessor, indexes, and access control
238238
* @param row - Product type defining the table's row structure
239239
* @returns Table handle for use in schema() function
240240
*
241241
* @example
242242
* ```ts
243243
* const playerTable = table(
244-
* { name: 'player', public: true },
244+
* { accessor: 'player', public: true },
245245
* {
246246
* id: t.u32().primaryKey(),
247-
* name: t.string().index('btree')
247+
* accessor: t.string().index('btree')
248248
* }
249249
* );
250250
* ```
@@ -284,9 +284,9 @@ export function table<Row extends RowObj, const Opts extends TableOpts<Row>>(
284284
>,
285285
]
286286
: []
287-
): TableSchema<Opts['name'], CoerceRow<Row>, OptsIndices<Opts>> {
287+
): TableSchema<Opts['accessor'], CoerceRow<Row>, OptsIndices<Opts>> {
288288
const {
289-
name,
289+
accessor: name,
290290
public: isPublic = false,
291291
indexes: userIndexes = [],
292292
scheduled,

crates/bindings-typescript/src/server/schema.test-d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import t from '../lib/type_builders';
44

55
const person = table(
66
{
7-
name: 'person',
7+
accessor: 'person',
88
indexes: [
99
{
1010
name: 'id_name_idx',

crates/bindings-typescript/src/server/view.test-d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import t from '../lib/type_builders';
44

55
const person = table(
66
{
7-
name: 'person',
7+
accessor: 'person',
88
indexes: [
99
{
1010
name: 'name_id_idx',
@@ -45,7 +45,7 @@ const personReordered = table(
4545

4646
const order = table(
4747
{
48-
name: 'order',
48+
accessor: 'order',
4949
indexes: [
5050
{
5151
name: 'id_person_id', // We are adding this to make sure `person_id` still isn't considered indexed.

crates/bindings-typescript/tests/query.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { t } from '../src/lib/type_builders';
1414

1515
const personTable = table(
1616
{
17-
name: 'person',
17+
accessor: 'person',
1818

1919
indexes: [
2020
{
@@ -33,7 +33,7 @@ const personTable = table(
3333

3434
const ordersTable = table(
3535
{
36-
name: 'orders',
36+
accessor: 'orders',
3737
indexes: [
3838
{
3939
name: 'orders_person_id_idx',

modules/benchmarks-ts/src/schema.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,31 +192,31 @@ const velocityTable = table({ name: 'velocity' }, velocity);
192192
const positionTable = table({ name: 'position' }, position);
193193
const gameEnemyAiAgentStateTable = table(
194194
{
195-
name: 'game_enemy_ai_agent_state',
195+
accessor: 'game_enemy_ai_agent_state',
196196
},
197197
gameEnemyAiAgentState
198198
);
199199
const gameTargetableStateTable = table(
200200
{
201-
name: 'game_targetable_state',
201+
accessor: 'game_targetable_state',
202202
},
203203
gameTargetableState
204204
);
205205
const gameLiveTargetableStateTable = table(
206206
{
207-
name: 'game_live_targetable_state',
207+
accessor: 'game_live_targetable_state',
208208
},
209209
gameLiveTargetableState
210210
);
211211
const gameEnemyStateTable = table(
212212
{
213-
name: 'game_enemy_state',
213+
accessor: 'game_enemy_state',
214214
},
215215
gameEnemyState
216216
);
217217
const gameHerdCacheTable = table(
218218
{
219-
name: 'game_herd_cache',
219+
accessor: 'game_herd_cache',
220220
},
221221
gameHerdCache
222222
);

modules/sdk-test-ts/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ const allTableDefs: ExtractTables<typeof allTables> = allTables.map(
806806

807807
const ScheduledTable = table(
808808
{
809-
name: 'scheduled_table',
809+
accessor: 'scheduled_table',
810810
scheduled: 'send_scheduled_message',
811811
public: true,
812812
},
@@ -824,7 +824,7 @@ const IndexedTable = table(
824824

825825
const IndexedTable2 = table(
826826
{
827-
name: 'indexed_table_2',
827+
accessor: 'indexed_table_2',
828828
indexes: [
829829
{
830830
name: 'player_id_snazz_index',

0 commit comments

Comments
 (0)