Skip to content

Commit 42e00ac

Browse files
committed
[hygiene] Rename logSql to onSqlCommand
1 parent 951cc32 commit 42e00ac

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

src/persisters/persister-cr-sqlite-wasm.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const createCrSqliteWasmPersister = ((
99
store: Store,
1010
db: DB,
1111
configOrStoreTableName?: DatabasePersisterConfig | string,
12-
logSql?: (sql: string, args?: any[]) => void,
12+
onSqlCommand?: (sql: string, args?: any[]) => void,
1313
onIgnoredError?: (error: any) => void,
1414
): Persister =>
1515
createSqlitePersister(
@@ -20,7 +20,7 @@ export const createCrSqliteWasmPersister = ((
2020
(listener: UpdateListener): (() => void) =>
2121
db.onUpdate((_, _2, tableName) => listener(tableName)),
2222
(removeListener: () => void): void => removeListener(),
23-
logSql,
23+
onSqlCommand,
2424
onIgnoredError,
2525
db,
2626
)) as typeof createCrSqliteWasmPersisterDecl;

src/persisters/persister-expo-sqlite.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const createExpoSqlitePersister = ((
1111
store: Store,
1212
db: SQLiteDatabase,
1313
configOrStoreTableName?: DatabasePersisterConfig | string,
14-
logSql?: (sql: string, args?: any[]) => void,
14+
onSqlCommand?: (sql: string, args?: any[]) => void,
1515
onIgnoredError?: (error: any) => void,
1616
): Persister =>
1717
createSqlitePersister(
@@ -22,7 +22,7 @@ export const createExpoSqlitePersister = ((
2222
(listener: UpdateListener): Subscription =>
2323
db.onDatabaseChange(({tableName}) => listener(tableName)),
2424
(subscription: Subscription) => subscription.remove(),
25-
logSql,
25+
onSqlCommand,
2626
onIgnoredError,
2727
db,
2828
)) as typeof createExpoSqlitePersisterDecl;

src/persisters/persister-sqlite-wasm.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const createSqliteWasmPersister = ((
99
sqlite3: any,
1010
db: any,
1111
configOrStoreTableName?: DatabasePersisterConfig | string,
12-
logSql?: (sql: string, args?: any[]) => void,
12+
onSqlCommand?: (sql: string, args?: any[]) => void,
1313
onIgnoredError?: (error: any) => void,
1414
): Persister =>
1515
createSqlitePersister(
@@ -26,7 +26,7 @@ export const createSqliteWasmPersister = ((
2626
0,
2727
),
2828
(): void => sqlite3.capi.sqlite3_update_hook(db, () => 0, 0),
29-
logSql,
29+
onSqlCommand,
3030
onIgnoredError,
3131
db,
3232
)) as typeof createSqliteWasmPersisterDecl;

src/persisters/persister-sqlite3.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const createSqlite3Persister = ((
1414
store: Store,
1515
db: Database,
1616
configOrStoreTableName?: DatabasePersisterConfig | string,
17-
logSql?: (sql: string, args?: any[]) => void,
17+
onSqlCommand?: (sql: string, args?: any[]) => void,
1818
onIgnoredError?: (error: any) => void,
1919
): Persister =>
2020
createSqlitePersister(
@@ -35,7 +35,7 @@ export const createSqlite3Persister = ((
3535
return observer;
3636
},
3737
(observer: Observer): any => db.off(CHANGE, observer),
38-
logSql,
38+
onSqlCommand,
3939
onIgnoredError,
4040
db,
4141
)) as typeof createSqlite3PersisterDecl;

src/persisters/sqlite/create.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const createSqlitePersister = <UpdateListeningHandle>(
2424
cmd: Cmd,
2525
addUpdateListener: (listener: UpdateListener) => UpdateListeningHandle,
2626
delUpdateListener: (listeningHandle: UpdateListeningHandle) => void,
27-
logSql: ((sql: string, args?: any[]) => void) | undefined,
27+
onSqlCommand: ((sql: string, args?: any[]) => void) | undefined,
2828
onIgnoredError: ((error: any) => void) | undefined,
2929
scheduleId: any,
3030
): Persister => {
@@ -75,9 +75,9 @@ export const createSqlitePersister = <UpdateListeningHandle>(
7575

7676
return (isJson ? createJsonSqlitePersister : createTabularSqlitePersister)(
7777
store,
78-
logSql
78+
onSqlCommand
7979
? async (sql, args) => {
80-
logSql(sql, args);
80+
onSqlCommand(sql, args);
8181
return await cmd(sql, args);
8282
}
8383
: cmd,

test/unit/persisters/sqlite.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ type SqliteVariant<Database> = [
1717
store: Store,
1818
db: Database,
1919
storeTableOrConfig?: string | DatabasePersisterConfig,
20-
logSql?: (sql: string, args?: any[]) => void,
20+
onSqlCommand?: (sql: string, args?: any[]) => void,
2121
onIgnoredError?: (error: any) => void,
2222
) => Persister,
2323
cmd: (
@@ -37,14 +37,14 @@ export const VARIANTS: {[name: string]: SqliteVariant<any>} = {
3737
store: Store,
3838
db: Database,
3939
storeTableOrConfig?: string | DatabasePersisterConfig,
40-
logSql?: (sql: string, args?: any[]) => void,
40+
onSqlCommand?: (sql: string, args?: any[]) => void,
4141
onIgnoredError?: (error: any) => void,
4242
) =>
4343
(createSqlite3Persister as any)(
4444
store,
4545
db,
4646
storeTableOrConfig,
47-
logSql,
47+
onSqlCommand,
4848
onIgnoredError,
4949
),
5050
(
@@ -72,15 +72,15 @@ export const VARIANTS: {[name: string]: SqliteVariant<any>} = {
7272
store: Store,
7373
[sqlite3, db]: SqliteWasmDb,
7474
storeTableOrConfig?: string | DatabasePersisterConfig,
75-
logSql?: (sql: string, args?: any[]) => void,
75+
onSqlCommand?: (sql: string, args?: any[]) => void,
7676
onIgnoredError?: (error: any) => void,
7777
) =>
7878
(createSqliteWasmPersister as any)(
7979
store,
8080
sqlite3,
8181
db,
8282
storeTableOrConfig,
83-
logSql,
83+
onSqlCommand,
8484
onIgnoredError,
8585
),
8686
async ([_, db]: SqliteWasmDb, sql: string, args: any[] = []) =>
@@ -96,14 +96,14 @@ export const VARIANTS: {[name: string]: SqliteVariant<any>} = {
9696
store: Store,
9797
db: DB,
9898
storeTableOrConfig?: string | DatabasePersisterConfig,
99-
logSql?: (sql: string, args?: any[]) => void,
99+
onSqlCommand?: (sql: string, args?: any[]) => void,
100100
onIgnoredError?: (error: any) => void,
101101
) =>
102102
(createCrSqliteWasmPersister as any)(
103103
store,
104104
db,
105105
storeTableOrConfig,
106-
logSql,
106+
onSqlCommand,
107107
onIgnoredError,
108108
),
109109
async (db: DB, sql: string, args: any[] = []) => await db.execO(sql, args),

0 commit comments

Comments
 (0)