Skip to content

Commit 98585e8

Browse files
authored
Rename with_module_name -> with_database_name (#4267)
# Description of Changes Modules are like programs, databases are like processes. Your client connects to a remote database, not a remote module. <!-- Please describe your change, mention any related tickets, and so on here. --> # API and ABI breaking changes Yep! # Expected complexity level and risk 2? I made this change with find + replace, and it's possible that I borked the edit, or missed some reference somehow. It seems unlikely, however, that this change will have deeper implications we haven't considered. # Testing N/a
1 parent 798d17b commit 98585e8

60 files changed

Lines changed: 142 additions & 142 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

crates/bindings-typescript/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { DbConnection } from './module_bindings';
2525

2626
const connection = DbConnection.builder()
2727
.withUri('ws://localhost:3000')
28-
.withModuleName('MODULE_NAME')
28+
.withDatabaseName('MODULE_NAME')
2929
.onDisconnect(() => {
3030
console.log('disconnected');
3131
})
@@ -71,7 +71,7 @@ This module also include React hooks to subscribe to tables under the `spacetime
7171
```tsx
7272
const connectionBuilder = DbConnection.builder()
7373
.withUri('ws://localhost:3000')
74-
.withModuleName('MODULE_NAME')
74+
.withDatabaseName('MODULE_NAME')
7575
.withLightMode(true)
7676
.onDisconnect(() => {
7777
console.log('disconnected');

crates/bindings-typescript/src/sdk/db_connection_builder.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ export class DbConnectionBuilder<DbConnection extends DbConnectionImpl<any>> {
5757
}
5858

5959
/**
60-
* Set the name or Identity of the database module to connect to.
60+
* Set the name or Identity of the remote database to connect to.
6161
*
6262
* @param nameOrAddress
6363
*
6464
* @returns The `DbConnectionBuilder` instance.
6565
*/
66-
withModuleName(nameOrAddress: string): this {
66+
withDatabaseName(nameOrAddress: string): this {
6767
this.#nameOrAddress = nameOrAddress;
6868
return this;
6969
}
@@ -243,7 +243,7 @@ export class DbConnectionBuilder<DbConnection extends DbConnectionImpl<any>> {
243243
* const host = "http://localhost:3000";
244244
* const name_or_address = "database_name"
245245
* const auth_token = undefined;
246-
* DbConnection.builder().withUri(host).withModuleName(name_or_address).withToken(auth_token).build();
246+
* DbConnection.builder().withUri(host).withDatabaseName(name_or_address).withToken(auth_token).build();
247247
* ```
248248
*/
249249
build(): DbConnection {

crates/bindings-typescript/test-app/src/main.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { DbConnection, query } from './module_bindings/index.ts';
77

88
const connectionBuilder = DbConnection.builder()
99
.withUri('ws://localhost:3000')
10-
.withModuleName('game')
10+
.withDatabaseName('game')
1111
.withLightMode(true)
1212
.onDisconnect(() => {
1313
console.log('disconnected');

crates/bindings-typescript/test-react-router-app/src/main.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const onConnectError = (_ctx: ErrorContext, err: Error) => {
2424
// set all the settings you need, be sure your Uri and Module Name are correct
2525
const connBuilder = DbConnection.builder()
2626
.withUri('ws://localhost:3000')
27-
.withModuleName('simple-stdb-react-hooks-example')
27+
.withDatabaseName('simple-stdb-react-hooks-example')
2828
.withToken(localStorage.getItem('stdbToken') || '')
2929
.onConnect(onConnect)
3030
.onConnectError(onConnectError)

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ describe('DbConnection', () => {
7373
let connectCalled = false;
7474
const client = DbConnection.builder()
7575
.withUri('ws://127.0.0.1:1234')
76-
.withModuleName('db')
76+
.withDatabaseName('db')
7777
.withWSFn(() => {
7878
return Promise.reject(new Error('Failed to connect'));
7979
})
@@ -99,7 +99,7 @@ describe('DbConnection', () => {
9999
let called = false;
100100
const client = DbConnection.builder()
101101
.withUri('ws://127.0.0.1:1234')
102-
.withModuleName('db')
102+
.withDatabaseName('db')
103103
.withWSFn(wsAdapter.createWebSocketFn.bind(wsAdapter) as any)
104104
.onConnect(() => {
105105
called = true;
@@ -126,7 +126,7 @@ describe('DbConnection', () => {
126126
const wsAdapter = new WebsocketTestAdapter();
127127
const client = DbConnection.builder()
128128
.withUri('ws://127.0.0.1:1234')
129-
.withModuleName('db')
129+
.withDatabaseName('db')
130130
.withWSFn(wsAdapter.createWebSocketFn.bind(wsAdapter) as any)
131131
.onConnect(() => {})
132132
.build();
@@ -305,7 +305,7 @@ describe('DbConnection', () => {
305305
const wsAdapter = new WebsocketTestAdapter();
306306
const client = DbConnection.builder()
307307
.withUri('ws://127.0.0.1:1234')
308-
.withModuleName('db')
308+
.withDatabaseName('db')
309309
.withWSFn(wsAdapter.createWebSocketFn.bind(wsAdapter) as any)
310310
.onConnect(() => {})
311311
.build();
@@ -373,7 +373,7 @@ describe('DbConnection', () => {
373373
const wsAdapter = new WebsocketTestAdapter();
374374
const client = DbConnection.builder()
375375
.withUri('ws://127.0.0.1:1234')
376-
.withModuleName('db')
376+
.withDatabaseName('db')
377377
.withWSFn(wsAdapter.createWebSocketFn.bind(wsAdapter) as any)
378378
.onConnect(() => {})
379379
.build();
@@ -451,7 +451,7 @@ describe('DbConnection', () => {
451451
const wsAdapter = new WebsocketTestAdapter();
452452
const client = DbConnection.builder()
453453
.withUri('ws://127.0.0.1:1234')
454-
.withModuleName('db')
454+
.withDatabaseName('db')
455455
.withWSFn(wsAdapter.createWebSocketFn.bind(wsAdapter) as any)
456456
.onConnect(() => {})
457457
.build();
@@ -585,7 +585,7 @@ describe('DbConnection', () => {
585585
const wsAdapter = new WebsocketTestAdapter();
586586
const client = DbConnection.builder()
587587
.withUri('ws://127.0.0.1:1234')
588-
.withModuleName('db')
588+
.withDatabaseName('db')
589589
.withWSFn(wsAdapter.createWebSocketFn.bind(wsAdapter) as any)
590590
.build();
591591
await client['wsPromise'];

crates/codegen/src/unrealcpp.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2854,7 +2854,7 @@ fn generate_db_connection_builder_class(output: &mut UnrealCppAutogen, api_macro
28542854
writeln!(output, " UFUNCTION(BlueprintCallable, Category = \"SpacetimeDB\")");
28552855
writeln!(
28562856
output,
2857-
" UDbConnectionBuilder* WithModuleName(const FString& InName);"
2857+
" UDbConnectionBuilder* WithDatabaseName(const FString& InName);"
28582858
);
28592859
writeln!(output, " UFUNCTION(BlueprintCallable, Category = \"SpacetimeDB\")");
28602860
writeln!(output, " UDbConnectionBuilder* WithToken(const FString& InToken);");
@@ -3455,12 +3455,12 @@ fn generate_client_implementation(
34553455
writeln!(output, "}}");
34563456
writeln!(
34573457
output,
3458-
"UDbConnectionBuilder* UDbConnectionBuilder::WithModuleName(const FString& InName)"
3458+
"UDbConnectionBuilder* UDbConnectionBuilder::WithDatabaseName(const FString& InName)"
34593459
);
34603460
writeln!(output, "{{");
34613461
writeln!(
34623462
output,
3463-
"\treturn Cast<UDbConnectionBuilder>(WithModuleNameBase(InName));"
3463+
"\treturn Cast<UDbConnectionBuilder>(WithDatabaseNameBase(InName));"
34643464
);
34653465
writeln!(output, "}}");
34663466
writeln!(

demo/Blackholio/client-unity/Assets/PlayModeTests/PlayModeExampleTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public IEnumerator SimpleConnectionTest()
2727
{
2828
Debug.Assert(false, "Connection failed!");
2929
}).WithUri("http://127.0.0.1:3000")
30-
.WithModuleName("blackholio").Build();
30+
.WithDatabaseName("blackholio").Build();
3131

3232
while (!connected)
3333
{

demo/Blackholio/client-unity/Assets/Scripts/GameManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ private void Start()
4242
.OnConnectError(HandleConnectError)
4343
.OnDisconnect(HandleDisconnect)
4444
.WithUri(SERVER_URL)
45-
.WithModuleName(MODULE_NAME);
45+
.WithDatabaseName(MODULE_NAME);
4646

4747
// If the user has a SpacetimeDB auth token stored in the Unity PlayerPrefs,
4848
// we can use it to authenticate the connection.

demo/Blackholio/client-unreal/Source/client_unreal/Private/GameManager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void AGameManager::BeginPlay()
6565

6666
UDbConnectionBuilder* Builder = UDbConnection::Builder()
6767
->WithUri(ServerUri)
68-
->WithModuleName(ModuleName)
68+
->WithDatabaseName(ModuleName)
6969
->OnConnect(ConnectDelegate)
7070
->OnDisconnect(DisconnectDelegate)
7171
->OnConnectError(ConnectErrorDelegate);
@@ -338,4 +338,4 @@ AFood* AGameManager::SpawnFood(const FFoodType& FoodEntity)
338338
EntityMap.Add(FoodEntity.EntityId, Food);
339339
}
340340
return Food;
341-
}
341+
}

demo/Blackholio/client-unreal/Source/client_unreal/Private/ModuleBindings/SpacetimeDBClient.g.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -981,9 +981,9 @@ UDbConnectionBuilder* UDbConnectionBuilder::WithUri(const FString& InUri)
981981
{
982982
return Cast<UDbConnectionBuilder>(WithUriBase(InUri));
983983
}
984-
UDbConnectionBuilder* UDbConnectionBuilder::WithModuleName(const FString& InName)
984+
UDbConnectionBuilder* UDbConnectionBuilder::WithDatabaseName(const FString& InName)
985985
{
986-
return Cast<UDbConnectionBuilder>(WithModuleNameBase(InName));
986+
return Cast<UDbConnectionBuilder>(WithDatabaseNameBase(InName));
987987
}
988988
UDbConnectionBuilder* UDbConnectionBuilder::WithToken(const FString& InToken)
989989
{

0 commit comments

Comments
 (0)