SqliteGraphRepository<T, U, EF>
Defined in: rxdb-plugin-graph/src/sqlite/SqliteGraphRepository.ts:37
SQLite 图实体仓库 实现基于 SQLite 递归 CTE 的图查询
Extends
Type Parameters
| Type Parameter | Default type |
|---|---|
T extends EntityBaseType | EntityBaseType |
U extends EdgeFilterOptions | EdgeFilterOptionsFull |
EF | GraphEdgeInfoType<U> |
Implements
IGraphRepository<T,U,EF>
Constructors
Constructor
new SqliteGraphRepository<T, U, EF>(adapter, EntityType): SqliteGraphRepository<T, U, EF>;
Defined in: rxdb-plugin-graph/src/sqlite/SqliteGraphRepository.ts:49
Parameters
| Parameter | Type |
|---|---|
adapter | RxDBAdapterSqliteBase |
EntityType | EntityType |
Returns
SqliteGraphRepository<T, U, EF>
Overrides
Properties
adapter
protected adapter: RxDBAdapterSqliteBase;
Defined in: rxdb-adapter-sqlite-core/dist/repository/SqliteRepositoryBase.d.ts:8
Inherited from
EntityType
readonly EntityType: T;
Defined in: rxdb/dist/repository/RepositoryBase.d.ts:9
Inherited from
metadata
readonly metadata: EntityMetadata;
Defined in: rxdb-adapter-sqlite-core/dist/repository/SqliteRepositoryBase.d.ts:9
Inherited from
rxdb
protected readonly rxdb: RxDB;
Defined in: rxdb/dist/repository/RepositoryBase.d.ts:8
Inherited from
_STATIC_METHODS
protected static _STATIC_METHODS: string[];
Defined in: rxdb/dist/repository/RepositoryBase.d.ts:10
Inherited from
SqliteRepository._STATIC_METHODS
Accessors
staticMethods
Get Signature
get static staticMethods(): string[];
Defined in: rxdb/dist/repository/RepositoryBase.d.ts:11
Returns
string[]
Inherited from
SqliteRepository.staticMethods
Methods
addEdge()
addEdge(
from,
to,
weight?,
properties?): Promise<void>;
Defined in: rxdb-plugin-graph/src/sqlite/SqliteGraphRepository.ts:229
添加边
Parameters
| Parameter | Type |
|---|---|
from | InstanceType<T> |
to | InstanceType<T> |
weight? | number |
properties? | GraphEdgeProperties<U> |
Returns
Promise<void>
Remarks
无向图会同时写入 A->B 与 B->A 两条记录,两次写入在同一事务中执行; 自环边(from === to)只写入一条记录
Implementation of
addQueryCache()
addQueryCache(sqliteSuccessResult, forcedUpdate?): Promise<InstanceType<T>[]>;
Defined in: rxdb-adapter-sqlite-core/dist/repository/SqliteRepositoryBase.d.ts:17
添加缓存
Parameters
| Parameter | Type | Description |
|---|---|---|
sqliteSuccessResult | SqliteSuccessResult | - |
forcedUpdate? | boolean | 强制刷新,在数据有的情况下也会更新数据,在修改数据的情况下需要 |
Returns
Promise<InstanceType<T>[]>
Inherited from
SqliteRepository.addQueryCache
count()
count(options): Promise<number>;
Defined in: rxdb-adapter-sqlite-core/dist/repository/SqliteRepository.d.ts:10
查询实体数量
Parameters
| Parameter | Type | Description |
|---|---|---|
options | EntityStaticType<T, "countOptions"> | 查询选项 |
Returns
Promise<number>
Implementation of
Inherited from
countNeighbors()
countNeighbors(options): Promise<number>;
Defined in: rxdb-plugin-graph/src/sqlite/SqliteGraphRepository.ts:125
查询邻居节点数量
Parameters
| Parameter | Type |
|---|---|
options | FindNeighborsOptions<T, GraphWhere<T>, U> |
Returns
Promise<number>
Implementation of
IGraphRepository.countNeighbors
create()
create(entity): Promise<InstanceType<T>>;
Defined in: rxdb-adapter-sqlite-core/dist/repository/SqliteRepository.d.ts:11
创建实体
Parameters
| Parameter | Type |
|---|---|
entity | InstanceType<T> |
Returns
Promise<InstanceType<T>>
Implementation of
Inherited from
createEntityRef()
createEntityRef(data): any;
Defined in: rxdb/dist/repository/RepositoryBase.d.ts:17
获取实体实例
Parameters
| Parameter | Type | Description |
|---|---|---|
data | EntityUpdateData<T> | 实体数据 |
Returns
any
Inherited from
SqliteRepository.createEntityRef
find()
find(options): Promise<InstanceType<T>[]>;
Defined in: rxdb-adapter-sqlite-core/dist/repository/SqliteRepository.d.ts:9
查询多个实体
Parameters
| Parameter | Type | Description |
|---|---|---|
options | EntityStaticType<T, "findOptions"> | 查询选项 |
Returns
Promise<InstanceType<T>[]>
Implementation of
Inherited from
findByRowIds()
findByRowIds(rowIds): Promise<InstanceType<T>[]>;
Defined in: rxdb-adapter-sqlite-core/dist/repository/SqliteRepositoryBase.d.ts:11
Parameters
| Parameter | Type |
|---|---|
rowIds | bigint[] |
Returns
Promise<InstanceType<T>[]>
Inherited from
findNeighbors()
findNeighbors(options): Promise<NeighborResult<T, EF>[]>;
Defined in: rxdb-plugin-graph/src/sqlite/SqliteGraphRepository.ts:56
查询邻居节点
Parameters
| Parameter | Type |
|---|---|
options | FindNeighborsOptions<T, GraphWhere<T>, U> |
Returns
Promise<NeighborResult<T, EF>[]>
Implementation of
IGraphRepository.findNeighbors
findOne()
findOne(options): Promise<InstanceType<T> | undefined>;
Defined in: rxdb-adapter-sqlite-core/dist/repository/SqliteRepository.d.ts:8
Parameters
| Parameter | Type |
|---|---|
options | EntityStaticType<T, "findOneOptions"> |
Returns
Promise<InstanceType<T> | undefined>
Inherited from
findPaths()
findPaths(options): Promise<GraphPath<T>[]>;
Defined in: rxdb-plugin-graph/src/sqlite/SqliteGraphRepository.ts:140
查询两个节点之间的所有路径
Parameters
| Parameter | Type |
|---|---|
options | FindPathsOptions<T, GraphWhere<T>, U> |
Returns
Promise<GraphPath<T>[]>
Implementation of
get()
get(id): Promise<InstanceType<T>>;
Defined in: rxdb-adapter-sqlite-core/dist/repository/SqliteRepository.d.ts:7
Parameters
| Parameter | Type |
|---|---|
id | EntityStaticType<T, "idType"> |
Returns
Promise<InstanceType<T>>
Inherited from
getEntityRef()
getEntityRef(id): InstanceType<T> | undefined;
Defined in: rxdb/dist/repository/RepositoryBase.d.ts:22
获取实体实例
Parameters
| Parameter | Type | Description |
|---|---|---|
id | EntityStaticType<T, "idType"> | 实体的 ID |
Returns
InstanceType<T> | undefined
Inherited from
hasEntityRef()
hasEntityRef(id): boolean;
Defined in: rxdb/dist/repository/RepositoryBase.d.ts:27
获取实体实例
Parameters
| Parameter | Type | Description |
|---|---|---|
id | EntityStaticType<T, "idType"> | 实体的 ID |
Returns
boolean
Inherited from
remove()
remove(entity): Promise<InstanceType<T>>;
Defined in: rxdb-adapter-sqlite-core/dist/repository/SqliteRepository.d.ts:13
删除实体
Parameters
| Parameter | Type |
|---|---|
entity | InstanceType<T> |
Returns
Promise<InstanceType<T>>
Implementation of
Inherited from
removeEdge()
removeEdge(from, to): Promise<void>;
Defined in: rxdb-plugin-graph/src/sqlite/SqliteGraphRepository.ts:254
移除边
Parameters
| Parameter | Type |
|---|---|
from | InstanceType<T> |
to | InstanceType<T> |
Returns
Promise<void>
Remarks
无向图会同时删除 A->B 与 B->A 两条记录,两次删除在同一事务中执行
Implementation of
update()
update(entity, patch): Promise<InstanceType<T>>;
Defined in: rxdb-adapter-sqlite-core/dist/repository/SqliteRepository.d.ts:12
更新实体
Parameters
| Parameter | Type |
|---|---|
entity | InstanceType<T> |
patch | Partial<InstanceType<T>> |
Returns
Promise<InstanceType<T>>
Implementation of
Inherited from
updateEntity()
updateEntity(entity, update): void;
Defined in: rxdb/dist/repository/RepositoryBase.d.ts:31
更新实体
Parameters
| Parameter | Type |
|---|---|
entity | InstanceType<T> |
update | InstanceType<T> |
Returns
void