1.4.18 • Published 3 years ago
mico-db v1.4.18
mico-db
简易的 Web indexedDB 接口封装, 兼容 localStoage 和 sessionStorage, 内置 mini-mongodb API
Document: https://mico-db.writeflowy.com
API
import { CollectionOptions } from "./collection";
export declare const createMicoDb: (
name?: string
) => {
name: string;
isHaveIndexedDb: boolean;
version: number;
/** remove indexedDb by key */
remove: (key: string) => Promise<any>;
collection: <T>(
key: string,
opt?: Partial<CollectionOptions<T>>
) => {
proxy: import("./collection").ProxyCollection<T>;
index: (
index: number,
sort?:
| {
[key: string]: number;
}
| undefined
) => Promise<T>;
count: () => Promise<number>;
find: (
filter?: Partial<T> | ((val: T) => any) | undefined,
sort?:
| {
[key: string]: number;
}
| undefined
) => Promise<T[]>;
findOne: (
filter?: Partial<T> | ((val: T) => any) | undefined
) => Promise<T>;
deleteMany: (filter?: Partial<T> | undefined) => Promise<T[]>;
deleteOne: (filter?: Partial<T> | undefined) => Promise<T | undefined>;
updateOne: (
filter: Partial<T & import("./collection").BaseColl>,
data: Partial<T & import("./collection").BaseColl>
) => Promise<(T & import("./collection").BaseColl) | undefined>;
updateMany: (
filter: Partial<T & import("./collection").BaseColl>,
data: Partial<T & import("./collection").BaseColl>
) => Promise<T[]>;
insertOne: (data: Partial<T>) => Promise<T[]>;
insertMany: (dataList: Partial<T>[]) => Promise<T[]>;
removeDuplicatie: (key: string) => Promise<T[]>;
set: (dataList: Partial<T>[]) => Promise<void>;
};
localItem: <T_1>(key: string, init: T_1) => import("./item").Item<T_1>;
sessionItem: <T_2>(key: string, init: T_2) => import("./item").Item<T_2>;
get: (key: string) => Promise<any>;
/** set indexedDb by key */
set: (key: string, obj: any) => Promise<any>;
setLocalStorage: (key: string, obj: any) => void;
getLocalStorage: (key: string) => any;
removeLocalStorage: (key: string) => void;
setSessionStorage: (key: string, obj: any) => void;
getSessionStorage: (key: string) => any;
removeSessionStorage: (key: string) => void;
};
declare const micoDb: {
name: string;
isHaveIndexedDb: boolean;
version: number;
/** remove indexedDb by key */
remove: (key: string) => Promise<any>;
collection: <T>(
key: string,
opt?: Partial<CollectionOptions<T>>
) => {
proxy: import("./collection").ProxyCollection<T>;
index: (
index: number,
sort?:
| {
[key: string]: number;
}
| undefined
) => Promise<T>;
count: () => Promise<number>;
find: (
filter?: Partial<T> | ((val: T) => any) | undefined,
sort?:
| {
[key: string]: number;
}
| undefined
) => Promise<T[]>;
findOne: (
filter?: Partial<T> | ((val: T) => any) | undefined
) => Promise<T>;
deleteMany: (filter?: Partial<T> | undefined) => Promise<T[]>;
deleteOne: (filter?: Partial<T> | undefined) => Promise<T | undefined>;
updateOne: (
filter: Partial<T & import("./collection").BaseColl>,
data: Partial<T & import("./collection").BaseColl>
) => Promise<(T & import("./collection").BaseColl) | undefined>;
updateMany: (
filter: Partial<T & import("./collection").BaseColl>,
data: Partial<T & import("./collection").BaseColl>
) => Promise<T[]>;
insertOne: (data: Partial<T>) => Promise<T[]>;
insertMany: (dataList: Partial<T>[]) => Promise<T[]>;
removeDuplicatie: (key: string) => Promise<T[]>;
set: (dataList: Partial<T>[]) => Promise<void>;
};
localItem: <T_1>(key: string, init: T_1) => import("./item").Item<T_1>;
sessionItem: <T_2>(key: string, init: T_2) => import("./item").Item<T_2>;
get: (key: string) => Promise<any>;
/** set indexedDb by key */
set: (key: string, obj: any) => Promise<any>;
setLocalStorage: (key: string, obj: any) => void;
getLocalStorage: (key: string) => any;
removeLocalStorage: (key: string) => void;
setSessionStorage: (key: string, obj: any) => void;
getSessionStorage: (key: string) => any;
removeSessionStorage: (key: string) => void;
};
export default micoDb;
1.4.17
3 years ago
1.4.18
3 years ago
1.4.16
3 years ago
1.4.15
3 years ago
1.4.14
3 years ago
1.4.13
3 years ago
1.4.12
3 years ago
1.4.11
3 years ago
1.4.10
3 years ago
1.4.9
3 years ago
1.4.8
3 years ago
1.4.6
3 years ago
1.4.5
3 years ago
1.4.3
3 years ago
1.4.2
3 years ago
1.4.1
3 years ago
1.4.0
3 years ago
1.3.1
3 years ago
1.4.7
3 years ago
1.3.0
3 years ago
1.2.1
3 years ago
1.2.0
3 years ago
1.1.0
3 years ago
1.0.2
3 years ago
1.0.1
3 years ago
1.0.0
3 years ago
0.0.1
3 years ago