Skip to content

Commit

Permalink
feat: remove escape options from data types (#15766)
Browse files Browse the repository at this point in the history
  • Loading branch information
ephys committed Mar 11, 2023
1 parent 26beda5 commit 5c42821
Show file tree
Hide file tree
Showing 50 changed files with 358 additions and 398 deletions.
12 changes: 6 additions & 6 deletions packages/core/src/dialects/abstract/data-types-utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import NodeUtils from 'node:util';
import { BaseError, ValidationErrorItem } from '../../errors/index.js';
import type { Model } from '../../model.js';
import type { DataType, DataTypeClass, DataTypeClassOrInstance, DataTypeInstance, ToSqlOptions } from './data-types.js';
import type { DataType, DataTypeClass, DataTypeClassOrInstance, DataTypeInstance } from './data-types.js';
import { AbstractDataType } from './data-types.js';
import type { AbstractDialect } from './index.js';

Expand Down Expand Up @@ -51,10 +51,10 @@ export function dataTypeClassOrInstanceToInstance(Type: DataTypeClassOrInstance)
}

export function validateDataType(
type: AbstractDataType<any>,
attributeName: string,
modelInstance: Model<any> | null,
value: unknown,
type: AbstractDataType<any>,
attributeName: string = '[unnamed]',
modelInstance: Model<any> | null = null,
): ValidationErrorItem | null {
try {
type.validate(value);
Expand All @@ -77,13 +77,13 @@ export function validateDataType(
}
}

export function attributeTypeToSql(type: AbstractDataType<any> | string, options: ToSqlOptions): string {
export function attributeTypeToSql(type: AbstractDataType<any> | string): string {
if (typeof type === 'string') {
return type;
}

if (type instanceof AbstractDataType) {
return type.toSql(options);
return type.toSql();
}

throw new Error('attributeTypeToSql received a type that is neither a string or an instance of AbstractDataType');
Expand Down

0 comments on commit 5c42821

Please sign in to comment.