Skip to content

Commit

Permalink
Full text
Browse files Browse the repository at this point in the history
  • Loading branch information
drodrigues4 committed Jul 26, 2024
1 parent d13c2a3 commit e201257
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions drizzle-orm/src/singlestore-core/indexes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,59 @@ export function index(name: string): IndexBuilderOn {
export function uniqueIndex(name: string): IndexBuilderOn {
return new IndexBuilderOn(name, true);
}

interface FullTextIndexConfig {
name: string;

columns: IndexColumn[];

version?: number;
}

export class FullTextIndexBuilderOn {
static readonly [entityKind]: string = 'SingleStoreFullTextIndexBuilderOn';

constructor(private config: FullTextIndexConfig) {}

on(...columns: [IndexColumn, ...IndexColumn[]]): FullTextIndexBuilder {
return new FullTextIndexBuilder({
...this.config,
columns: columns,
});
}
}

export interface FullTextIndexBuilder extends AnyIndexBuilder {}

export class FullTextIndexBuilder implements AnyIndexBuilder {
static readonly [entityKind]: string = 'SingleStoreFullTextIndexBuilder';

/** @internal */
config: FullTextIndexConfig;

constructor(config: FullTextIndexConfig) {
this.config = config;
}

/** @internal */
build(table: SingleStoreTable): FullTextIndex {
return new FullTextIndex(this.config, table);
}
}

export class FullTextIndex {
static readonly [entityKind]: string = 'SingleStoreFullTextIndex';

readonly config: FullTextIndexConfig & { table: SingleStoreTable };

constructor(config: FullTextIndexConfig, table: SingleStoreTable) {
this.config = { ...config, table };
}
}

export function fulltext(name: string, config: FullTextIndexConfig): FullTextIndexBuilderOn {
return new FullTextIndexBuilderOn({
...config,
name: name,
});
}

0 comments on commit e201257

Please sign in to comment.