Skip to content

Enumeration

SQLDataType

Represents a value’s type in SQL.
enum SQLDataType

Overview

In practice it is not generally possible to list all of the data types supported by any given database, nor to define a useful set of types with identical behaviors which are available across all databases, despite the attempted influence of ANSI SQL. As such, this type primarily functions as a front end for customDataType(for:).

Topics

Enumeration Cases

  • SQLDataType.bigint
    Translates to BIGINT, unless overridden by dialect. Almost always an integer with 64-bit range.
  • SQLDataType.blob
    Translates to BLOB, unless overridden by dialect. Represents binary non-textual data (i.e. an arbitrary byte string admitting of no particular format or representation).
  • SQLDataType.custom(_:)
    Translates to the serialization of the given expression, unless overridden by dialect.
  • SQLDataType.int
    Translates to INTEGER, unless overridden by dialect. Usually an integer with at least 32-bit range.
  • SQLDataType.real
    Translates to REAL, unless overridden by dialect. Usually a decimal value with at least 32-bit precision.
  • SQLDataType.smallint
    Translates to SMALLINT, unless overriden by dialect. Usually an integer with at least 16-bit range.
  • SQLDataType.text
    Translates to TEXT, unless overridden by dialect. Represents non-binary textual data (i.e. human-readable text potentially having an explicit character set and collation).

Instance Methods

  • serialize(to:)
    Invoked when a request is made to serialize the expression to raw SQL.

Type Properties

  • timestamp
    Translates to TIMESTAMP, unless overridden by dialect. Represents a type suitable for storing the encoded value of a Date in a form which can be saved to and reloaded from the database without suffering skew caused by time zone calculations.

Type Methods

  • enum(_:)
    Translates to an enumeration including the specified list of cases.
  • type(_:)
    An inadvertently public test utility. Do not use.

Relationships

Conforms To

See Also

Basic Expressions

  • SQLAlias
    Encapsulates SQL’s <expression> [AS] <name> syntax, most often used to declare aliaed names for columns and tables.
  • SQLBetween
    An SQLExpression which constructs SQL of the form <operand> BETWEEN <lowerBound> AND <upperBound>.
  • SQLColumn
    An expression representing an optionally table-qualified column in an SQL table.
  • SQLConstraint
    An expression representing the combination of a constraint name and algorithm for table constraints.
  • SQLDirection
    Describes an ordering direction for a given sorting key.
  • SQLDistinct
    An expression representing the subexpression of an aggregate function call which specifies whether the aggregate groups over all result rows or only distinct rows.
  • SQLForeignKeyAction
    An expression specifying a behavior for a foreign key constraint violation.
  • SQLNestedSubpathExpression
    A “nested subpath” expression is used to descend into the “deeper” structure of a non-scalar value, such as a dictionary, array, or JSON value.
  • SQLQualifiedTable
    An expression representing an optionally second-level-qualified SQL table.
  • SQLQueryString
    An expression consisting of an array of constituent subexpressions generated by custom string interpolations.