beam-sqlite-0.5.1.2: Beam driver for SQLite
Safe Haskell None
Language Haskell2010

Database.Beam.Sqlite.Syntax

Description

SQLite implementations of the Beam SQL syntax classes

The SQLite command syntax is implemented by SQLiteCommandSyntax .

Synopsis

SQLite syntaxes

data SqliteSyntax Source #

The syntax for SQLite is stored as a Builder along with a list of data that hasn't been serialized yet.

The first argument is a function that receives a builder for SQLData and returns the concrete syntax to embed into the query. For queries sent to the backend, this is simply a function that returns "?" . Thus, the syntax sent to the backend includes proper placeholders. The list of data is sent to the SQLite library for proper escaping.

When the syntax is being serialized for display (for use in beam migrate for example), the data builder attempts to properly format and escape the data. This returns syntax suitable for inclusion in scripts. In this case, the value list is ignored.

data SqliteCommandSyntax Source #

A SQLite command. INSERT is special cased to handle AUTO INCREMENT columns. The fromSqliteCommand function will take an SqliteCommandSyntax and convert it into the correct SqliteSyntax .

Instances

Instances details
IsSql92Syntax SqliteCommandSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

IsSql92DdlCommandSyntax SqliteCommandSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

type Sql92DeleteSyntax SqliteCommandSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

type Sql92UpdateSyntax SqliteCommandSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

type Sql92InsertSyntax SqliteCommandSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

type Sql92SelectSyntax SqliteCommandSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

type Sql92DdlCommandDropTableSyntax SqliteCommandSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

type Sql92DdlCommandAlterTableSyntax SqliteCommandSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

type Sql92DdlCommandCreateTableSyntax SqliteCommandSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

data SqliteColumnSchemaSyntax Source #

SQLite syntax for column schemas in CREATE TABLE or ALTER COLUMN ... ADD COLUMN statements

Instances

Instances details
Eq SqliteColumnSchemaSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

Show SqliteColumnSchemaSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

Generic SqliteColumnSchemaSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

Hashable SqliteColumnSchemaSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

Sql92DisplaySyntax SqliteColumnSchemaSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

IsSql92ColumnSchemaSyntax SqliteColumnSchemaSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

type Rep SqliteColumnSchemaSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

