mirror of
https://github.com/balzack/databag.git
synced 2025-04-24 10:35:23 +00:00
defining storage modes
This commit is contained in:
parent
d9d3180d88
commit
81d6d91eea
@ -1,5 +1,7 @@
|
||||
import { AccountSession } from './accountSession';
|
||||
import { AdminSession } from './adminSession';
|
||||
import { SqlStore } from './sqlStore';
|
||||
import { WebStore } from './webStore';
|
||||
|
||||
export class DatabagSDK {
|
||||
|
||||
@ -7,15 +9,11 @@ export class DatabagSDK {
|
||||
console.log("databag sdk");
|
||||
}
|
||||
|
||||
public async initSqlStore(path: string): Promise<AccountSession | null> {
|
||||
public async initOfflineStore(store: SqlStore): Promise<AccountSession | null> {
|
||||
return new AccountSession();
|
||||
}
|
||||
|
||||
public async initWebStore(): Promise<AccountSession | null> {
|
||||
return new AccountSession();
|
||||
}
|
||||
|
||||
public async initMemStore(): Promise<AccountSession | null> {
|
||||
public async initOnlineStore(store: WebStore): Promise<AccountSession | null> {
|
||||
return new AccountSession();
|
||||
}
|
||||
|
||||
@ -38,7 +36,7 @@ export class DatabagSDK {
|
||||
return new AdminSession();
|
||||
}
|
||||
|
||||
public async adminLogout(): Promise<void> {
|
||||
public async adminLogout(session: AdminSession): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
|
3
app/sdk/src/sqlStore.ts
Normal file
3
app/sdk/src/sqlStore.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export interface SqlStore {
|
||||
query(stmt: string, params: (string | number)[]): any[];
|
||||
}
|
6
app/sdk/src/webStore.ts
Normal file
6
app/sdk/src/webStore.ts
Normal file
@ -0,0 +1,6 @@
|
||||
export interface WebStore {
|
||||
getValue(key: string): string;
|
||||
setValue(key: string, value: string): void;
|
||||
clearValue(key: string): void;
|
||||
clearAll(): void;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user