0.0.40 • Published 2 years ago
ngx-indexed-database v0.0.40
Usage
NgxIndexedDatabase module
import { NgxIndexedDatabaseModule } from "ngx-indexed-database";
@NgModule({
...
imports: [ NgxIndexedDatabaseModule, ... ],
...
})
NgxIndexedDatabase service
import { NgxIndexedDatabaseService } from "ngx-indexed-database";
...
export class XYZComponent {
constructor(private _ngxIndexedDBService: NgxIndexedDBService) {}
}
const ngxIndexedDBService = NgxIndexedDBService.getInstance();
Create
import { IndexedDBKeysDataType, IndexedDBStoreSchema, NgxIndexedDatabaseService } from "ngx-indexed-database";
...
const dbName = 'ngx-indexed-database';
const storeName = 'users';
const storeSchema: IndexedDBStoreSchema = {
id: { primary: true, unique: true, datatype: IndexedDBKeysDataType.INTEGER },
user_name: { datatype: IndexedDBKeysDataType.STRING },
email: { datatype: IndexedDBKeysDataType.STRING },
};
this._ngxIndexedDBService.createStore(dbName, storeName, storeSchema);
Delete
import { IndexedDBKeysDataType, IndexedDBStoreSchema, NgxIndexedDatabaseService } from "ngx-indexed-database";
...
const dbName = 'ngx-indexed-database';
const storeName = 'users';
this._ngxIndexedDBService.deleteStore(dbName, storeName);
NgxIndexedDatabaseStoreOperations service
import { NgxIndexedDatabaseStoreOperationsService } from "ngx-indexed-database";
...
export class XYZComponent {
constructor(private _ngxIndexedDatabaseStoreOperationsService: NgxIndexedDatabaseStoreOperationsService) {}
}
upsert
const data = { id: 1, user_name: 'test123', email: 'test@test.com' };
this._ngxIndexedDatabaseStoreOperationsService.upsert(dbName, storeName, data);
delete
this._ngxIndexedDatabaseStoreOperationsService.delete(dbName, storeName, 1);
deleteBy
this._ngxIndexedDatabaseStoreOperationsService.deleteBy(dbName, storeName, "user_name", "test123");
clear
this._ngxIndexedDatabaseStoreOperationsService.clear(dbName, storeName);
find
this._ngxIndexedDatabaseStoreOperationsService.find(dbName, storeName, 1);
findBy
this._ngxIndexedDatabaseStoreOperationsService.findBy(dbName, storeName, "user_name", "test123");
findMany
this._ngxIndexedDatabaseStoreOperationsService.findMany(dbName, storeName, [1, 2, 3]);
findManyBy
this._ngxIndexedDatabaseStoreOperationsService.findManyBy(dbName, storeName, 'user_name', ['test123', 'test456']);
fetchAll
this._ngxIndexedDatabaseStoreOperationsService.fetchAll(dbName, storeName);
resetStores
this._ngxIndexedDatabaseStoreOperationsService.resetStores(dbName);
this._ngxIndexedDatabaseStoreOperationsService.resetStores(dbName, {
exclude: ['ABC']
});
this._ngxIndexedDatabaseStoreOperationsService.resetStores(dbName, {
only: ['DEF']
});
Enum
export enum IndexedDBKeysDataType {
STRING,
INTEGER,
OBJECT,
ARRAY,
BOOLEAN,
ANY
}
Interfaces
export interface IndexedDBStoreSchema {
[key: string]: {
primary?: boolean;
unique?: boolean;
datatype: IndexedDBKeysDataType
}
}
Author
0.0.40
2 years ago
0.0.37
2 years ago
0.0.38
2 years ago
0.0.39
2 years ago
0.0.36
2 years ago
0.0.35
2 years ago
0.0.34
2 years ago
0.0.33
2 years ago
0.0.32
2 years ago
0.0.31
2 years ago
0.0.30
2 years ago
0.0.29
2 years ago
0.0.28
2 years ago
0.0.27
2 years ago
0.0.26
2 years ago
0.0.25
2 years ago
0.0.24
2 years ago
0.0.23
2 years ago
0.0.22
2 years ago
0.0.21
2 years ago
0.0.20
2 years ago
0.0.19
2 years ago
0.0.18
2 years ago
0.0.17
2 years ago
0.0.16
2 years ago
0.0.15
2 years ago
0.0.14
2 years ago
0.0.13
2 years ago
0.0.12
2 years ago
0.0.11
2 years ago
0.0.10
2 years ago
0.0.9
2 years ago
0.0.8
2 years ago
0.0.7
2 years ago
0.0.6
2 years ago
0.0.5
2 years ago
0.0.4
2 years ago
0.0.3
2 years ago
0.0.2
2 years ago