BetterSqlitePlatform
Hierarchy
- AbstractSqlPlatform
- BetterSqlitePlatform
Index
Constructors
Methods
- allowsComparingTuples
- allowsMultiInsert
- allowsUniqueBatchUpdates
- cloneEmbeddable
- convertJsonToDatabaseValue
- convertJsonToJSValue
- convertsJsonAutomatically
- denormalizePrimaryKey
- extractSimpleType
- formatQuery
- generateCustomOrder
- getArrayDeclarationSQL
- getBigIntTypeDeclarationSQL
- getBlobDeclarationSQL
- getBooleanTypeDeclarationSQL
- getConfig
- getCurrentTimestampSQL
- getDateTimeTypeDeclarationSQL
- getDateTypeDeclarationSQL
- getDecimalTypeDeclarationSQL
- getDefaultCharset
- getDefaultDateTimeLength
- getDefaultMappedType
- getDefaultPrimaryName
- getDefaultSchemaName
- getDefaultVersionLength
- getDoubleDeclarationSQL
- getEntityGenerator
- getEnumTypeDeclarationSQL
- getExceptionConverter
- getFloatDeclarationSQL
- getFullTextIndexExpression
- getFullTextWhereClause
- getIndexName
- getIntegerTypeDeclarationSQL
- getJsonDeclarationSQL
- getMappedType
- getMediumIntTypeDeclarationSQL
- getMigrator
- getNamingStrategy
- getRegExpOperator
- getRegExpValue
- getRepositoryClass
- getSchemaGenerator
- getSchemaHelper
- getSearchJsonPropertyKey
- getSearchJsonPropertySQL
- getSerializedPrimaryKeyField
- getSmallIntTypeDeclarationSQL
- getTextTypeDeclarationSQL
- getTimeTypeDeclarationSQL
- getTinyIntTypeDeclarationSQL
- getUuidTypeDeclarationSQL
- getVarcharTypeDeclarationSQL
- indexForeignKeys
- isAllowedTopLevelOperator
- isBigIntProperty
- isNumericColumn
- isRaw
- lookupExtensions
- marshallArray
- normalizePrimaryKey
- processDateProperty
- quoteIdentifier
- quoteValue
- quoteVersionValue
- setConfig
- shouldHaveColumn
- supportsCreatingFullTextIndex
- supportsCustomPrimaryKeyNames
- supportsDownMigrations
- supportsMultipleStatements
- supportsSchemas
- supportsTransactions
- supportsUnsigned
- unmarshallArray
- usesBatchInserts
- usesBatchUpdates
- usesCascadeStatement
- usesDefaultKeyword
- usesDifferentSerializedPrimaryKey
- usesImplicitTransactions
- usesPivotTable
- usesReturningStatement
- validateMetadata
Constructors
constructor
Returns BetterSqlitePlatform
Methods
allowsComparingTuples
Returns boolean
allowsMultiInsert
Returns boolean
allowsUniqueBatchUpdates
Returns boolean
cloneEmbeddable
Type parameters
- T
Parameters
data: T
Returns T
convertJsonToDatabaseValue
Parameters
value: unknown
optionalcontext: TransformContext
Returns unknown
convertJsonToJSValue
Parameters
value: unknown
Returns unknown
convertsJsonAutomatically
Returns boolean
denormalizePrimaryKey
Parameters
data: IPrimaryKeyValue
Returns IPrimaryKeyValue
extractSimpleType
Parameters
type: string
Returns string
formatQuery
Parameters
sql: string
params: readonly any[]
Returns string
generateCustomOrder
Generates a custom order by statement given a set of in order values, eg. ORDER BY (CASE WHEN priority = 'low' THEN 1 WHEN priority = 'medium' THEN 2 ELSE NULL END)
Parameters
escapedColumn: string
values: unknown[]
Returns string
getArrayDeclarationSQL
Returns string
getBigIntTypeDeclarationSQL
Parameters
column: { autoincrement?: boolean; length?: number; unsigned?: boolean }
optionalautoincrement: boolean
optionallength: number
optionalunsigned: boolean
Returns string
getBlobDeclarationSQL
Returns string
getBooleanTypeDeclarationSQL
Returns string
getConfig
Returns Configuration<IDatabaseDriver<Connection>>
getCurrentTimestampSQL
Returns the SQL specific for the platform to get the current timestamp
Parameters
length: number
Returns string
getDateTimeTypeDeclarationSQL
Parameters
column: { length: number }
length: number
Returns string
getDateTypeDeclarationSQL
Parameters
optionallength: number
Returns string
getDecimalTypeDeclarationSQL
Parameters
column: { precision?: number; scale?: number }
optionalprecision: number
optionalscale: number
Returns string
getDefaultCharset
Returns string
getDefaultDateTimeLength
Returns number
getDefaultMappedType
Parameters
type: string
Returns Type<unknown, unknown>
getDefaultPrimaryName
Parameters
tableName: string
columns: string[]
Returns string
getDefaultSchemaName
Returns undefined | string
getDefaultVersionLength
Returns number
getDoubleDeclarationSQL
Returns string
getEntityGenerator
Parameters
em: EntityManager<IDatabaseDriver<Connection>>
Returns any
getEnumTypeDeclarationSQL
Parameters
column: { autoincrement?: boolean; fieldNames: string[]; items?: unknown[]; length?: number; unsigned?: boolean }
optionalautoincrement: boolean
fieldNames: string[]
optionalitems: unknown[]
optionallength: number
optionalunsigned: boolean
Returns string
getExceptionConverter
Returns ExceptionConverter
getFloatDeclarationSQL
Returns string
getFullTextIndexExpression
Parameters
indexName: string
schemaName: undefined | string
tableName: string
columns: SimpleColumnMeta[]
Returns string
getFullTextWhereClause
Parameters
prop: EntityProperty<any>
Returns string
getIndexName
Returns the default name of index for the given columns
Parameters
tableName: string
columns: string[]
type: index | unique | foreign | primary | sequence
Returns string
getIntegerTypeDeclarationSQL
Parameters
column: { autoincrement?: boolean; length?: number; unsigned?: boolean }
optionalautoincrement: boolean
optionallength: number
optionalunsigned: boolean
Returns string
getJsonDeclarationSQL
Returns string
getMappedType
Parameters
type: string
Returns Type<unknown, unknown>
getMediumIntTypeDeclarationSQL
Parameters
column: { autoincrement?: boolean; length?: number; unsigned?: boolean }
optionalautoincrement: boolean
optionallength: number
optionalunsigned: boolean
Returns string
getMigrator
Parameters
em: EntityManager<IDatabaseDriver<Connection>>
Returns any
getNamingStrategy
Returns new () => NamingStrategy
Returns NamingStrategy
getRegExpOperator
Parameters
optionalval: unknown
optionalflags: string
Returns string
getRegExpValue
Parameters
val: RegExp
Returns { $flags?: string; $re: string }
optional$flags?: string
$re: string
getRepositoryClass
Type parameters
- T: object
Returns Constructor<EntityRepository<T>>
getSchemaGenerator
Parameters
driver: IDatabaseDriver<Connection>
optionalem: EntityManager<IDatabaseDriver<Connection>>
Returns SchemaGenerator
getSchemaHelper
Returns undefined | SchemaHelper
getSearchJsonPropertyKey
Parameters
path: string[]
type: string
aliased: boolean
Returns string
getSearchJsonPropertySQL
Parameters
path: string
type: string
aliased: boolean
Returns string
getSerializedPrimaryKeyField
Used when serializing via toObject and toJSON methods, allows to use different PK field name (like
id
instead of_id
)Parameters
field: string
Returns string
getSmallIntTypeDeclarationSQL
Parameters
column: { autoincrement?: boolean; length?: number; unsigned?: boolean }
optionalautoincrement: boolean
optionallength: number
optionalunsigned: boolean
Returns string
getTextTypeDeclarationSQL
Parameters
_column: { length?: number }
optionallength: number
Returns string
getTimeTypeDeclarationSQL
Parameters
optionallength: number
Returns string
getTinyIntTypeDeclarationSQL
Parameters
column: { autoincrement?: boolean; length?: number; unsigned?: boolean }
optionalautoincrement: boolean
optionallength: number
optionalunsigned: boolean
Returns string
getUuidTypeDeclarationSQL
Parameters
column: { length?: number }
optionallength: number
Returns string
getVarcharTypeDeclarationSQL
Parameters
column: { length?: number }
optionallength: number
Returns string
indexForeignKeys
Returns boolean
isAllowedTopLevelOperator
Parameters
operator: string
Returns boolean
isBigIntProperty
Parameters
prop: EntityProperty<any>
Returns boolean
isNumericColumn
Parameters
mappedType: Type<unknown, unknown>
Returns boolean
isRaw
Parameters
value: any
Returns boolean
lookupExtensions
Allows to register extensions of the driver automatically (e.g.
SchemaGenerator
extension in SQL drivers).Parameters
orm: MikroORM<IDatabaseDriver<Connection>>
Returns void
marshallArray
Parameters
values: string[]
Returns string
normalizePrimaryKey
Normalizes primary key wrapper to scalar value (e.g. mongodb's ObjectId to string)
Type parameters
- T: string | number = string | number
Parameters
data: IPrimaryKeyValue | Primary<T>
Returns T
processDateProperty
This is used to narrow the value of Date properties as they will be stored as timestamps in sqlite. We use this method to convert Dates to timestamps when computing the changeset, so we have the right data type in the payload as well as in original entity data. Without that, we would end up with diffs including all Date properties, as we would be comparing Date object with timestamp.
Parameters
value: unknown
Returns string | number | Date
quoteIdentifier
Parameters
id: string
quote: string = '`'
Returns string
quoteValue
Parameters
value: any
Returns string
quoteVersionValue
Parameters
value: number | Date
prop: EntityProperty<any>
Returns string | number | Date
setConfig
Parameters
config: Configuration<IDatabaseDriver<Connection>>
Returns void
shouldHaveColumn
Type parameters
- T
Parameters
prop: EntityProperty<T>
populate: boolean | PopulateOptions<T>[]
includeFormulas: boolean = true
Returns boolean
supportsCreatingFullTextIndex
Returns boolean
supportsCustomPrimaryKeyNames
Returns boolean
supportsDownMigrations
Currently not supported due to how knex does complex sqlite diffing (always based on current schema)
Returns boolean
supportsMultipleStatements
Returns boolean
supportsSchemas
Returns boolean
supportsTransactions
Returns boolean
supportsUnsigned
Returns boolean
unmarshallArray
Parameters
value: string
Returns string[]
usesBatchInserts
Whether or not the driver supports retuning list of created PKs back when multi-inserting
Returns boolean
usesBatchUpdates
Whether or not the driver supports updating many records at once
Returns boolean
usesCascadeStatement
Returns boolean
usesDefaultKeyword
Returns boolean
usesDifferentSerializedPrimaryKey
Returns boolean
usesImplicitTransactions
Returns boolean
usesPivotTable
Returns boolean
usesReturningStatement
Returns boolean
validateMetadata
Parameters
meta: EntityMetadata<any>
Returns void
Converts scalar primary key representation to native driver wrapper (e.g. string to mongodb's ObjectId)