Skip to content
2 min read · 303 words

Class: VectorSchemaBuilder

Defined in: src/batteries/vector/schema.ts:125

Knex-style schema facade exposing collection DDL (create/drop/rename/has) over a SchemaExecutor. Returned by a vector store's schema() accessor.

Constructors

Constructor

ts
new VectorSchemaBuilder(executor: SchemaExecutor): VectorSchemaBuilder;

Defined in: src/batteries/vector/schema.ts:131

Parameters

ParameterTypeDescription
executorSchemaExecutorThe adapter-backed executor the DDL calls are drained into.

Returns

VectorSchemaBuilder

Methods

createCollection()

ts
createCollection(collection: string, cb: (c: CollectionBuilder) => void): Promise<void>;

Defined in: src/batteries/vector/schema.ts:136

Create a collection, defining it via the cb builder. Errors if it already exists.

Parameters

ParameterType
collectionstring
cb(c: CollectionBuilder) => void

Returns

Promise<void>


createCollectionIfNotExists()

ts
createCollectionIfNotExists(collection: string, cb: (c: CollectionBuilder) => void): Promise<void>;

Defined in: src/batteries/vector/schema.ts:144

Create a collection only if absent; a no-op if it already exists.

Parameters

ParameterType
collectionstring
cb(c: CollectionBuilder) => void

Returns

Promise<void>


dropCollection()

ts
dropCollection(collection: string): Promise<void>;

Defined in: src/batteries/vector/schema.ts:155

Drop a collection. Errors if it does not exist.

Parameters

ParameterType
collectionstring

Returns

Promise<void>


dropCollectionIfExists()

ts
dropCollectionIfExists(collection: string): Promise<void>;

Defined in: src/batteries/vector/schema.ts:160

Drop a collection only if present; a no-op if it does not exist.

Parameters

ParameterType
collectionstring

Returns

Promise<void>


hasCollection()

ts
hasCollection(collection: string): Promise<boolean>;

Defined in: src/batteries/vector/schema.ts:165

Resolve true if the collection exists.

Parameters

ParameterType
collectionstring

Returns

Promise<boolean>


renameCollection()

ts
renameCollection(from: string, to: string): Promise<void>;

Defined in: src/batteries/vector/schema.ts:170

Rename a collection from from to to.

Parameters

ParameterType
fromstring
tostring

Returns

Promise<void>