Skip to content

Commit

Permalink
lint/fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchwadair committed Jul 25, 2024
1 parent 021bf75 commit d1dbe61
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 25 deletions.
20 changes: 15 additions & 5 deletions drizzle-orm/src/singlestore-core/columns/blob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnCon
import type { ColumnBaseConfig } from '~/column.ts';
import { entityKind } from '~/entity.ts';
import type { Equal } from '~/utils';
import { SingleStoreColumn, SingleStoreColumnBuilder } from './common.ts';
import type { AnySingleStoreTable } from '../tables/common.ts';
import { SingleStoreColumn, SingleStoreColumnBuilder } from './common.ts';

type BlobMode = 'buffer' | 'json' | 'bigint';

Expand All @@ -30,7 +30,10 @@ export class SingleStoreBigIntBuilder<T extends ColumnBuilderBaseConfig<'bigint'
override build<TTableName extends string>(
table: AnySingleStoreTable<{ name: TTableName }>,
): SingleStoreBigInt<MakeColumnConfig<T, TTableName>> {
return new SingleStoreBigInt<MakeColumnConfig<T, TTableName>>(table, this.config as ColumnBuilderRuntimeConfig<any>);
return new SingleStoreBigInt<MakeColumnConfig<T, TTableName>>(
table,
this.config as ColumnBuilderRuntimeConfig<any>,
);
}
}

Expand Down Expand Up @@ -80,7 +83,9 @@ export class SingleStoreBlobJsonBuilder<T extends ColumnBuilderBaseConfig<'json'
}
}

