Skip to content

Commit

Permalink
simplify vector class
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchwadair committed Jan 6, 2025
1 parent 54f4fe6 commit cb41edf
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions drizzle-orm/src/singlestore-core/columns/vector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,20 @@ export class SingleStoreVectorBuilder<T extends ColumnBuilderBaseConfig<'array',
override build<TTableName extends string>(
table: AnySingleStoreTable<{ name: TTableName }>,
): SingleStoreVector<MakeColumnConfig<T, TTableName>> {
return new SingleStoreVector(table, this.config as ColumnBuilderRuntimeConfig<any, any>);
return new SingleStoreVector<MakeColumnConfig<T, TTableName>>(
table,
this.config as ColumnBuilderRuntimeConfig<any, any>,
);
}
}

export class SingleStoreVector<T extends ColumnBaseConfig<'array', 'SingleStoreVector'>> extends SingleStoreColumn<T> {
export class SingleStoreVector<T extends ColumnBaseConfig<'array', 'SingleStoreVector'>>
extends SingleStoreColumn<T, SingleStoreVectorConfig>
{
static override readonly [entityKind]: string = 'SingleStoreVector';

readonly dimensions: number;
readonly elementType: ElementType | undefined;

constructor(table: AnySingleStoreTable<{ name: T['tableName'] }>, config: SingleStoreVectorBuilder<T>['config']) {
super(table, config);
this.dimensions = config.dimensions;
this.elementType = config.elementType;
}
dimensions: number = this.config.dimensions;
elementType: ElementType | undefined = this.config.elementType;

getSQLType(): string {
return `vector(${this.dimensions}, ${this.elementType || 'F32'})`;
Expand Down

0 comments on commit cb41edf

Please sign in to comment.