type Rep SqliteColumnSchemaSyntax = D1 (' MetaData "SqliteColumnSchemaSyntax" "Database.Beam.Sqlite.Syntax" "beam-sqlite-0.5.1.2-783GyutEHhsKn0SCM3eFg5" ' False ) ( C1 (' MetaCons "SqliteColumnSchemaSyntax" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "fromSqliteColumnSchema") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 SqliteSyntax ) :*: S1 (' MetaSel (' Just "sqliteIsSerialColumn") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Bool )))
type Sql92ColumnSchemaColumnConstraintDefinitionSyntax SqliteColumnSchemaSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

type Sql92ColumnSchemaExpressionSyntax SqliteColumnSchemaSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

type Sql92ColumnSchemaColumnTypeSyntax SqliteColumnSchemaSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

data SqliteExpressionSyntax Source #

Implements beam SQL expression syntaxes

Instances

Instances details
Eq SqliteExpressionSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

Show SqliteExpressionSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

Generic SqliteExpressionSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

Hashable SqliteExpressionSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

IsCustomSqlSyntax SqliteExpressionSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

IsSql99FunctionExpressionSyntax SqliteExpressionSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

IsSql99ConcatExpressionSyntax SqliteExpressionSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

IsSql92ExpressionSyntax SqliteExpressionSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

Methods

valueE :: Sql92ExpressionValueSyntax SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

rowE :: [ SqliteExpressionSyntax ] -> SqliteExpressionSyntax Source #

quantifierListE :: [ SqliteExpressionSyntax ] -> SqliteExpressionSyntax Source #

coalesceE :: [ SqliteExpressionSyntax ] -> SqliteExpressionSyntax Source #

caseE :: [( SqliteExpressionSyntax , SqliteExpressionSyntax )] -> SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

fieldE :: Sql92ExpressionFieldNameSyntax SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

betweenE :: SqliteExpressionSyntax -> SqliteExpressionSyntax -> SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

andE :: SqliteExpressionSyntax -> SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

orE :: SqliteExpressionSyntax -> SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

addE :: SqliteExpressionSyntax -> SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

subE :: SqliteExpressionSyntax -> SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

mulE :: SqliteExpressionSyntax -> SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

divE :: SqliteExpressionSyntax -> SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

likeE :: SqliteExpressionSyntax -> SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

modE :: SqliteExpressionSyntax -> SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

overlapsE :: SqliteExpressionSyntax -> SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

nullIfE :: SqliteExpressionSyntax -> SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

positionE :: SqliteExpressionSyntax -> SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

eqE :: Maybe ( Sql92ExpressionQuantifierSyntax SqliteExpressionSyntax ) -> SqliteExpressionSyntax -> SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

neqE :: Maybe ( Sql92ExpressionQuantifierSyntax SqliteExpressionSyntax ) -> SqliteExpressionSyntax -> SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

ltE :: Maybe ( Sql92ExpressionQuantifierSyntax SqliteExpressionSyntax ) -> SqliteExpressionSyntax -> SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

gtE :: Maybe ( Sql92ExpressionQuantifierSyntax SqliteExpressionSyntax ) -> SqliteExpressionSyntax -> SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

leE :: Maybe ( Sql92ExpressionQuantifierSyntax SqliteExpressionSyntax ) -> SqliteExpressionSyntax -> SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

geE :: Maybe ( Sql92ExpressionQuantifierSyntax SqliteExpressionSyntax ) -> SqliteExpressionSyntax -> SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

eqMaybeE :: SqliteExpressionSyntax -> SqliteExpressionSyntax -> SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

neqMaybeE :: SqliteExpressionSyntax -> SqliteExpressionSyntax -> SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

castE :: SqliteExpressionSyntax -> Sql92ExpressionCastTargetSyntax SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

notE :: SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

negateE :: SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

isNullE :: SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

isNotNullE :: SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

isTrueE :: SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

isNotTrueE :: SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

isFalseE :: SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

isNotFalseE :: SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

isUnknownE :: SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

isNotUnknownE :: SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

charLengthE :: SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

octetLengthE :: SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

bitLengthE :: SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

lowerE :: SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

upperE :: SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

trimE :: SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

absE :: SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

extractE :: Sql92ExpressionExtractFieldSyntax SqliteExpressionSyntax -> SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

existsE :: Sql92ExpressionSelectSyntax SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

uniqueE :: Sql92ExpressionSelectSyntax SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

subqueryE :: Sql92ExpressionSelectSyntax SqliteExpressionSyntax -> SqliteExpressionSyntax Source #

currentTimestampE :: SqliteExpressionSyntax Source #

defaultE :: SqliteExpressionSyntax Source #

inE :: SqliteExpressionSyntax -> [ SqliteExpressionSyntax ] -> SqliteExpressionSyntax Source #

IsSql92AggregationExpressionSyntax SqliteExpressionSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

IsString ( CustomSqlSyntax SqliteExpressionSyntax ) Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

Semigroup ( CustomSqlSyntax SqliteExpressionSyntax ) Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

Monoid ( CustomSqlSyntax SqliteExpressionSyntax ) Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

type Rep SqliteExpressionSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

type Rep SqliteExpressionSyntax = D1 (' MetaData "SqliteExpressionSyntax" "Database.Beam.Sqlite.Syntax" "beam-sqlite-0.5.1.2-783GyutEHhsKn0SCM3eFg5" ' False ) ( C1 (' MetaCons "SqliteExpressionSyntax" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 SqliteSyntax )) :+: C1 (' MetaCons "SqliteExpressionDefault" ' PrefixI ' False ) ( U1 :: Type -> Type ))
newtype CustomSqlSyntax SqliteExpressionSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

type Sql92ExpressionExtractFieldSyntax SqliteExpressionSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

type Sql92ExpressionCastTargetSyntax SqliteExpressionSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

type Sql92ExpressionFieldNameSyntax SqliteExpressionSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

type Sql92ExpressionSelectSyntax SqliteExpressionSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

type Sql92ExpressionValueSyntax SqliteExpressionSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

type Sql92ExpressionQuantifierSyntax SqliteExpressionSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

type Sql92AggregationSetQuantifierSyntax SqliteExpressionSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

newtype SqliteValueSyntax Source #

SQLite syntax for values that can be embedded in SqliteSyntax

Instances

Instances details
HasSqlValueSyntax SqliteValueSyntax Bool Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

HasSqlValueSyntax SqliteValueSyntax Double Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

HasSqlValueSyntax SqliteValueSyntax Float Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

( TypeError ( PreferExplicitSize Int Int32 ) :: Constraint ) => HasSqlValueSyntax SqliteValueSyntax Int Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

HasSqlValueSyntax SqliteValueSyntax Int8 Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

HasSqlValueSyntax SqliteValueSyntax Int16 Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

HasSqlValueSyntax SqliteValueSyntax Int32 Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

HasSqlValueSyntax SqliteValueSyntax Int64 Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

( TypeError ( PreferExplicitSize Word Word32 ) :: Constraint ) => HasSqlValueSyntax SqliteValueSyntax Word Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

HasSqlValueSyntax SqliteValueSyntax Word8 Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

HasSqlValueSyntax SqliteValueSyntax Word16 Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

HasSqlValueSyntax SqliteValueSyntax Word32 Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

HasSqlValueSyntax SqliteValueSyntax Word64 Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

HasSqlValueSyntax SqliteValueSyntax ByteString Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

HasSqlValueSyntax SqliteValueSyntax Scientific Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

HasSqlValueSyntax SqliteValueSyntax String Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

HasSqlValueSyntax SqliteValueSyntax UTCTime Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

HasSqlValueSyntax SqliteValueSyntax Text Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

HasSqlValueSyntax SqliteValueSyntax Text Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

HasSqlValueSyntax SqliteValueSyntax SqlNull Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

HasSqlValueSyntax SqliteValueSyntax LocalTime Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

HasSqlValueSyntax SqliteValueSyntax Day Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

HasSqlValueSyntax SqliteValueSyntax x => HasSqlValueSyntax SqliteValueSyntax ( Maybe x) Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

SQLite data type syntax

data SqliteDataTypeSyntax Source #

SQLite syntax that implements IsSql92DataTypeSyntax and a good portion of IsSql99DataTypeSyntax , except for array and row types.

Instances

Instances details
Eq SqliteDataTypeSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

Show SqliteDataTypeSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

Generic SqliteDataTypeSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

Hashable SqliteDataTypeSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

IsSql2008BigIntDataTypeSyntax SqliteDataTypeSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

IsSql99DataTypeSyntax SqliteDataTypeSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

Sql92DisplaySyntax SqliteDataTypeSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

IsSql92DataTypeSyntax SqliteDataTypeSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

HasDataTypeCreatedCheck SqliteDataTypeSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

Methods

dataTypeHasBeenCreated :: SqliteDataTypeSyntax -> ( forall preCondition. Typeable preCondition => [preCondition]) -> Bool Source #

Sql92SerializableDataTypeSyntax SqliteDataTypeSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

type Rep SqliteDataTypeSyntax Source #
Instance details

Defined in Database.Beam.Sqlite.Syntax

Building and consuming SqliteSyntax

formatSqliteInsert :: SqliteTableNameSyntax -> [ Text ] -> SqliteInsertValuesSyntax -> SqliteSyntax Source #

Format a SQLite INSERT expression for the given table name, fields, and values.

formatSqliteInsertOnConflict :: SqliteTableNameSyntax -> [ Text ] -> SqliteInsertValuesSyntax -> Maybe SqliteOnConflictSyntax -> SqliteSyntax Source #

Format a SQLite INSERT expression for the given table name, fields, values, and optionally an ON CONFLICT clause.

emitValue :: SQLData -> SqliteSyntax Source #

Emit a properly escaped value into the syntax

This causes a literal ? 3

sqliteEscape :: Text -> Text Source #

A best effort attempt to implement the escaping rules of SQLite. This is never used to escape data sent to the database; only for emitting scripts or displaying syntax to the user.

withPlaceholders :: (( SQLData -> Builder ) -> Builder ) -> Builder Source #

Convert the first argument of SQLiteSyntax to a ByteString Builder , where all the data has been replaced by "?" placeholders.

sqliteRenderSyntaxScript :: SqliteSyntax -> ByteString Source #

Render a SqliteSyntax as a lazy ByteString , for purposes of displaying to a user. Embedded SQLData is directly embedded into the concrete syntax, with a best effort made to escape strings.