export class SingleStoreBlobJson<T extends ColumnBaseConfig<'json', 'SingleStoreBlobJson'>> extends SingleStoreColumn<T> {
export class SingleStoreBlobJson<T extends ColumnBaseConfig<'json', 'SingleStoreBlobJson'>>
extends SingleStoreColumn<T>
{
static readonly [entityKind]: string = 'SingleStoreBlobJson';

getSQLType(): string {
Expand Down Expand Up @@ -119,11 +124,16 @@ export class SingleStoreBlobBufferBuilder<T extends ColumnBuilderBaseConfig<'buf
override build<TTableName extends string>(
table: AnySingleStoreTable<{ name: TTableName }>,
): SingleStoreBlobBuffer<MakeColumnConfig<T, TTableName>> {
return new SingleStoreBlobBuffer<MakeColumnConfig<T, TTableName>>(table, this.config as ColumnBuilderRuntimeConfig<any>);
return new SingleStoreBlobBuffer<MakeColumnConfig<T, TTableName>>(
table,
this.config as ColumnBuilderRuntimeConfig<any>,
);
}
}

export class SingleStoreBlobBuffer<T extends ColumnBaseConfig<'buffer', 'SingleStoreBlobBuffer'>> extends SingleStoreColumn<T> {
export class SingleStoreBlobBuffer<T extends ColumnBaseConfig<'buffer', 'SingleStoreBlobBuffer'>>
extends SingleStoreColumn<T>
{
static readonly [entityKind]: string = 'SingleStoreBlobBuffer';

getSQLType(): string {
Expand Down
12 changes: 6 additions & 6 deletions drizzle-orm/src/singlestore-core/columns/date.common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ export abstract class SingleStoreDateColumnBaseBuilder<
static readonly [entityKind]: string = 'SingleStoreDateColumnBuilder';

defaultNow(fsp?: DatetimeFsp | undefined) {
return fsp ?
this.default(sql`(now(${fsp}))`) :
this.default(sql`(now())`);
return fsp
? this.default(sql`(now(${fsp}))`)
: this.default(sql`(now())`);
}

defaultCurrentTimestamp(fsp?: DatetimeFsp | undefined) {
return fsp ?
this.default(sql`(current_timestamp(${fsp}))`) :
this.default(sql`(current_timestamp())`);
return fsp
? this.default(sql`(current_timestamp(${fsp}))`)
: this.default(sql`(current_timestamp())`);
}

// "on update now" also adds an implicit default value to the column - https://dev.mysql.com/doc/refman/8.0/en/timestamp-initialization.html
Expand Down
10 changes: 7 additions & 3 deletions drizzle-orm/src/singlestore-core/dialect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,14 @@ export class SingleStoreDialect {

let warmBlobCacheForColumnSql = undefined;
if (selection) {
const selectionField = selection.length > 0 ?
selection.map((column) => { return { path: [], field: column } })
const selectionField = selection.length > 0
? selection.map((column) => {
return { path: [], field: column };
})
: [{ path: [], field: sql.raw('*') }];
warmBlobCacheForColumnSql = sql` warm blob cache for column ${this.buildSelection(selectionField, { isSingleTable: true })}`;
warmBlobCacheForColumnSql = sql` warm blob cache for column ${
this.buildSelection(selectionField, { isSingleTable: true })
}`;
}

return sql`optimize table ${table}${argSql}${warmBlobCacheForColumnSql}`;
Expand Down
2 changes: 1 addition & 1 deletion drizzle-orm/src/singlestore-core/schema.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { entityKind, is } from '~/entity.ts';
import { singlestoreColumnstoreTableWithSchema } from './tables/columnstore.ts';
import type { SingleStoreTableFn } from './tables/common.ts';
import { type singlestoreView, singlestoreViewWithSchema } from './view.ts';
import { singlestoreColumnstoreTableWithSchema } from './tables/columnstore.ts';

export class SingleStoreSchema<TName extends string = string> {
static readonly [entityKind]: string = 'SingleStoreSchema';
Expand Down
15 changes: 10 additions & 5 deletions drizzle-orm/src/singlestore-core/tables/columnstore.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import { entityKind } from '~/entity.ts';
import type { SingleStoreTableExtraConfig, SingleStoreTableFn, SingleStoreTableWithColumns, TableConfig } from './common.ts';
import { SingleStoreTable, singlestoreTableWithSchema } from './common.ts';
import type { BuildColumns } from '~/column-builder.ts';
import { entityKind } from '~/entity.ts';
import type { SingleStoreColumnBuilderBase } from '../columns/common.ts';
import type {
SingleStoreTableExtraConfig,
SingleStoreTableFn,
SingleStoreTableWithColumns,
TableConfig,
} from './common.ts';
import { SingleStoreTable, singlestoreTableWithSchema } from './common.ts';

export class SingleStoreColumnstoreTable<T extends TableConfig = TableConfig> extends SingleStoreTable<T> {
static readonly [entityKind]: string = 'SingleStoreColumnstoreTable';
Expand Down Expand Up @@ -33,9 +38,9 @@ export function singlestoreColumnstoreTableWithSchema<
dialect: 'singlestore';
}>(name, schema, baseName);

return singlestoreTableWithSchema(rawTable, columns, extraConfig)
return singlestoreTableWithSchema(rawTable, columns, extraConfig);
}

export const singlestoreColumnstoreTable: SingleStoreTableFn = (name, columns, extraConfig) => {
return singlestoreColumnstoreTableWithSchema(name, columns, extraConfig, undefined, name);
};
};
15 changes: 10 additions & 5 deletions drizzle-orm/src/singlestore-core/tables/rowstore.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import { entityKind } from '~/entity.ts';
import type { SingleStoreTableExtraConfig, SingleStoreTableFn, SingleStoreTableWithColumns, TableConfig } from './common.ts';
import { SingleStoreTable, singlestoreTableWithSchema } from './common.ts';
import type { BuildColumns } from '~/column-builder.ts';
import { entityKind } from '~/entity.ts';
import type { SingleStoreColumnBuilderBase } from '../columns/common.ts';
import type {
SingleStoreTableExtraConfig,
SingleStoreTableFn,
SingleStoreTableWithColumns,
TableConfig,
} from './common.ts';
import { SingleStoreTable, singlestoreTableWithSchema } from './common.ts';

export class SingleStoreRowstoreTable<T extends TableConfig = TableConfig> extends SingleStoreTable<T> {
static readonly [entityKind]: string = 'SingleStoreRowstoreTable';
Expand Down Expand Up @@ -33,9 +38,9 @@ export function singlestoreRowstoreTableWithSchema<
dialect: 'singlestore';
}>(name, schema, baseName);

return singlestoreTableWithSchema(rawTable, columns, extraConfig)
return singlestoreTableWithSchema(rawTable, columns, extraConfig);
}

export const singlestoreRowstoreTable: SingleStoreTableFn = (name, columns, extraConfig) => {
return singlestoreRowstoreTableWithSchema(name, columns, extraConfig, undefined, name);
};
};

0 comments on commit d1dbe61

Please sign in to comment.