Skip to content

Commit

Permalink
fix lint issues and add lint:fix command
Browse files Browse the repository at this point in the history
  • Loading branch information
Rodriguespn committed Jul 28, 2024
1 parent d20e3ca commit ba24167
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 15 deletions.
2 changes: 1 addition & 1 deletion 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 '../table';
import { SingleStoreColumn, SingleStoreColumnBuilder } from './common.ts';

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

Expand Down
2 changes: 1 addition & 1 deletion drizzle-orm/src/singlestore-core/columns/geography.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnCon
import { entityKind } from '~/entity.ts';
import { DrizzleError } from '~/errors.ts';
import type { AnySingleStoreTable } from '~/singlestore-core/table';
import type { SQL} from '~/sql/sql.ts';
import type { SQL } from '~/sql/sql.ts';
import { sql } from '~/sql/sql.ts';
import { SingleStoreColumn, SingleStoreColumnBuilder } from './common.ts';

Expand Down
20 changes: 13 additions & 7 deletions drizzle-orm/src/singlestore-core/dialect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@ import { ViewBaseConfig } from '~/view-common.ts';
import { SingleStoreColumn } from './columns/common.ts';
import type { SingleStoreAttachConfig } from './query-builders/attach.ts';
import type { SingleStoreBranchConfig } from './query-builders/branch.ts';
import type { SingleStoreCreateMilestoneConfig } from './query-builders/createMilestone.ts';
import type { SingleStoreDeleteConfig } from './query-builders/delete.ts';
import type { SingleStoreDetachConfig } from './query-builders/detach.ts';
import type { SingleStoreDropMilestoneConfig } from './query-builders/dropMilestone.ts';
import type { SingleStoreInsertConfig } from './query-builders/insert.ts';
import type { SingleStoreOptimizeTableConfig } from './query-builders/optimizeTable.ts';
import type {
SelectedFieldsOrdered,
SingleStoreSelectConfig,
Expand All @@ -37,9 +40,6 @@ import type { SingleStoreUpdateConfig } from './query-builders/update.ts';
import type { SingleStoreSession } from './session.ts';
import { SingleStoreTable } from './table.ts';
import { SingleStoreViewBase } from './view-base.ts';
import type { SingleStoreCreateMilestoneConfig } from './query-builders/createMilestone.ts';
import type { SingleStoreDropMilestoneConfig } from './query-builders/dropMilestone.ts';
import type { SingleStoreOptimizeTableConfig } from './query-builders/optimizeTable.ts';

export class SingleStoreDialect {
static readonly [entityKind]: string = 'SingleStoreDialect';
Expand Down 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 Expand Up @@ -722,7 +726,9 @@ export class SingleStoreDialect {
joinOn,
nestedQueryRelation: relation,
});
const field = sql`coalesce(${sql.identifier(relationTableAlias)}.${sql.identifier('data')}, "[]")`.as(selectedRelationTsKey);
const field = sql`coalesce(${sql.identifier(relationTableAlias)}.${sql.identifier('data')}, "[]")`.as(
selectedRelationTsKey,
);
joins.push({
on: sql`true`,
table: new Subquery(builtRelation.sql as SQL, {}, relationTableAlias),
Expand Down
2 changes: 1 addition & 1 deletion drizzle-orm/src/singlestore-core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export * from './primary-keys.ts';
export * from './query-builders/index.ts';
export * from './schema.ts';
export * from './session.ts';
export * from './sql/index.ts'
export * from './sql/index.ts';
export * from './subquery.ts';
export * from './table.ts';
export * from './unique-constraint.ts';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { sql, type SQL } from "~/sql/sql.ts";
import { bindIfParam } from "~/sql/expressions/conditions.ts";
import type { Table } from "~/table";
import { bindIfParam } from '~/sql/expressions/conditions.ts';
import { type SQL, sql } from '~/sql/sql.ts';
import type { Table } from '~/table';

/**
* Test that two values match.
Expand All @@ -16,7 +16,7 @@ import type { Table } from "~/table";
* @see isNull for a way to test equality to NULL.
*/
export function match<
TTable extends Table
TTable extends Table,
>(left: TTable, right: unknown): SQL {
return sql`MATCH (TABLE ${left}) AGAINST (${bindIfParam(right, left)})`;
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"test": "turbo run test --color",
"t": "pnpm test",
"test:types": "turbo run test:types --color",
"lint": "concurrently -n eslint,dprint \"eslint --ext ts .\" \"dprint check --list-different\""
"lint": "concurrently -n eslint,dprint \"eslint --ext ts .\" \"dprint check --list-different\"",
"lint:fix": "npx dprint fmt"
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.15.3",
Expand Down

0 comments on commit ba24167

Please sign in to comment.