vectordb / Exports / LocalConnection
类:LocalConnection
连接到LanceDB数据库。
实现
目录
构造函数
属性
访问器
方法
构造函数
构造函数
• new LocalConnection(db, options)
参数
| 名称 | 类型 |
|---|---|
db |
any |
options |
ConnectionOptions |
定义于
属性
_数据库
• Private Readonly _db: any
定义于
_选项
• Private Readonly _options: () => ConnectionOptions
类型声明
▸ (): ConnectionOptions
返回
定义于
访问器
uri
• get uri(): string
返回值
string
的实现
定义于
方法
createTable
▸ createTable\<T>(name, data?, optsOrEmbedding?, opt?): Promise\<Table\<T>>
创建一个新表,可选择用新数据初始化它。
类型参数
| 名称 |
|---|
T |
参数
| 名称 | 类型 |
|---|---|
name |
string | CreateTableOptions\<T> |
data? |
Table\<any> | Record\<string, unknown>[] |
optsOrEmbedding? |
WriteOptions | EmbeddingFunction\<T> |
opt? |
WriteOptions |
返回值
Promise\<Table\<T>>
的实现
定义于
createTableImpl
▸ Private createTableImpl\<T>(«destructured»): Promise\<Table\<T>>
类型参数
| 名称 |
|---|
T |
参数
| 名称 | 类型 |
|---|---|
«destructured» |
Object |
› data? |
Table\<any> | Record\<string, unknown>[] |
› embeddingFunction? |
EmbeddingFunction\<T> |
› name |
string |
› schema? |
Schema\<any> |
› writeOptions? |
WriteOptions |
返回值
Promise\<Table\<T>>
定义于
dropTable
▸ dropTable(name): Promise\<void>
删除现有表。
参数
| 名称 | 类型 | 描述 |
|---|---|---|
name |
string |
The name of the table to drop. |
返回值
Promise\<void>
的实现
定义于
openTable
▸ openTable(name): Promise\<Table\<number[]>>
在数据库中打开一个表。
参数
| 名称 | 类型 | 描述 |
|---|---|---|
name |
string |
The name of the table. |
返回值
Promise\<Table\<number[]>>
的实现
定义于
▸ openTable\<T>(name, embeddings): Promise\<Table\<T>>
在数据库中打开一个表。
类型参数
| 名称 |
|---|
T |
参数
| 名称 | 类型 | 描述 |
|---|---|---|
name |
string |
The name of the table. |
embeddings |
EmbeddingFunction\<T> |
An embedding function to use on this Table |
返回值
Promise\<Table\<T>>
的实现
Connection.openTable
定义于
▸ openTable\<T>(name, embeddings?): Promise\<Table\<T>>
类型参数
| 名称 |
|---|
T |
参数
| 名称 | 类型 |
|---|---|
name |
string |
embeddings? |
EmbeddingFunction\<T> |
返回值
Promise\<Table\<T>>
的实现
Connection.openTable
定义于
表名
▸ tableNames(): Promise\<string[]>
获取数据库中所有表的名称。
返回值
Promise\<string[]>
的实现
定义于
withMiddleware
▸ withMiddleware(middleware): Connection
通过中间件来监控此连接的行为。
中间件将按照它们被添加的顺序依次调用。
目前此功能仅支持远程连接。
参数
| 名称 | 类型 |
|---|---|
middleware |
HttpMiddleware |
返回值
- 这个连接由传入的中间件进行检测