Updates package name and version for Hackage release

We will release as `orville-postgresql` version `1.0.0.0`.
This commit is contained in:
David Vollbracht 2023-10-07 09:56:20 -05:00
parent 05e9896df3
commit 18c0992a1c
179 changed files with 1276 additions and 1276 deletions

View File

@ -35,7 +35,7 @@ jobs:
env:
cache-version: build-v2
with:
key: ${{ env.cache-version }}-${{ hashFiles('orville-postgresql-libpq/stack*.yml') }}-${{ hashFiles('orville-postgresql-libpq/package.yaml') }}
key: ${{ env.cache-version }}-${{ hashFiles('orville-postgresql/stack*.yml') }}-${{ hashFiles('orville-postgresql/package.yaml') }}
restore-keys: |
${{ env.cache-version }}-
path: |
@ -44,20 +44,20 @@ jobs:
- name: Build dev environment
run: |
set -e
cd orville-postgresql-libpq
cd orville-postgresql
docker-compose build -q
- name: Run Tests
run: |
set -e
cd orville-postgresql-libpq
cd orville-postgresql
PG_VERSION=${{ matrix.pg-version }}
cp compose.override.github.yml compose.override.yml
docker-compose run \
--rm \
dev \
stack --stack-yaml ${{ matrix.stack-yaml }} test \
--ghc-options=-j --flag orville-postgresql-libpq:ci
--ghc-options=-j --flag orville-postgresql:ci
formatting-check:
name: Formatting Check
@ -71,7 +71,7 @@ jobs:
env:
cache-version: format-v1
with:
key: ${{ env.cache-version }}-${{ hashFiles('orville-postgresql-libpq/stack*.yml') }}-${{ hashFiles('orville-postgresql-libpq/package.yaml') }}
key: ${{ env.cache-version }}-${{ hashFiles('orville-postgresql/stack*.yml') }}-${{ hashFiles('orville-postgresql/package.yaml') }}
restore-keys: |
${{ env.cache-version }}-
path: |
@ -80,14 +80,14 @@ jobs:
- name: Build dev environment
run: |
set -e
cd orville-postgresql-libpq
cd orville-postgresql
docker-compose build -q
- name: Format and Check for Diff
run: |
set -e
cd orville-postgresql-libpq
cd orville-postgresql
cp compose.override.github.yml compose.override.yml
docker-compose run \
--rm \
@ -108,7 +108,7 @@ jobs:
env:
cache-version: format-v1
with:
key: ${{ env.cache-version }}-${{ hashFiles('orville-postgresql-libpq/stack*.yml') }}-${{ hashFiles('orville-postgresql-libpq/package.yaml') }}
key: ${{ env.cache-version }}-${{ hashFiles('orville-postgresql/stack*.yml') }}-${{ hashFiles('orville-postgresql/package.yaml') }}
restore-keys: |
${{ env.cache-version }}-
path: |
@ -117,14 +117,14 @@ jobs:
- name: Build dev environment
run: |
set -e
cd orville-postgresql-libpq
cd orville-postgresql
docker-compose build -q
- name: Format and Check for Diff
run: |
set -e
cd orville-postgresql-libpq
cd orville-postgresql
cp compose.override.github.yml compose.override.yml
docker-compose run \
--rm \

View File

@ -4,8 +4,8 @@ cabal-version: 1.12
--
-- see: https://github.com/sol/hpack
name: orville-postgresql-libpq
version: 0.10.0.1
name: orville-postgresql
version: 1.0.0.0
synopsis: ORM
description: ORM library for PostgreSQL
category: Database
@ -136,7 +136,7 @@ library
Orville.PostgreSQL.PgCatalog.PgIndex
Orville.PostgreSQL.PgCatalog.PgNamespace
Orville.PostgreSQL.PgCatalog.PgSequence
Paths_orville_postgresql_libpq
Paths_orville_postgresql
hs-source-dirs:
src
build-depends:
@ -208,7 +208,7 @@ test-suite spec
Test.TestTable
Test.Transaction
Test.Transaction.Util
Paths_orville_postgresql_libpq
Paths_orville_postgresql
hs-source-dirs:
test
build-depends:
@ -217,7 +217,7 @@ test-suite spec
, bytestring >=0.10 && <0.13
, containers ==0.6.*
, hedgehog >=1.0.5 && <1.5
, orville-postgresql-libpq
, orville-postgresql
, postgresql-libpq >=0.9.4.2 && <0.10
, resource-pool <0.3 || >=0.4 && <0.5
, safe-exceptions >=0.1.7 && <0.2

View File

@ -1,6 +1,6 @@
---
name: orville-postgresql-libpq
version: '0.10.0.1'
name: orville-postgresql
version: '1.0.0.0'
synopsis: ORM
description: ORM library for PostgreSQL
category: Database
@ -154,7 +154,7 @@ tests:
- containers >= 0.6 && < 0.7
- hedgehog >= 1.0.5 && <1.5
- postgresql-libpq >= 0.9.4.2 && <0.10
- orville-postgresql-libpq
- orville-postgresql
- resource-pool <0.3 || (>= 0.4 && <0.5)
- safe-exceptions >=0.1.7 && < 0.2
- text (>= 1.2 && < 1.3) || (>=2.0 && <2.1)

View File

@ -3,5 +3,5 @@
docker-compose run --rm dev \
stack --stack-yaml stack-lts-17.3.yml \
ghci \
orville-postgresql-libpq:lib \
orville-postgresql-libpq:test:spec
orville-postgresql:lib \
orville-postgresql:test:spec

View File

@ -20,7 +20,7 @@ for stack_file in stack*.yml; do
log_file="./test-all-logs/$stack_file.log"
echo "Testing with $stack_file... "
if stack --stack-yaml "$stack_file" test --fast --flag orville-postgresql-libpq:ci >"$log_file" 2>&1; then
if stack --stack-yaml "$stack_file" test --fast --flag orville-postgresql:ci >"$log_file" 2>&1; then
echo "Passed"
else
SOME_TEST_FAILED=1

View File

@ -14,4 +14,4 @@ echo "Starting test loop using $STACK_YAML. Use \`docker-compose run --rm dev ./
# This used to use ghcid, but I was not able to get ghcid to both run the test
# suite *and* compile the sample project to detect errors there. stack test
# --fast is a bit slower than ghcid, but we need to catch all the errors :(
stack --stack-yaml "$STACK_YAML" test --ghc-options=-j --fast --file-watch --flag orville-postgresql-libpq:ci
stack --stack-yaml "$STACK_YAML" test --ghc-options=-j --fast --file-watch --flag orville-postgresql:ci

View File

@ -20,7 +20,7 @@ for a specific area:
Of course, you can always use the table of contents for the package to see
all the exports Orville offers.
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL
( -- * Basic operations on entities in tables

View File

@ -10,7 +10,7 @@ Stability : Stable
Facilities for performing some database migrations automatically.
See 'autoMigrateSchema' as a primary, high level entry point.
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.AutoMigration
( autoMigrateSchema
@ -54,32 +54,32 @@ import qualified Orville.PostgreSQL.Schema as Schema
items from other types (such as 'Orville.TableDefinition') to put them into
a list to be used with 'autoMigrateSchema'.
@since 0.10.0.0
@since 1.0.0.0
-}
data SchemaItem where
-- |
-- Constructs a 'SchemaItem' from a 'Orville.TableDefinition'.
-- @since 0.10.0.0
-- @since 1.0.0.0
SchemaTable ::
Orville.TableDefinition key writeEntity readEntity ->
SchemaItem
-- |
-- Constructs a 'SchemaItem' that will drop the specified table if it is
-- found in the database.
-- @since 0.10.0.0
-- @since 1.0.0.0
SchemaDropTable ::
Orville.TableIdentifier ->
SchemaItem
-- |
-- Constructs a 'SchemaItem' from a 'Orville.SequenceDefinition'.
-- @since 0.10.0.0
-- @since 1.0.0.0
SchemaSequence ::
Orville.SequenceDefinition ->
SchemaItem
-- |
-- Constructs a 'SchemaItem' that will drop the specified table if it is
-- found in the database.
-- @since 0.10.0.0
-- @since 1.0.0.0
SchemaDropSequence ::
Orville.SequenceIdentifier ->
SchemaItem
@ -91,7 +91,7 @@ data SchemaItem where
For example, a 'SchemaItem' constructed via 'schemaTable' gives @Table <table
name>@.
@since 0.10.0.0
@since 1.0.0.0
-}
schemaItemSummary :: SchemaItem -> String
schemaItemSummary item =
@ -116,7 +116,7 @@ possible for indexes being created concurrently. Any such steps are executed
last after the transaction for the rest of the schema changes has been
successfully committed.
@since 0.10.0.0
@since 1.0.0.0
-}
data MigrationPlan = MigrationPlan
{ i_transactionalSteps :: [MigrationStep]
@ -131,7 +131,7 @@ data MigrationPlan = MigrationPlan
within a transaction while the asynchronous steps are done afterward outside
of it.
@since 0.10.0.0
@since 1.0.0.0
-}
migrationPlanSteps :: MigrationPlan -> [MigrationStep]
migrationPlanSteps plan =
@ -155,12 +155,12 @@ mkMigrationPlan steps =
to the desired result. You can use 'generateMigrationPlan' to get a list
of these yourself for inspection and debugging.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype MigrationStep
= MigrationStep RawSql.RawSql
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
)
@ -168,7 +168,7 @@ newtype MigrationStep
This type is used internally by Orville to order the migration steps after
they have been created. It is not exposed outside this module.
@since 0.10.0.0
@since 1.0.0.0
-}
data MigrationStepWithType = MigrationStepWithType
{ migrationStepType :: StepType
@ -204,7 +204,7 @@ isMigrationStepTransactional stepWithType =
The order of the constructors below indicates the order in which steps will
be run.
@since 0.10.0.0
@since 1.0.0.0
-}
data StepType
= DropForeignKeys
@ -216,9 +216,9 @@ data StepType
| AddForeignKeys
| AddIndexesAsynchronously
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
Eq
, -- | @since 0.10.0.0
, -- | @since 1.0.0.0
Ord
)
@ -226,17 +226,17 @@ data StepType
A 'MigrationDataError' will be thrown from the migration functions if data
necessary for migration cannot be found.
@since 0.10.0.0
@since 1.0.0.0
-}
data MigrationDataError
= UnableToDiscoverCurrentSchema String
| PgCatalogInvariantViolated String
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
Show
)
-- | @since 0.10.0.0
-- | @since 1.0.0.0
instance Exception MigrationDataError
{- |
@ -250,7 +250,7 @@ instance Exception MigrationDataError
(potentially on other processes) attempt to modify the schema at the same
time.
@since 0.10.0.0
@since 1.0.0.0
-}
autoMigrateSchema :: Orville.MonadOrville m => [SchemaItem] -> m ()
autoMigrateSchema schemaItems =
@ -271,7 +271,7 @@ autoMigrateSchema schemaItems =
responsible for ensuring that the schema has no changed between the time the
plan is generated and executed yourself.
@since 0.10.0.0
@since 1.0.0.0
-}
generateMigrationPlan :: Orville.MonadOrville m => [SchemaItem] -> m MigrationPlan
generateMigrationPlan =
@ -309,7 +309,7 @@ generateMigrationPlanWithoutLock schemaItems =
could not be, you can drop them and Orville will re-attempt creating them the
next time migration is performed.
@since 0.10.0.0
@since 1.0.0.0
-}
executeMigrationPlan ::
Orville.MonadOrville m =>
@ -417,7 +417,7 @@ calculateMigrationSteps currentNamespace dbDesc schemaItem =
create the table if foreign keys exist to that reference other tables, which
may not have been created yet.
@since 0.10.0.0
@since 1.0.0.0
-}
mkCreateTableSteps ::
PgCatalog.NamespaceName ->
@ -460,7 +460,7 @@ mkCreateTableSteps currentNamespace tableDef =
alterations need to be performed. If there is nothing to do, an empty list
will be returned.
@since 0.10.0.0
@since 1.0.0.0
-}
mkAlterTableSteps ::
PgCatalog.NamespaceName ->
@ -550,7 +550,7 @@ mkAlterTableSteps currentNamespace relationDesc tableDef =
with the same 'StepType' will be performed togethir in a single @ALTER TABLE@
statement.
@since 0.10.0.0
@since 1.0.0.0
-}
mkConstraintSteps ::
Expr.Qualified Expr.TableName ->
@ -576,7 +576,7 @@ mkConstraintSteps tableName actions =
If there are any alter table actions for adding or removing columns, creates a migration
step to perform them. Otherwise returns an empty list.
@since 0.10.0.0
@since 1.0.0.0
-}
mkAlterColumnSteps ::
Expr.Qualified Expr.TableName ->
@ -594,7 +594,7 @@ mkAlterColumnSteps tableName actionExprs =
line with the given 'Orville.FieldDefinition', or none if no change is
required.
@since 0.10.0.0
@since 1.0.0.0
-}
mkAddAlterColumnActions ::
PgCatalog.RelationDescription ->
@ -696,7 +696,7 @@ mkAddAlterColumnActions relationDesc fieldDef =
correspending 'Orville.FieldDefinition'. See 'mkFieldActions' for those
cases.
@since 0.10.0.0
@since 1.0.0.0
-}
mkDropColumnActions ::
Orville.TableDefinition key readEntity writeEntity ->
@ -718,7 +718,7 @@ mkDropColumnActions tableDef attr = do
found to already exist in the database because constraints in the database
always have schema names included with them.
@since 0.10.0.0
@since 1.0.0.0
-}
setDefaultSchemaNameOnConstraintKey ::
PgCatalog.NamespaceName ->
@ -745,7 +745,7 @@ setDefaultSchemaNameOnConstraintKey currentNamespace constraintKey =
Builds 'Expr.AlterTableAction' expressions to create the given table
constraint if it does not exist.
@since 0.10.0.0
@since 1.0.0.0
-}
mkAddConstraintActions ::
PgCatalog.NamespaceName ->
@ -771,7 +771,7 @@ mkAddConstraintActions currentNamespace existingConstraints constraintDef =
Builds 'Expr.AlterTableAction' expressions to drop the given table
constraint if it should not exist.
@since 0.10.0.0
@since 1.0.0.0
-}
mkDropConstraintActions ::
Set.Set Orville.ConstraintMigrationKey ->
@ -810,7 +810,7 @@ mkDropConstraintActions constraintsToKeep constraint =
If the description is for a kind of constraint that Orville does not support,
'Nothing' is returned.
@since 0.10.0.0
@since 1.0.0.0
-}
pgConstraintMigrationKey ::
PgCatalog.ConstraintDescription ->
@ -871,7 +871,7 @@ pgConstraintMigrationKey constraintDesc =
{- |
Builds migration steps to create an index if it does not exist.
@since 0.10.0.0
@since 1.0.0.0
-}
mkAddIndexSteps ::
Set.Set IndexDefinition.IndexMigrationKey ->
@ -895,7 +895,7 @@ mkAddIndexSteps existingIndexes tableName indexDef =
{- |
Builds migration steps to drop an index if it should not exist.
@since 0.10.0.0
@since 1.0.0.0
-}
mkDropIndexSteps ::
Set.Set IndexDefinition.IndexMigrationKey ->
@ -935,7 +935,7 @@ mkDropIndexSteps indexesToKeep systemIndexOids indexDesc =
this index is not automatically created due to the constraint, so we don't
return the index's OID for that case.
@since 0.10.0.0
@since 1.0.0.0
-}
pgConstraintImpliedIndexOid :: PgCatalog.PgConstraint -> Maybe LibPQ.Oid
pgConstraintImpliedIndexOid pgConstraint =
@ -960,7 +960,7 @@ pgConstraintImpliedIndexOid pgConstraint =
If the description includes expressions as members of the index rather than
simple attributes, 'Nothing' is returned.
@since 0.10.0.0
@since 1.0.0.0
-}
pgIndexMigrationKeys ::
PgCatalog.IndexDescription ->

View File

@ -3,7 +3,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.ErrorDetailLevel
( ErrorDetailLevel (ErrorDetailLevel, includeErrorMessage, includeSchemaNames, includeRowIdentifierValues, includeNonIdentifierValues)
@ -27,7 +27,7 @@ where
Information will be redacted from error messages for any of the fields
that are set to @False@.
@since 0.10.0.0
@since 1.0.0.0
-}
data ErrorDetailLevel = ErrorDetailLevel
{ includeErrorMessage :: Bool
@ -36,7 +36,7 @@ data ErrorDetailLevel = ErrorDetailLevel
, includeNonIdentifierValues :: Bool
}
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
Show
)
@ -44,7 +44,7 @@ data ErrorDetailLevel = ErrorDetailLevel
A minimal 'ErrorDetailLevel' where everything all information (including
any situationally-specific error message!) is redacted from error messages.
@since 0.10.0.0
@since 1.0.0.0
-}
minimalErrorDetailLevel :: ErrorDetailLevel
minimalErrorDetailLevel =
@ -61,7 +61,7 @@ minimalErrorDetailLevel =
avoids untentionally leaking non-identifier values from the database by
redacting them.
@since 0.10.0.0
@since 1.0.0.0
-}
defaultErrorDetailLevel :: ErrorDetailLevel
defaultErrorDetailLevel =
@ -78,7 +78,7 @@ defaultErrorDetailLevel =
columns are involved in a decoding failure, including some which you may
not have intended to expose through error message. Use with caution.
@since 0.10.0.0
@since 1.0.0.0
-}
maximalErrorDetailLevel :: ErrorDetailLevel
maximalErrorDetailLevel =
@ -93,7 +93,7 @@ maximalErrorDetailLevel =
Redacts given the error message string if the 'ErrorDetailLevel' indicates
that error messages should be redacted.
@since 0.10.0.0
@since 1.0.0.0
-}
redactErrorMessage :: ErrorDetailLevel -> String -> String
redactErrorMessage detailLevel message =
@ -105,7 +105,7 @@ redactErrorMessage detailLevel message =
Redacts given the schema name string if the 'ErrorDetailLevel' indicates
that schema names should be redacted.
@since 0.10.0.0
@since 1.0.0.0
-}
redactSchemaName :: ErrorDetailLevel -> String -> String
redactSchemaName detailLevel schemaName =
@ -117,7 +117,7 @@ redactSchemaName detailLevel schemaName =
Redacts given the identifier value string if the 'ErrorDetailLevel' indicates
that identifier values should be redacted.
@since 0.10.0.0
@since 1.0.0.0
-}
redactIdentifierValue :: ErrorDetailLevel -> String -> String
redactIdentifierValue detailLevel idValue =
@ -129,7 +129,7 @@ redactIdentifierValue detailLevel idValue =
Redacts given the non-identifier value string if the 'ErrorDetailLevel' indicates
that non-identifier values should be redacted.
@since 0.10.0.0
@since 1.0.0.0
-}
redactNonIdentifierValue :: ErrorDetailLevel -> String -> String
redactNonIdentifierValue detailLevel nonIdValue =

View File

@ -11,7 +11,7 @@ includes a number of lowel-level items not exported by "Orville.PostgreSQL"
that give you more control (and therefore responsibility) over how the SQL is
executed.
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Execution
( -- * High level modules for most common tasks

View File

@ -9,7 +9,7 @@ Funtions and types for working with PostgreSQL cursors. You can use cursors to
execute a query and consume rows from the result set incrementally. Rows that
you do not consume will never be sent from the database to the client.
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Execution.Cursor
( Cursor
@ -61,7 +61,7 @@ import qualified Orville.PostgreSQL.Monad as Monad
See 'withCursor', 'fetch' and 'move' for details on creating and using
'Cursor' values.
@since 0.10.0.0
@since 1.0.0.0
-}
data Cursor readEntity where
Cursor ::
@ -82,7 +82,7 @@ data Cursor readEntity where
unless you need to control the cursor resource acquisition and release
yourself and can do so safely.
@since 0.10.0.0
@since 1.0.0.0
-}
withCursor ::
Monad.MonadOrville m =>
@ -107,7 +107,7 @@ withCursor scrollExpr holdExpr select useCursor =
about the 'Expr.ScrollExpr' and 'Expr.HoldExpr' parameters and how cursor
behave in general.
@since 0.10.0.0
@since 1.0.0.0
-}
declareCursor ::
Monad.MonadOrville m =>
@ -132,7 +132,7 @@ declareCursor scrollExpr holdExpr =
thought we recommend you use 'withCursor' instead to ensure that any
opened cursor are closed in the event of an exception.
@since 0.10.0.0
@since 1.0.0.0
-}
closeCursor ::
Monad.MonadOrville m =>
@ -149,7 +149,7 @@ closeCursor (Cursor _ cursorName) =
@https://www.postgresql.org/docs/current/sql-fetch.html@ for details about
effect of fetch and the meanings of cursor directions to PostgreSQL.
@since 0.10.0.0
@since 1.0.0.0
-}
fetch ::
Monad.MonadOrville m =>
@ -167,7 +167,7 @@ fetch direction (Cursor marshaller cursorName) =
@https://www.postgresql.org/docs/current/sql-fetch.html@ for details about
effect of move and the meanings of cursor directions to PostgreSQL.
@since 0.10.0.0
@since 1.0.0.0
-}
move ::
Monad.MonadOrville m =>
@ -185,7 +185,7 @@ move direction (Cursor _ cursorName) =
current connection, so using POSIX time plus a 32 bit random tag should be
more than sufficient to ensure conflicts are not seen in practice.
@since 0.10.0.0
@since 1.0.0.0
-}
newCursorName :: MonadIO m => m Expr.CursorName
newCursorName =

View File

@ -14,7 +14,7 @@ API than the entity delete functions in
"Orville.PostgreSQL.Execution.EntityOperations", but not as primitive as
"Orville.PostgreSQL.Expr.Delete".
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Execution.Delete
( Delete
@ -39,7 +39,7 @@ import Orville.PostgreSQL.Schema (TableDefinition, mkTableReturningClause, table
'SqlMarshaller' bound to it that, when the delete returns data from the database, will be used to
decode the database result set when it is executed.
@since 0.10.0.0
@since 1.0.0.0
-}
data Delete readEntity returningClause where
Delete ::
@ -52,7 +52,7 @@ data Delete readEntity returningClause where
don't want to extract the query and run it yourself, but this function is
useful to view the query for debugging or query explanation.
@since 0.10.0.0
@since 1.0.0.0
-}
deleteFromDeleteExpr :: Delete readEntity returningClause -> Expr.DeleteExpr
deleteFromDeleteExpr (Delete expr) = expr
@ -62,7 +62,7 @@ deleteFromDeleteExpr (DeleteReturning _ expr) = expr
Excutes the database query for the 'Delete' and returns the number of
rows affected by the query.
@since 0.10.0.0
@since 1.0.0.0
-}
executeDelete ::
Monad.MonadOrville m =>
@ -74,7 +74,7 @@ executeDelete (Delete expr) =
{- | Excutes the database query for the 'Delete' and uses its 'SqlMarshaller' to decode the rows (that
were just deleteed) as returned via a RETURNING clause.
@since 0.10.0.0
@since 1.0.0.0
-}
executeDeleteReturnEntities ::
Monad.MonadOrville m =>
@ -87,7 +87,7 @@ executeDeleteReturnEntities (DeleteReturning marshaller expr) =
Builds a 'Delete' that will delete all of the writeable columns described in the
'TableDefinition' without returning the data as seen by the database.
@since 0.10.0.0
@since 1.0.0.0
-}
deleteFromTable ::
TableDefinition key writeEntity readEntity ->
@ -101,7 +101,7 @@ deleteFromTable =
'TableDefinition' and returning the data as seen by the database. This is useful for getting
database managed columns such as auto-incrementing identifiers and sequences.
@since 0.10.0.0
@since 1.0.0.0
-}
deleteFromTableReturning ::
TableDefinition key writeEntity readEntity ->
@ -138,7 +138,7 @@ deleteTable returningOption tableDef whereCondition =
'Expr.DeleteExpr'. This level of interface does not provide an automatic enforcement of the
expectation, however failure is likely if that is not met.
@since 0.10.0.0
@since 1.0.0.0
-}
rawDeleteExpr :: ReturningOption returningClause -> AnnotatedSqlMarshaller writeEntity readEntity -> Expr.DeleteExpr -> Delete readEntity returningClause
rawDeleteExpr WithReturning marshaller = DeleteReturning marshaller

View File

@ -7,7 +7,7 @@ Entry-level functions for executing based CRUD operations on entity tables.
This are the functions that you will use most often for interacting with
tables.
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Execution.EntityOperations
( insertEntity
@ -54,7 +54,7 @@ import qualified Orville.PostgreSQL.Schema as Schema
{- |
Inserts a entity into the specified table.
@since 0.10.0.0
@since 1.0.0.0
-}
insertEntity ::
Monad.MonadOrville m =>
@ -68,7 +68,7 @@ insertEntity entityTable =
Inserts a entity into the specified table. Returns the number of rows
affected by the query.
@since 0.10.0.0
@since 1.0.0.0
-}
insertEntityAndReturnRowCount ::
Monad.MonadOrville m =>
@ -85,7 +85,7 @@ insertEntityAndReturnRowCount entityTable entity =
You can use this function to obtain any column values filled in by the
database, such as auto-incrementing ids.
@since 0.10.0.0
@since 1.0.0.0
-}
insertAndReturnEntity ::
Monad.MonadOrville m =>
@ -102,7 +102,7 @@ insertAndReturnEntity entityTable entity = do
{- |
Inserts a non-empty list of entities into the specified table.
@since 0.10.0.0
@since 1.0.0.0
-}
insertEntities ::
Monad.MonadOrville m =>
@ -116,7 +116,7 @@ insertEntities tableDef =
Inserts a non-empty list of entities into the specified table. Returns the
number of rows affected by the query.
@since 0.10.0.0
@since 1.0.0.0
-}
insertEntitiesAndReturnRowCount ::
Monad.MonadOrville m =>
@ -133,7 +133,7 @@ insertEntitiesAndReturnRowCount tableDef =
You can use this function to obtain any column values filled in by the
database, such as auto-incrementing ids.
@since 0.10.0.0
@since 1.0.0.0
-}
insertAndReturnEntities ::
Monad.MonadOrville m =>
@ -146,7 +146,7 @@ insertAndReturnEntities tableDef =
{- |
Updates the row with the given key in with the data given by 'writeEntity'.
@since 0.10.0.0
@since 1.0.0.0
-}
updateEntity ::
Monad.MonadOrville m =>
@ -161,7 +161,7 @@ updateEntity tableDef key =
Updates the row with the given key in with the data given by 'writeEntity'.
Returns the number of rows affected by the query.
@since 0.10.0.0
@since 1.0.0.0
-}
updateEntityAndReturnRowCount ::
Monad.MonadOrville m =>
@ -184,7 +184,7 @@ updateEntityAndReturnRowCount tableDef key writeEntity =
You can use this function to obtain any column values computer by the database
during update, including columns with triggers attached to them.
@since 0.10.0.0
@since 1.0.0.0
-}
updateAndReturnEntity ::
Monad.MonadOrville m =>
@ -207,7 +207,7 @@ updateAndReturnEntity tableDef key writeEntity =
given where condition. The easiest way to construct a 'Expr.SetClause' is
via the 'Orville.Postgresql.setField' function (also exported as @.:=@).
@since 0.10.0.0
@since 1.0.0.0
-}
updateFields ::
Monad.MonadOrville m =>
@ -224,7 +224,7 @@ updateFields tableDef setClauses =
via the 'Orville.Postgresql.setField' function (also exported as @.:=@).
Returns the number of rows affected by the query.
@since 0.10.0.0
@since 1.0.0.0
-}
updateFieldsAndReturnRowCount ::
Monad.MonadOrville m =>
@ -240,7 +240,7 @@ updateFieldsAndReturnRowCount tableDef setClauses mbWhereCondition =
Like 'updateFields', but uses a @RETURNING@ clause to return the updated
version of any rows that were affected by the update.
@since 0.10.0.0
@since 1.0.0.0
-}
updateFieldsAndReturnEntities ::
Monad.MonadOrville m =>
@ -255,7 +255,7 @@ updateFieldsAndReturnEntities tableDef setClauses mbWhereCondition =
{- |
Deletes the row with the given key.
@since 0.10.0.0
@since 1.0.0.0
-}
deleteEntity ::
Monad.MonadOrville m =>
@ -269,7 +269,7 @@ deleteEntity entityTable =
Deletes the row with the given key. Returns the number of rows affected
by the query.
@since 0.10.0.0
@since 1.0.0.0
-}
deleteEntityAndReturnRowCount ::
Monad.MonadOrville m =>
@ -290,7 +290,7 @@ deleteEntityAndReturnRowCount entityTable key =
Deletes the row with the given key, returning the row that was deleted.
If no row matches the given key, 'Nothing' is returned.
@since 0.10.0.0
@since 1.0.0.0
-}
deleteAndReturnEntity ::
Monad.MonadOrville m =>
@ -313,7 +313,7 @@ deleteAndReturnEntity entityTable key = do
{- |
Deletes all rows in the given table that match the where condition.
@since 0.10.0.0
@since 1.0.0.0
-}
deleteEntities ::
Monad.MonadOrville m =>
@ -327,7 +327,7 @@ deleteEntities entityTable =
Deletes all rows in the given table that match the where condition. Returns
the number of rows affected by the query.
@since 0.10.0.0
@since 1.0.0.0
-}
deleteEntitiesAndReturnRowCount ::
Monad.MonadOrville m =>
@ -342,7 +342,7 @@ deleteEntitiesAndReturnRowCount entityTable whereCondition =
Deletes all rows in the given table that match the where condition, returning
the rows that were deleted.
@since 0.10.0.0
@since 1.0.0.0
-}
deleteAndReturnEntities ::
Monad.MonadOrville m =>
@ -358,7 +358,7 @@ deleteAndReturnEntities entityTable whereCondition =
'SelectOptions.SelectOptions', which may include where conditions to
match, ordering specifications, etc.
@since 0.10.0.0
@since 1.0.0.0
-}
findEntitiesBy ::
Monad.MonadOrville m =>
@ -375,7 +375,7 @@ findEntitiesBy entityTable selectOptions =
provide an order by clause in the 'SelectOptions.SelectOptions' because the
database will not guarantee ordering.
@since 0.10.0.0
@since 1.0.0.0
-}
findFirstEntityBy ::
Monad.MonadOrville m =>
@ -389,7 +389,7 @@ findFirstEntityBy entityTable selectOptions =
{- |
Finds a single entity by the table's primary key value.
@since 0.10.0.0
@since 1.0.0.0
-}
findEntity ::
Monad.MonadOrville m =>
@ -408,7 +408,7 @@ findEntity entityTable key =
{- |
Finds multiple entities by the table's primary key.
@since 0.10.0.0
@since 1.0.0.0
-}
findEntities ::
Monad.MonadOrville m =>
@ -428,17 +428,17 @@ findEntities entityTable keys =
Thrown by 'updateFields' and 'updateFieldsAndReturnEntities' if the
'Schema.TableDefinition' they are given has no columns to update.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype EmptyUpdateError
= EmptyUpdateError Schema.TableIdentifier
-- | @since 0.10.0.0
-- | @since 1.0.0.0
instance Show EmptyUpdateError where
show (EmptyUpdateError tableId) =
"EmptyUdateError: "
<> Schema.tableIdToString tableId
<> " has no columns to update."
-- | @since 0.10.0.0
-- | @since 1.0.0.0
instance Exception EmptyUpdateError

View File

@ -5,7 +5,7 @@ Stability : Stable
Low-level functions for executing 'RawSql.SqlExpression' values directly.
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Execution.Execute
( executeAndDecode
@ -40,7 +40,7 @@ import qualified Orville.PostgreSQL.Raw.SqlValue as SqlValue
If the query fails or if any row is unable to be decoded by the marshaller,
an exception will be raised.
@since 0.10.0.0
@since 1.0.0.0
-}
executeAndDecode ::
(MonadOrville m, RawSql.SqlExpression sql) =>
@ -65,7 +65,7 @@ executeAndDecode queryType sql marshaller = do
If the query fails an exception will be raised.
@since 0.10.0.0
@since 1.0.0.0
-}
executeAndReturnAffectedRows ::
(MonadOrville m, RawSql.SqlExpression sql) =>
@ -82,7 +82,7 @@ executeAndReturnAffectedRows queryType sql = do
If the query fails an exception will be raised.
@since 0.10.0.0
@since 1.0.0.0
-}
executeVoid ::
(MonadOrville m, RawSql.SqlExpression sql) =>
@ -101,7 +101,7 @@ executeVoid queryType sql = do
If the query fails or if any row is unable to be decoded by the marshaller,
an exception will be raised.
@since 0.10.0.0
@since 1.0.0.0
-}
executeAndDecodeIO ::
RawSql.SqlExpression sql =>
@ -142,7 +142,7 @@ executeAndDecodeIO queryType sql marshaller orvilleState conn = do
If the query fails an exception will be raised.
@since 0.10.0.0
@since 1.0.0.0
-}
executeAndReturnAffectedRowsIO ::
RawSql.SqlExpression sql =>
@ -172,7 +172,7 @@ executeAndReturnAffectedRowsIO queryType sql orvilleState conn = do
If the query fails an exception will be raised.
@since 0.10.0.0
@since 1.0.0.0
-}
executeVoidIO ::
RawSql.SqlExpression sql =>
@ -211,14 +211,14 @@ executeWithCallbacksIO queryType sql orvilleState conn =
if the number of affected rows cannot be successfully read from the LibPQ
command result.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype AffectedRowsDecodingError
= AffectedRowsDecodingError String
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
Show
)
-- | @since 0.10.0.0
-- | @since 1.0.0.0
instance Exception AffectedRowsDecodingError

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Execution.ExecutionResult
( ExecutionResult (..)
@ -27,32 +27,32 @@ import qualified Orville.PostgreSQL.Raw.SqlValue as SqlValue
{- |
A trivial wrapper for `Int` to help keep track of column vs row number
@since 0.10.0.0
@since 1.0.0.0
-}
newtype Column
= Column Int
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
Eq
, -- | @since 0.10.0.0
, -- | @since 1.0.0.0
Ord
, -- | @since 0.10.0.0
, -- | @since 1.0.0.0
Enum
)
{- |
A trivial wrapper for `Int` to help keep track of column vs row number
@since 0.10.0.0
@since 1.0.0.0
-}
newtype Row
= Row Int
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
Eq
, -- | @since 0.10.0.0
, -- | @since 1.0.0.0
Ord
, -- | @since 0.10.0.0
, -- | @since 1.0.0.0
Enum
)
@ -64,7 +64,7 @@ newtype Row
sets and want to test aspects of the decoding that don't require a real
database.
@since 0.10.0.0
@since 1.0.0.0
-}
class ExecutionResult result where
maxRowNumber :: result -> IO (Maybe Row)
@ -72,7 +72,7 @@ class ExecutionResult result where
columnName :: result -> Column -> IO (Maybe BS.ByteString)
getValue :: result -> Row -> Column -> IO SqlValue
-- | @since 0.10.0.0
-- | @since 1.0.0.0
instance ExecutionResult LibPQ.Result where
maxRowNumber result = do
rowCount <- fmap fromEnum (LibPQ.ntuples result)
@ -101,14 +101,14 @@ instance ExecutionResult LibPQ.Result where
can assume a result set has been loaded and just need to test decoding the
results.
@since 0.10.0.0
@since 1.0.0.0
-}
data FakeLibPQResult = FakeLibPQResult
{ fakeLibPQColumns :: Map.Map Column BS.ByteString
, fakeLibPQRows :: Map.Map Row (Map.Map Column SqlValue)
}
-- | @since 0.10.0.0
-- | @since 1.0.0.0
instance ExecutionResult FakeLibPQResult where
maxRowNumber = pure . fakeLibPQMaxRow
maxColumnNumber = pure . fakeLibPQMaxColumn
@ -121,7 +121,7 @@ instance ExecutionResult FakeLibPQResult where
because a row is shorter than the heeader list) are treated as a SQL Null
value.
@since 0.10.0.0
@since 1.0.0.0
-}
mkFakeLibPQResult ::
-- | The column names for the result set

View File

@ -15,7 +15,7 @@ lower-level API than the entity insert functions in
"Orville.PostgreSQL.Execution.EntityOperations", but not as primitive as
"Orville.PostgreSQL.Expr.Insert".
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Execution.Insert
( Insert
@ -42,7 +42,7 @@ import Orville.PostgreSQL.Schema (TableDefinition, mkInsertExpr, tableMarshaller
'SqlMarshaller' bound to it that, when the insert returns data from the database, will be used to
decode the database result set when it is executed.
@since 0.10.0.0
@since 1.0.0.0
-}
data Insert readEntity returningClause where
Insert ::
@ -56,7 +56,7 @@ data Insert readEntity returningClause where
don't want to extract the query and run it yourself, but this function is
useful to view the query for debugging or query explanation.
@since 0.10.0.0
@since 1.0.0.0
-}
insertToInsertExpr :: Insert readEntity returningClause -> Expr.InsertExpr
insertToInsertExpr (Insert _ expr) = expr
@ -66,7 +66,7 @@ insertToInsertExpr (InsertReturning _ expr) = expr
Excutes the database query for the 'Insert' and returns the number of rows
affected by the query.
@since 0.10.0.0
@since 1.0.0.0
-}
executeInsert ::
Monad.MonadOrville m =>
@ -78,7 +78,7 @@ executeInsert (Insert _ expr) =
{- | Excutes the database query for the 'Insert' and uses its 'SqlMarshaller' to decode the rows (that
were just inserted) as returned via a RETURNING clause.
@since 0.10.0.0
@since 1.0.0.0
-}
executeInsertReturnEntities ::
Monad.MonadOrville m =>
@ -91,7 +91,7 @@ executeInsertReturnEntities (InsertReturning marshaller expr) =
Builds an 'Insert' that will insert all of the writeable columns described in the
'TableDefinition' without returning the data as seen by the database.
@since 0.10.0.0
@since 1.0.0.0
-}
insertToTable ::
TableDefinition key writeEntity readEntity ->
@ -105,7 +105,7 @@ insertToTable =
'TableDefinition' and returning the data as seen by the database. This is useful for getting
database managed columns such as auto-incrementing identifiers and sequences.
@since 0.10.0.0
@since 1.0.0.0
-}
insertToTableReturning ::
TableDefinition key writeEntity readEntity ->
@ -135,7 +135,7 @@ insertTable returningOption tableDef entities =
'Expr.InsertExpr'. This level of interface does not provide an automatic enforcement of the
expectation, however failure is likely if that is not met.
@since 0.10.0.0
@since 1.0.0.0
-}
rawInsertExpr :: ReturningOption returningClause -> AnnotatedSqlMarshaller writeEntity readEntity -> Expr.InsertExpr -> Insert readEntity returningClause
rawInsertExpr WithReturning = InsertReturning

View File

@ -3,7 +3,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Execution.QueryType
( QueryType (SelectQuery, InsertQuery, UpdateQuery, DeleteQuery, DDLQuery, CursorQuery, OtherQuery)
@ -16,7 +16,7 @@ where
See 'Orville.PostgreSQL.addSqlExecutionCallback'
@since 0.10.0.0
@since 1.0.0.0
-}
data QueryType
= SelectQuery
@ -27,16 +27,16 @@ data QueryType
| CursorQuery
| OtherQuery
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
Ord
, -- | @since 0.10.0.0
, -- | @since 1.0.0.0
Eq
, -- | @since 0.10.0.0
, -- | @since 1.0.0.0
Enum
, -- | @since 0.10.0.0
, -- | @since 1.0.0.0
Bounded
, -- | @since 0.10.0.0
, -- | @since 1.0.0.0
Show
, -- | @since 0.10.0.0
, -- | @since 1.0.0.0
Read
)

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Execution.ReturningOption
( ReturningOption (..)
@ -16,13 +16,13 @@ where
{- | A tag, used with 'ReturningOption' to indicate a SQL Returning clause.
@since 0.10.0.0
@since 1.0.0.0
-}
data ReturningClause
{- | A tag, used with 'ReturningOption' to indicate no SQL Returning clause.
@since 0.10.0.0
@since 1.0.0.0
-}
data NoReturningClause
@ -30,7 +30,7 @@ data NoReturningClause
Specifies whether or not a @RETURNING@ clause should be included when a
query expression is built. This type is found as a parameter on a number
of the query building functions related to 'TableDefinition'.
@since 0.10.0.0
@since 1.0.0.0
-}
data ReturningOption clause where
WithReturning :: ReturningOption ReturningClause

View File

@ -14,7 +14,7 @@ lower-level API than the entity select functions in
"Orville.PostgreSQL.Execution.EntityOperations", but not as primitive as
"Orville.PostgreSQL.Expr.Query".
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Execution.Select
( Select
@ -40,7 +40,7 @@ import Orville.PostgreSQL.Schema (TableDefinition, tableMarshaller, tableName)
'Select' has a 'SqlMarshaller' bound to it that will be used to decode the
database result set when it is executed.
@since 0.10.0.0
@since 1.0.0.0
-}
data Select readEntity where
Select :: AnnotatedSqlMarshaller writeEntity readEntity -> Expr.QueryExpr -> Select readEntity
@ -50,7 +50,7 @@ data Select readEntity where
don't want to extract the query and run it yourself, but this function is
useful to view the query for debugging or query explanation.
@since 0.10.0.0
@since 1.0.0.0
-}
selectToQueryExpr :: Select readEntity -> Expr.QueryExpr
selectToQueryExpr (Select _ query) = query
@ -59,7 +59,7 @@ selectToQueryExpr (Select _ query) = query
Excutes the database query for the 'Select' and uses its 'SqlMarshaller' to
decode the result set.
@since 0.10.0.0
@since 1.0.0.0
-}
executeSelect :: Monad.MonadOrville m => Select row -> m [row]
executeSelect =
@ -70,7 +70,7 @@ executeSelect =
'Select' it pleases. The marshaller that the function is provided can be use
to decode results from the query.
@since 0.10.0.0
@since 1.0.0.0
-}
useSelect ::
( forall writeEntity.
@ -90,7 +90,7 @@ useSelect f (Select marshaller query) =
being managed with Orville auto migrations, this will match the schema in the
database.
@since 0.10.0.0
@since 1.0.0.0
-}
selectTable ::
TableDefinition key writeEntity readEntity ->
@ -107,7 +107,7 @@ selectTable tableDef =
This function is useful for query a subset of table columns using a custom
marshaller.
@since 0.10.0.0
@since 1.0.0.0
-}
selectMarshalledColumns ::
AnnotatedSqlMarshaller writeEntity readEntity ->
@ -131,7 +131,7 @@ selectMarshalledColumns marshaller qualifiedTableName selectOptions =
can build any query that Orville supports using the expression building
functions, or use @RawSql.fromRawSql@ to build a raw 'Expr.QueryExpr'.
@since 0.10.0.0
@since 1.0.0.0
-}
rawSelectQueryExpr ::
AnnotatedSqlMarshaller writeEntity readEntity ->

View File

@ -3,7 +3,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Execution.SelectOptions
( SelectOptions
@ -35,7 +35,7 @@ import qualified Orville.PostgreSQL.Expr as Expr
Functions are provided to construct 'SelectOptions' for individual options,
which may then be combined via '<>' (also exposed as 'appendSelectOptions').
@since 0.10.0.0
@since 1.0.0.0
-}
data SelectOptions = SelectOptions
{ i_distinct :: First Bool
@ -46,18 +46,18 @@ data SelectOptions = SelectOptions
, i_groupByExpr :: Maybe Expr.GroupByExpr
}
-- | @since 0.10.0.0
-- | @since 1.0.0.0
instance Semigroup SelectOptions where
(<>) = appendSelectOptions
-- | @since 0.10.0.0
-- | @since 1.0.0.0
instance Monoid SelectOptions where
mempty = emptySelectOptions
{- |
A set of empty 'SelectOptions' that will not change how a query is run.
@since 0.10.0.0
@since 1.0.0.0
-}
emptySelectOptions :: SelectOptions
emptySelectOptions =
@ -75,7 +75,7 @@ emptySelectOptions =
possible. For options where this is not possible, (e.g. 'LIMIT'), the one
on the left is preferred.
@since 0.10.0.0
@since 1.0.0.0
-}
appendSelectOptions :: SelectOptions -> SelectOptions -> SelectOptions
appendSelectOptions left right =
@ -99,7 +99,7 @@ unionMaybeWith f mbLeft mbRight =
Builds the 'Expr.SelectClause' that should be used to include the
'distinct's from the 'SelectOptions' on a query.
@since 0.10.0.0
@since 1.0.0.0
-}
selectDistinct :: SelectOptions -> Expr.SelectClause
selectDistinct selectOptions =
@ -112,7 +112,7 @@ selectDistinct selectOptions =
'WhereCondition's from the 'SelectOptions' on a query. This will be 'Nothing'
where no 'WhereCondition's have been specified.
@since 0.10.0.0
@since 1.0.0.0
-}
selectWhereClause :: SelectOptions -> Maybe Expr.WhereClause
selectWhereClause =
@ -121,7 +121,7 @@ selectWhereClause =
{- |
Constructs a 'SelectOptions' with just 'distinct' set to 'True'.
@since 0.10.0.0
@since 1.0.0.0
-}
distinct :: SelectOptions
distinct =
@ -134,7 +134,7 @@ distinct =
'OrderByClause's from the 'SelectOptions' on a query. This will be 'Nothing'
where no 'OrderByClause's have been specified.
@since 0.10.0.0
@since 1.0.0.0
-}
selectOrderByClause :: SelectOptions -> Maybe Expr.OrderByClause
selectOrderByClause =
@ -145,7 +145,7 @@ selectOrderByClause =
'GroupByClause's from the 'SelectOptions' on a query. This will be 'Nothing'
where no 'GroupByClause's have been specified.
@since 0.10.0.0
@since 1.0.0.0
-}
selectGroupByClause :: SelectOptions -> Maybe Expr.GroupByClause
selectGroupByClause =
@ -155,7 +155,7 @@ selectGroupByClause =
Builds a 'Expr.LimitExpr' that will limit the query results to the
number specified in the 'SelectOptions' (if any)
@since 0.10.0.0
@since 1.0.0.0
-}
selectLimitExpr :: SelectOptions -> Maybe Expr.LimitExpr
selectLimitExpr =
@ -165,7 +165,7 @@ selectLimitExpr =
Builds a 'Expr.OffsetExpr' that will limit the query results to the
number specified in the 'SelectOptions' (if any)
@since 0.10.0.0
@since 1.0.0.0
-}
selectOffsetExpr :: SelectOptions -> Maybe Expr.OffsetExpr
selectOffsetExpr =
@ -174,7 +174,7 @@ selectOffsetExpr =
{- |
Constructs a 'SelectOptions' with just the given 'WhereCondition'.
@since 0.10.0.0
@since 1.0.0.0
-}
where_ :: Expr.BooleanExpr -> SelectOptions
where_ condition =
@ -185,7 +185,7 @@ where_ condition =
{- |
Constructs a 'SelectOptions' with just the given 'Expr.OrderByExpr'.
@since 0.10.0.0
@since 1.0.0.0
-}
orderBy :: Expr.OrderByExpr -> SelectOptions
orderBy order =
@ -196,7 +196,7 @@ orderBy order =
{- |
Constructs a 'SelectOptions' that will apply the given limit.
@since 0.10.0.0
@since 1.0.0.0
-}
limit :: Int -> SelectOptions
limit limitValue =
@ -207,7 +207,7 @@ limit limitValue =
{- |
Constructs a 'SelectOptions' that will apply the given offset.
@since 0.10.0.0
@since 1.0.0.0
-}
offset :: Int -> SelectOptions
offset offsetValue =
@ -218,7 +218,7 @@ offset offsetValue =
{- |
Constructs a 'SelectOptions' with just the given 'GroupByClause'.
@since 0.10.0.0
@since 1.0.0.0
-}
groupBy :: Expr.GroupByExpr -> SelectOptions
groupBy groupByExpr =
@ -240,7 +240,7 @@ groupBy groupByExpr =
using any of the expression building functions, you can resort to
@RawSql.fromRawSql@ as an escape hatch to build the 'Expr.SelectList' here.
@since 0.10.0.0
@since 1.0.0.0
-}
selectOptionsQueryExpr ::
Expr.SelectList ->

View File

@ -7,7 +7,7 @@ Interactions to work with database sequence values on the Haskell side.
Including inspection of the current and next values in the sequence as well as
updating a sequence to a given value.
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Execution.Sequence
( sequenceNextValue
@ -29,7 +29,7 @@ import Orville.PostgreSQL.Schema (SequenceDefinition, sequenceName)
{- |
Fetches the next value from a sequence via the PostgreSQL @nextval@ function.
@since 0.10.0.0
@since 1.0.0.0
-}
sequenceNextValue :: Monad.MonadOrville m => SequenceDefinition -> m Int64
sequenceNextValue sequenceDef =
@ -40,7 +40,7 @@ sequenceNextValue sequenceDef =
{- |
Fetches the current value from a sequence via the PostgreSQL @currval@ function.
@since 0.10.0.0
@since 1.0.0.0
-}
sequenceCurrentValue :: Monad.MonadOrville m => SequenceDefinition -> m Int64
sequenceCurrentValue sequenceDef =
@ -51,7 +51,7 @@ sequenceCurrentValue sequenceDef =
{- |
Sets the current value from a sequence via the PostgreSQL @setval@ function.
@since 0.10.0.0
@since 1.0.0.0
-}
sequenceSetValue :: Monad.MonadOrville m => SequenceDefinition -> Int64 -> m Int64
sequenceSetValue sequenceDef newValue =

View File

@ -6,7 +6,7 @@ Stability : Stable
This module provides the functionality to work with SQL transactions, notably
to ensure some Haskell action occurs within a database transaction.
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Execution.Transaction
( withTransaction
@ -36,7 +36,7 @@ import qualified Orville.PostgreSQL.Raw.RawSql as RawSql
Note: Exceptions are handled using the implementations of 'Monad.catch' and
'Monad.mask' provided by the 'MonadOrvilleControl' instance for @m@.
@since 0.10.0.0
@since 1.0.0.0
-}
withTransaction :: Monad.MonadOrville m => m a -> m a
withTransaction action =
@ -118,7 +118,7 @@ transactionEventSql state event =
that will work on any database that implements savepoints accordings to the
SQL standard even though Orville only supports PostgreSQL currently.
@since 0.10.0.0
@since 1.0.0.0
-}
savepointName :: OrvilleState.Savepoint -> Expr.SavepointName
savepointName savepoint =

View File

@ -14,7 +14,7 @@ lower-level API than the entity update functions in
"Orville.PostgreSQL.Execution.EntityOperations", but not as primitive as
"Orville.PostgreSQL.Expr.Update".
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Execution.Update
( Update
@ -44,7 +44,7 @@ import Orville.PostgreSQL.Schema (HasKey, TableDefinition, mkTableReturningClaus
'SqlMarshaller' bound to it that, when the update returns data from the database, will be used to
decode the database result set when it is executed.
@since 0.10.0.0
@since 1.0.0.0
-}
data Update readEntity returningClause where
UpdateNoReturning :: Expr.UpdateExpr -> Update readEntity NoReturningClause
@ -55,7 +55,7 @@ data Update readEntity returningClause where
don't want to extract the query and run it yourself, but this function is
useful to view the query for debugging or query explanation.
@since 0.10.0.0
@since 1.0.0.0
-}
updateToUpdateExpr :: Update readEntity returningClause -> Expr.UpdateExpr
updateToUpdateExpr (UpdateNoReturning expr) = expr
@ -65,7 +65,7 @@ updateToUpdateExpr (UpdateReturning _ expr) = expr
Executes the database query for the 'Update' and returns the number of
affected rows.
@since 0.10.0.0
@since 1.0.0.0
-}
executeUpdate :: Monad.MonadOrville m => Update readEntity returningClause -> m Int
executeUpdate =
@ -76,7 +76,7 @@ executeUpdate =
'AnnotatedSqlMarshaller' to decode any rows that were just updated, as
returned via a RETURNING clause.
@since 0.10.0.0
@since 1.0.0.0
-}
executeUpdateReturnEntities :: Monad.MonadOrville m => Update readEntity ReturningClause -> m [readEntity]
executeUpdateReturnEntities (UpdateReturning marshaller expr) =
@ -89,7 +89,7 @@ executeUpdateReturnEntities (UpdateReturning marshaller expr) =
This function returns 'Nothing' if the 'TableDefinition' has no columns,
which would otherwise generate and 'Update' with invalid SQL syntax.
@since 0.10.0.0
@since 1.0.0.0
-}
updateToTable ::
TableDefinition (HasKey key) writeEntity readEntity ->
@ -108,7 +108,7 @@ updateToTable =
This function returns 'Nothing' if the 'TableDefinition' has no columns,
which would otherwise generate and 'Update' with invalid SQL syntax.
@since 0.10.0.0
@since 1.0.0.0
-}
updateToTableReturning ::
TableDefinition (HasKey key) writeEntity readEntity ->
@ -122,7 +122,7 @@ updateToTableReturning =
Builds an 'Update' that will apply the specified column set clauses to rows
within the specified table without returning the data as seen by the database.
@since 0.10.0.0
@since 1.0.0.0
-}
updateToTableFields ::
TableDefinition key writeEntity readEntity ->
@ -137,7 +137,7 @@ updateToTableFields =
within the specified table and return the updated version of any rows affected by
the update state by using a @RETURNING@ clause.
@since 0.10.0.0
@since 1.0.0.0
-}
updateToTableFieldsReturning ::
TableDefinition key writeEntity readEntity ->
@ -157,7 +157,7 @@ updateToTableFieldsReturning =
that Orville supports using the expression building functions, or use @RawSql.fromRawSql@ to build
a raw 'Expr.UpdateExpr'.
@since 0.10.0.0
@since 1.0.0.0
-}
rawUpdateExpr :: ReturningOption returningClause -> AnnotatedSqlMarshaller writeEntity readEntity -> Expr.UpdateExpr -> Update readEntity returningClause
rawUpdateExpr WithReturning marshaller = UpdateReturning marshaller

View File

@ -32,7 +32,7 @@ added @SOME NEW ISOLATION LEVEL@ and Orville did not yet support it.
(Just (Expr.isolationLevel (RawSql.unsafeSqlExpression "SOME NEW ISOLATION LEVEL")))
@
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Expr
( module Orville.PostgreSQL.Expr.BinaryOperator

View File

@ -8,7 +8,7 @@ Stability : Stable
Provides a type representing sql operators with exactly two arguments, as well
as values of that type for many common operators.
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Expr.BinaryOperator
( BinaryOperator
@ -50,12 +50,12 @@ Type to represent any SQL operator of two arguments. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype BinaryOperator
= BinaryOperator RawSql.RawSql
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
)
@ -63,7 +63,7 @@ newtype BinaryOperator
operator is valid either by being a native SQL operator, or a custom defined operator in the
database.
@since 0.10.0.0
@since 1.0.0.0
-}
binaryOperator :: String -> BinaryOperator
binaryOperator =
@ -71,7 +71,7 @@ binaryOperator =
{- | The SQL equal binary operator.
@since 0.10.0.0
@since 1.0.0.0
-}
equalsOp :: BinaryOperator
equalsOp =
@ -79,7 +79,7 @@ equalsOp =
{- | The SQL not equal binary operator.
@since 0.10.0.0
@since 1.0.0.0
-}
notEqualsOp :: BinaryOperator
notEqualsOp =
@ -87,7 +87,7 @@ notEqualsOp =
{- | The SQL strictly greater than binary operator.
@since 0.10.0.0
@since 1.0.0.0
-}
greaterThanOp :: BinaryOperator
greaterThanOp =
@ -95,7 +95,7 @@ greaterThanOp =
{- | The SQL strictly less than binary operator.
@since 0.10.0.0
@since 1.0.0.0
-}
lessThanOp :: BinaryOperator
lessThanOp =
@ -103,7 +103,7 @@ lessThanOp =
{- | The SQL greater than or equal binary operator.
@since 0.10.0.0
@since 1.0.0.0
-}
greaterThanOrEqualsOp :: BinaryOperator
greaterThanOrEqualsOp =
@ -111,7 +111,7 @@ greaterThanOrEqualsOp =
{- | The SQL less than or equal binary operator.
@since 0.10.0.0
@since 1.0.0.0
-}
lessThanOrEqualsOp :: BinaryOperator
lessThanOrEqualsOp =
@ -119,7 +119,7 @@ lessThanOrEqualsOp =
{- | The SQL LIKE binary operator.
@since 0.10.0.0
@since 1.0.0.0
-}
likeOp :: BinaryOperator
likeOp =
@ -127,7 +127,7 @@ likeOp =
{- | The SQL ILIKE binary operator.
@since 0.10.0.0
@since 1.0.0.0
-}
iLikeOp :: BinaryOperator
iLikeOp =
@ -135,7 +135,7 @@ iLikeOp =
{- | The SQL logical or binary operator.
@since 0.10.0.0
@since 1.0.0.0
-}
orOp :: BinaryOperator
orOp =
@ -143,7 +143,7 @@ orOp =
{- | The SQL logical and binary operator.
@since 0.10.0.0
@since 1.0.0.0
-}
andOp :: BinaryOperator
andOp =
@ -151,7 +151,7 @@ andOp =
{- | The SQL + binary operator.
@since 0.10.0.0
@since 1.0.0.0
-}
plusOp :: BinaryOperator
plusOp =
@ -159,7 +159,7 @@ plusOp =
{- | The SQL - binary operator.
@since 0.10.0.0
@since 1.0.0.0
-}
minusOp :: BinaryOperator
minusOp =
@ -167,7 +167,7 @@ minusOp =
{- | The SQL * binary operator.
@since 0.10.0.0
@since 1.0.0.0
-}
multiplicationOp :: BinaryOperator
multiplicationOp =
@ -175,7 +175,7 @@ multiplicationOp =
{- | The SQL / binary operator.
@since 0.10.0.0
@since 1.0.0.0
-}
divisionOp :: BinaryOperator
divisionOp =
@ -183,7 +183,7 @@ divisionOp =
{- | The SQL % binary operator.
@since 0.10.0.0
@since 1.0.0.0
-}
moduloOp :: BinaryOperator
moduloOp =
@ -191,7 +191,7 @@ moduloOp =
{- | The SQL ^ binary operator.
@since 0.10.0.0
@since 1.0.0.0
-}
exponentiationOp :: BinaryOperator
exponentiationOp =
@ -199,7 +199,7 @@ exponentiationOp =
{- | The SQL bitwise and (a.k.a &) binary operator.
@since 0.10.0.0
@since 1.0.0.0
-}
bitwiseAndOp :: BinaryOperator
bitwiseAndOp =
@ -207,7 +207,7 @@ bitwiseAndOp =
{- | The SQL bitwise or (a.k.a |) binary operator.
@since 0.10.0.0
@since 1.0.0.0
-}
bitwiseOrOp :: BinaryOperator
bitwiseOrOp =
@ -215,7 +215,7 @@ bitwiseOrOp =
{- | The SQL bitwise exclusive or (a.k.a #) binary operator.
@since 0.10.0.0
@since 1.0.0.0
-}
bitwiseXorOp :: BinaryOperator
bitwiseXorOp =
@ -223,7 +223,7 @@ bitwiseXorOp =
{- | The SQL bitwise left shift (a.k.a <<) binary operator.
@since 0.10.0.0
@since 1.0.0.0
-}
bitwiseShiftLeftOp :: BinaryOperator
bitwiseShiftLeftOp =
@ -231,7 +231,7 @@ bitwiseShiftLeftOp =
{- | The SQL bitwise right shift (a.k.a >>) binary operator.
@since 0.10.0.0
@since 1.0.0.0
-}
bitwiseShiftRightOp :: BinaryOperator
bitwiseShiftRightOp =
@ -242,7 +242,7 @@ bitwiseShiftRightOp =
being used with the 'BinaryOperator'. It is left to the caller to ensure that the operator makes
sense with the arguments being passed.
@since 0.10.0.0
@since 1.0.0.0
-}
binaryOpExpression ::
RawSql.SqlExpression sql =>

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Expr.ColumnDefinition
( ColumnDefinition
@ -34,18 +34,18 @@ Represent a complete definition of a column. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype ColumnDefinition
= ColumnDefinition RawSql.RawSql
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
)
{- | Smart constructor for ensuring a 'ColumnDefinition' is setup correctly.
@since 0.10.0.0
@since 1.0.0.0
-}
columnDefinition ::
-- | The name the resulting column should have.
@ -76,18 +76,18 @@ Represent constraints, such as nullability, on a column. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype ColumnConstraint
= ColumnConstraint RawSql.RawSql
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
)
{- | Express that a column may not contain NULL.
@since 0.10.0.0
@since 1.0.0.0
-}
notNullConstraint :: ColumnConstraint
notNullConstraint =
@ -95,7 +95,7 @@ notNullConstraint =
{- | Express that a column may contain NULL.
@since 0.10.0.0
@since 1.0.0.0
-}
nullConstraint :: ColumnConstraint
nullConstraint =
@ -110,12 +110,12 @@ Represents the default value of a column. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype ColumnDefault
= ColumnDefault RawSql.RawSql
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
)
@ -123,7 +123,7 @@ newtype ColumnDefault
column default. Note that it is up to the caller to ensure the 'ValueExpression' makes sense for
the resulting 'ColumnDefinition' this will be a part of.
@since 0.10.0.0
@since 1.0.0.0
-}
columnDefault ::
ValueExpression ->

View File

@ -3,7 +3,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Expr.Count
( count
@ -19,14 +19,14 @@ import qualified Orville.PostgreSQL.Raw.RawSql as RawSql
{- | The SQL @count@ function
@since 0.10.0.0
@since 1.0.0.0
-}
countFunction :: FunctionName
countFunction = functionName "count"
{- | Given a 'ValueExpression', use it as the argument to the SQL @count@
@since 0.10.0.0
@since 1.0.0.0
-}
count :: ValueExpression -> ValueExpression
count value =
@ -34,7 +34,7 @@ count value =
{- | The SQL @count(1)@
@since 0.10.0.0
@since 1.0.0.0
-}
count1 :: ValueExpression
count1 =
@ -42,7 +42,7 @@ count1 =
{- | Use a given column as the argument to the SQL @count@
@since 0.10.0.0
@since 1.0.0.0
-}
countColumn :: ColumnName -> ValueExpression
countColumn =

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Expr.Cursor
( DeclareExpr
@ -63,19 +63,19 @@ more information.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype DeclareExpr
= DeclareExpr RawSql.RawSql
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
)
{- | A smart constructor for setting up a 'DeclareExpr'. This, along with other functions provided
allow to more safely declare a cursor.
@since 0.10.0.0
@since 1.0.0.0
-}
declare ::
CursorName ->
@ -112,18 +112,18 @@ documentation](https://www.postgresql.org/docs/current/sql-declare.html) for mor
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype ScrollExpr
= ScrollExpr RawSql.RawSql
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
)
{- | Allow a cursor to be used to fetch rows nonsequentially.
@since 0.10.0.0
@since 1.0.0.0
-}
scroll :: ScrollExpr
scroll =
@ -131,7 +131,7 @@ scroll =
{- | Only allow a cursor to be used to fetch rows sequentially.
@since 0.10.0.0
@since 1.0.0.0
-}
noScroll :: ScrollExpr
noScroll =
@ -150,18 +150,18 @@ more information.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype HoldExpr
= HoldExpr RawSql.RawSql
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
)
{- | Allow a cursor to be used after the transaction creating it is committed.
@since 0.10.0.0
@since 1.0.0.0
-}
withHold :: HoldExpr
withHold =
@ -169,7 +169,7 @@ withHold =
{- | Do not allow a cursor to be used after the transaction creating it is committed.
@since 0.10.0.0
@since 1.0.0.0
-}
withoutHold :: HoldExpr
withoutHold =
@ -187,19 +187,19 @@ more information.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype CloseExpr
= CloseExpr RawSql.RawSql
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
)
{- | A smart constructor for setting up a 'CloseExpr' either closing all cursors or the given named
cursor.
@since 0.10.0.0
@since 1.0.0.0
-}
close :: Either AllCursors CursorName -> CloseExpr
close allOrCursorName =
@ -216,18 +216,18 @@ close allOrCursorName =
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype AllCursors
= AllCursors RawSql.RawSql
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
)
{- | Specify closing all open cursors, for use with a 'CloseExpr'
@since 0.10.0.0
@since 1.0.0.0
-}
allCursors :: AllCursors
allCursors =
@ -247,18 +247,18 @@ information.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype FetchExpr
= FetchExpr RawSql.RawSql
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
)
{- | Construct a 'FetchExpr', for a given cursor and optionally a direction to fetch.
@since 0.10.0.0
@since 1.0.0.0
-}
fetch :: Maybe CursorDirection -> CursorName -> FetchExpr
fetch maybeDirection cursorName =
@ -280,18 +280,18 @@ created cursor, /without/ retrieving any rows. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype MoveExpr
= MoveExpr RawSql.RawSql
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
)
{- | Construct a 'MoveExpr', for a given cursor and optionally a direction to move.
@since 0.10.0.0
@since 1.0.0.0
-}
move :: Maybe CursorDirection -> CursorName -> MoveExpr
move maybeDirection cursorName =
@ -316,12 +316,12 @@ more information.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype CursorDirection
= CursorDirection RawSql.RawSql
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
)
@ -330,7 +330,7 @@ newtype CursorDirection
See PostgreSQL [fetch documentation](https://www.postgresql.org/docs/current/sql-fetch.html) for
more information.
@since 0.10.0.0
@since 1.0.0.0
-}
next :: CursorDirection
next =
@ -341,7 +341,7 @@ next =
See PostgreSQL [fetch documentation](https://www.postgresql.org/docs/current/sql-fetch.html) for
more information.
@since 0.10.0.0
@since 1.0.0.0
-}
prior :: CursorDirection
prior =
@ -352,7 +352,7 @@ prior =
See PostgreSQL [fetch documentation](https://www.postgresql.org/docs/current/sql-fetch.html) for
more information.
@since 0.10.0.0
@since 1.0.0.0
-}
first :: CursorDirection
first =
@ -363,7 +363,7 @@ first =
See PostgreSQL [fetch documentation](https://www.postgresql.org/docs/current/sql-fetch.html) for
more information.
@since 0.10.0.0
@since 1.0.0.0
-}
last :: CursorDirection
last =
@ -375,7 +375,7 @@ last =
See PostgreSQL [fetch documentation](https://www.postgresql.org/docs/current/sql-fetch.html) for
more information.
@since 0.10.0.0
@since 1.0.0.0
-}
absolute :: Int -> CursorDirection
absolute countParam =
@ -393,7 +393,7 @@ absolute countParam =
See PostgreSQL [fetch documentation](https://www.postgresql.org/docs/current/sql-fetch.html) for
more information.
@since 0.10.0.0
@since 1.0.0.0
-}
relative :: Int -> CursorDirection
relative countParam =
@ -411,7 +411,7 @@ relative countParam =
See PostgreSQL [fetch documentation](https://www.postgresql.org/docs/current/sql-fetch.html) for
more information.
@since 0.10.0.0
@since 1.0.0.0
-}
rowCount :: Int -> CursorDirection
rowCount countParam =
@ -427,7 +427,7 @@ rowCount countParam =
See PostgreSQL [fetch documentation](https://www.postgresql.org/docs/current/sql-fetch.html) for
more information.
@since 0.10.0.0
@since 1.0.0.0
-}
fetchAll :: CursorDirection
fetchAll =
@ -438,7 +438,7 @@ fetchAll =
See PostgreSQL [fetch documentation](https://www.postgresql.org/docs/current/sql-fetch.html) for
more information.
@since 0.10.0.0
@since 1.0.0.0
-}
forward :: CursorDirection
forward =
@ -449,7 +449,7 @@ forward =
See PostgreSQL [fetch documentation](https://www.postgresql.org/docs/current/sql-fetch.html) for
more information.
@since 0.10.0.0
@since 1.0.0.0
-}
forwardCount :: Int -> CursorDirection
forwardCount countParam =
@ -466,7 +466,7 @@ forwardCount countParam =
See PostgreSQL [fetch documentation](https://www.postgresql.org/docs/current/sql-fetch.html) for
more information.
@since 0.10.0.0
@since 1.0.0.0
-}
forwardAll :: CursorDirection
forwardAll =
@ -477,7 +477,7 @@ forwardAll =
See PostgreSQL [fetch documentation](https://www.postgresql.org/docs/current/sql-fetch.html) for
more information.
@since 0.10.0.0
@since 1.0.0.0
-}
backward :: CursorDirection
backward =
@ -488,7 +488,7 @@ backward =
See PostgreSQL [fetch documentation](https://www.postgresql.org/docs/current/sql-fetch.html) for
more information.
@since 0.10.0.0
@since 1.0.0.0
-}
backwardCount :: Int -> CursorDirection
backwardCount countParam =
@ -505,7 +505,7 @@ backwardCount countParam =
See PostgreSQL [fetch documentation](https://www.postgresql.org/docs/current/sql-fetch.html) for
more information.
@since 0.10.0.0
@since 1.0.0.0
-}
backwardAll :: CursorDirection
backwardAll =

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Expr.DataType
( DataType
@ -42,12 +42,12 @@ Type to represent any SQL data type expression. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype DataType
= DataType RawSql.RawSql
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
)
@ -56,7 +56,7 @@ newtype DataType
See [postgresql documentation](https://www.postgresql.org/docs/current/datatype-datetime.html) for
more information.
@since 0.10.0.0
@since 1.0.0.0
-}
timestampWithZone :: DataType
timestampWithZone =
@ -67,7 +67,7 @@ timestampWithZone =
See [postgresql documentation](https://www.postgresql.org/docs/current/datatype-datetime.html) for
more information.
@since 0.10.0.0
@since 1.0.0.0
-}
timestampWithoutZone :: DataType
timestampWithoutZone =
@ -78,7 +78,7 @@ timestampWithoutZone =
See [postgresql documentation](https://www.postgresql.org/docs/current/datatype-datetime.html) for
more information.
@since 0.10.0.0
@since 1.0.0.0
-}
date :: DataType
date =
@ -90,7 +90,7 @@ See [postgresql
documentation](https://www.postgresql.org/docs/current/datatype-textsearch.html#DATATYPE-TSVECTOR)
for more information.
@since 0.10.0.0
@since 1.0.0.0
-}
tsvector :: DataType
tsvector =
@ -101,7 +101,7 @@ tsvector =
See [postgresql documentation](https://www.postgresql.org/docs/current/datatype-character.html) for
more information.
@since 0.10.0.0
@since 1.0.0.0
-}
varchar :: Int32 -> DataType
varchar len =
@ -119,7 +119,7 @@ varchar len =
See [postgresql documentation](https://www.postgresql.org/docs/current/datatype-character.html) for
more information.
@since 0.10.0.0
@since 1.0.0.0
-}
char :: Int32 -> DataType
char len =
@ -137,7 +137,7 @@ char len =
See [postgresql documentation](https://www.postgresql.org/docs/current/datatype-character.html) for
more information.
@since 0.10.0.0
@since 1.0.0.0
-}
text :: DataType
text =
@ -148,7 +148,7 @@ text =
See [postgresql documentation](https://www.postgresql.org/docs/current/datatype-uuid.html) for more
information.
@since 0.10.0.0
@since 1.0.0.0
-}
uuid :: DataType
uuid =
@ -159,7 +159,7 @@ uuid =
See [postgresql documentation](https://www.postgresql.org/docs/current/datatype-boolean.html) for
more information.
@since 0.10.0.0
@since 1.0.0.0
-}
boolean :: DataType
boolean =
@ -171,7 +171,7 @@ See [postgresql
documentation](https://www.postgresql.org/docs/current/datatype-numeric.html#DATATYPE-FLOAT) for
more information.
@since 0.10.0.0
@since 1.0.0.0
-}
doublePrecision :: DataType
doublePrecision =
@ -183,7 +183,7 @@ See [postgresql
documentation](https://www.postgresql.org/docs/current/datatype-numeric.html#DATATYPE-SERIAL) for
more information.
@since 0.10.0.0
@since 1.0.0.0
-}
bigSerial :: DataType
bigSerial =
@ -195,7 +195,7 @@ See [postgresql
documentation](https://www.postgresql.org/docs/current/datatype-numeric.html#DATATYPE-INT) for
more information.
@since 0.10.0.0
@since 1.0.0.0
-}
bigInt :: DataType
bigInt =
@ -207,7 +207,7 @@ See [postgresql
documentation](https://www.postgresql.org/docs/current/datatype-numeric.html#DATATYPE-SERIAL) for
more information.
@since 0.10.0.0
@since 1.0.0.0
-}
serial :: DataType
serial =
@ -219,7 +219,7 @@ See [postgresql
documentation](https://www.postgresql.org/docs/current/datatype-numeric.html#DATATYPE-INT) for
more information.
@since 0.10.0.0
@since 1.0.0.0
-}
int :: DataType
int =
@ -231,7 +231,7 @@ See [postgresql
documentation](https://www.postgresql.org/docs/current/datatype-numeric.html#DATATYPE-INT) for
more information.
@since 0.10.0.0
@since 1.0.0.0
-}
smallint :: DataType
smallint =
@ -243,7 +243,7 @@ smallint =
See [postgresql documentation](https://www.postgresql.org/docs/current/datatype-json.html) for more
information.
@since 0.10.0.0
@since 1.0.0.0
-}
jsonb :: DataType
jsonb =
@ -255,7 +255,7 @@ See [postgresql
documentation](https://www.postgresql.org/docs/current/datatype-oid.html) for
more information.
@since 0.10.0.0
@since 1.0.0.0
-}
oid :: DataType
oid =

View File

@ -7,7 +7,7 @@ Stability : Stable
Provides a type representing SQL DELETE and construction of that type.
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Expr.Delete
( DeleteExpr
@ -31,12 +31,12 @@ Type to represent a SQL delete statement. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype DeleteExpr
= DeleteExpr RawSql.RawSql
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
)
@ -45,7 +45,7 @@ newtype DeleteExpr
Construct a SQL DELETE from a table, optionally limiting with a 'WhereClause' and optionally
returning a 'ReturningExpr'.
@since 0.10.0.0
@since 1.0.0.0
-}
deleteExpr ::
Qualified TableName ->

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Expr.GroupBy
( GroupByClause
@ -31,18 +31,18 @@ Type to represent a SQL group by clause. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype GroupByClause
= GroupByClause RawSql.RawSql
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
)
{- | Create a full sql GROUP BY clause with the given expression.
@since 0.10.0.0
@since 1.0.0.0
-}
groupByClause :: GroupByExpr -> GroupByClause
groupByClause expr = GroupByClause (RawSql.fromString "GROUP BY " <> RawSql.toRawSql expr)
@ -57,24 +57,24 @@ BY@ in sql). E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype GroupByExpr
= GroupByExpr RawSql.RawSql
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
)
{- |
@since 0.10.0.0
@since 1.0.0.0
-}
instance Semigroup GroupByExpr where
(<>) = appendGroupByExpr
{- | Combines two 'GroupByExpr's with a comma between them.
@since 0.10.0.0
@since 1.0.0.0
-}
appendGroupByExpr :: GroupByExpr -> GroupByExpr -> GroupByExpr
appendGroupByExpr (GroupByExpr a) (GroupByExpr b) =
@ -83,7 +83,7 @@ appendGroupByExpr (GroupByExpr a) (GroupByExpr b) =
{- | Create a 'GroupByExpr' from some 'RawSql'. Note that it is up to the caller to ensure that the
given value can actually be used for a 'GroupByExpr'
@since 0.10.0.0
@since 1.0.0.0
-}
groupByExpr :: RawSql.RawSql -> GroupByExpr
groupByExpr =
@ -91,7 +91,7 @@ groupByExpr =
{- | Create a 'GroupByExpr' from the given 'ColumnName's.
@since 0.10.0.0
@since 1.0.0.0
-}
groupByColumnsExpr :: NonEmpty ColumnName -> GroupByExpr
groupByColumnsExpr =

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Expr.IfExists
( IfExists
@ -24,19 +24,19 @@ Type to represent a SQL "IF EXISTS" expression. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype IfExists
= IfExists RawSql.RawSql
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
)
{- |
A value of the SQL "IF EXISTS"
@since 0.10.0.0
@since 1.0.0.0
-}
ifExists :: IfExists
ifExists =

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Expr.Index
( CreateIndexExpr
@ -35,12 +35,12 @@ Type to represent a SQL "CREATE INDEX" statement. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype CreateIndexExpr
= CreateIndexExpr RawSql.RawSql
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
)
@ -48,7 +48,7 @@ newtype CreateIndexExpr
Construct a SQL CREATE INDEX from an indicator of if the index should be
unique, a table, and corresponding collection of 'ColumnName's.
@since 0.10.0.0
@since 1.0.0.0
-}
createIndexExpr ::
IndexUniqueness ->
@ -72,7 +72,7 @@ Construct a SQL CREATE INDEX from an indicator of if the index should be
unique, a table, a name for the index, and some sql representing the rest of
the index creation.
@since 0.10.0.0
@since 1.0.0.0
-}
createNamedIndexExpr ::
IndexUniqueness ->
@ -102,12 +102,12 @@ Type to represent the @CONCURRENTLY@ keyword for index creation. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype ConcurrentlyExpr
= ConcurrentlyExpr RawSql.RawSql
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
)
@ -115,7 +115,7 @@ newtype ConcurrentlyExpr
The @CONCURRENTLY@ keyword indicates to PostgreSQL that an index should be
create concurrently.
@since 0.10.0.0
@since 1.0.0.0
-}
concurrently :: ConcurrentlyExpr
concurrently =
@ -134,12 +134,12 @@ in
'Rawsql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype IndexBodyExpr
= IndexBodyExpr RawSql.RawSql
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
)
@ -147,7 +147,7 @@ newtype IndexBodyExpr
Creates an 'IndexBodyExpr' for the given column names. The resulting
SQL looks like @(column1, column2, ...)@.
@since 0.10.0.0
@since 1.0.0.0
-}
indexBodyColumns ::
NonEmpty ColumnName ->
@ -161,17 +161,17 @@ indexBodyColumns columns =
{- |
Type to represent if an index should be unique.
@since 0.10.0.0
@since 1.0.0.0
-}
data IndexUniqueness
= UniqueIndex
| NonUniqueIndex
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
Eq
, -- | @since 0.10.0.0
, -- | @since 1.0.0.0
Ord
, -- | @since 0.10.0.0
, -- | @since 1.0.0.0
Show
)
@ -191,19 +191,19 @@ Type to represent a SQL "DROP INDEX" statement. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype DropIndexExpr
= DropIndexExpr RawSql.RawSql
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
)
{- |
Construct a SQL DROP INDEX for a given 'IndexName'.
@since 0.10.0.0
@since 1.0.0.0
-}
dropIndexExpr :: IndexName -> DropIndexExpr
dropIndexExpr indexName =

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Expr.Insert
( InsertExpr
@ -35,12 +35,12 @@ Type to represent a SQL "INSERT" statement. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype InsertExpr
= InsertExpr RawSql.RawSql
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
)
@ -49,7 +49,7 @@ given. Callers of this likely want to use a function to create the 'InsertSource
input values are correctly used as parameters. This function does not include that protection
itself.
@since 0.10.0.0
@since 1.0.0.0
-}
insertExpr ::
Qualified TableName ->
@ -77,19 +77,19 @@ Type to represent the SQL columns list for an insert statement. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype InsertColumnList
= InsertColumnList RawSql.RawSql
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
)
{- | Create an 'InsertColumnList' for the given 'ColumnName's, making sure the columns are wrapped in
parens and commas are used to separate.
@since 0.10.0.0
@since 1.0.0.0
-}
insertColumnList :: [ColumnName] -> InsertColumnList
insertColumnList columnNames =
@ -107,19 +107,19 @@ Type to represent the SQL for the source of data for an insert statement E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype InsertSource
= InsertSource RawSql.RawSql
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
)
{- | Create an 'InsertSource' for the given 'RowValues'. This ensures that all input values are used
as parameters and comma separated in the generated SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
insertRowValues :: [RowValues] -> InsertSource
insertRowValues rows =
@ -130,7 +130,7 @@ insertRowValues rows =
{- | Create an 'InsertSource' for the given 'SqlValues'. This ensures that all input values are used
as parameters and comma separated in the generated SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
insertSqlValues :: [[SqlValue]] -> InsertSource
insertSqlValues =
@ -146,19 +146,19 @@ in a @VALUES@ clause. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype RowValues
= RowValues RawSql.RawSql
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
)
{- | Create a 'RowValues' for the given 'SqlValues'. This ensures that all input values are used as
parameters and comma separated in the generated SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
rowValues :: [SqlValue] -> RowValues
rowValues values =

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Expr.Internal.Name.ColumnName
( ColumnName
@ -26,21 +26,21 @@ Type to represent a SQL column name. 'ColumnName' values constructed via the
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype ColumnName
= ColumnName Identifier
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
, -- | @since 0.10.0.0
, -- | @since 1.0.0.0
IdentifierExpression
)
{- |
Construct a 'ColumnName' from a 'String' with proper escaping as part of the generated SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
columnName :: String -> ColumnName
columnName = ColumnName . identifier

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Expr.Internal.Name.ConstraintName
( ConstraintName
@ -27,21 +27,21 @@ generated SQL. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype ConstraintName
= ConstraintName Identifier
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
, -- | @since 0.10.0.0
, -- | @since 1.0.0.0
IdentifierExpression
)
{- |
Construct a 'ConstraintName' from a 'String' with proper escaping as part of the generated SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
constraintName :: String -> ConstraintName
constraintName = ConstraintName . identifier

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Expr.Internal.Name.CursorName
( CursorName
@ -27,21 +27,21 @@ generated SQL. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype CursorName
= CursorName Identifier
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
, -- | @since 0.10.0.0
, -- | @since 1.0.0.0
IdentifierExpression
)
{- |
Construct a 'CursorName' from a 'String' with proper escaping as part of the generated SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
cursorName :: String -> CursorName
cursorName =

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Expr.Internal.Name.FunctionName
( FunctionName
@ -27,21 +27,21 @@ generated SQL. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype FunctionName
= FunctionName Identifier
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
, -- | @since 0.10.0.0
, -- | @since 1.0.0.0
IdentifierExpression
)
{- |
Construct a 'FunctionName' from a 'String' with proper escaping as part of the generated SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
functionName :: String -> FunctionName
functionName =

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Expr.Internal.Name.Identifier
( Identifier
@ -29,19 +29,19 @@ E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype Identifier
= Identifier RawSql.RawSql
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
)
{- |
Construct an 'Identifier' from a 'String' with proper escaping as part of the generated SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
identifier :: String -> Identifier
identifier =
@ -50,7 +50,7 @@ identifier =
{- |
Construct an 'Identifier' from a 'B8.ByteString' with proper escaping as part of the generated SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
identifierFromBytes :: B8.ByteString -> Identifier
identifierFromBytes =
@ -59,18 +59,18 @@ identifierFromBytes =
{- | This class aids in giving additional polymorphism and so that many different identifiers can be
created without being forced to only use the `Identifier` type.
@since 0.10.0.0
@since 1.0.0.0
-}
class IdentifierExpression name where
-- | @since 0.10.0.0
-- | @since 1.0.0.0
toIdentifier :: name -> Identifier
-- | @since 0.10.0.0
-- | @since 1.0.0.0
fromIdentifier :: Identifier -> name
{- |
@since 0.10.0.0
@since 1.0.0.0
-}
instance IdentifierExpression Identifier where
toIdentifier = id

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Expr.Internal.Name.IndexName
( IndexName
@ -26,21 +26,21 @@ Type to represent a SQL index name. 'IndexName' values constructed via the
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype IndexName
= IndexName Identifier
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
, -- | @since 0.10.0.0
, -- | @since 1.0.0.0
IdentifierExpression
)
{- |
Construct a 'IndexName' from a 'String' with proper escaping as part of the generated SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
indexName :: String -> IndexName
indexName = IndexName . identifier

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Expr.Internal.Name.Qualified
( Qualified
@ -31,19 +31,19 @@ Type to represent a qualified SQL name. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype Qualified name
= Qualified RawSql.RawSql
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
)
{- | Optionally qualifies a 'TableName' with a 'SchemaName'. Generally you would want the higher
level function 'tableIdQualifiedName'.
@since 0.10.0.0
@since 1.0.0.0
-}
qualifyTable ::
Maybe SchemaName ->
@ -54,7 +54,7 @@ qualifyTable = unsafeSchemaQualify
{- | Optionally qualifies a 'SequenceName' with a 'SchemaName'. Generally you would want the higher
level function 'sequenceIdQualifiedName'.
@since 0.10.0.0
@since 1.0.0.0
-}
qualifySequence ::
Maybe SchemaName ->
@ -65,7 +65,7 @@ qualifySequence = unsafeSchemaQualify
{- | Qualifies a 'ColumnName' with a 'TableName' and, optionally, a 'SchemaName'. This should be
used to refer to the column in SQL queries where a qualified reference is appropriate.
@since 0.10.0.0
@since 1.0.0.0
-}
qualifyColumn :: Maybe SchemaName -> TableName -> ColumnName -> Qualified ColumnName
qualifyColumn mbSchemaName tableName unqualifiedName =

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Expr.Internal.Name.SavepointName
( SavepointName
@ -27,21 +27,21 @@ SQL. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype SavepointName
= SavepointName Identifier
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
, -- | @since 0.10.0.0
, -- | @since 1.0.0.0
IdentifierExpression
)
{- |
Construct a 'SavepointName' from a 'String' with proper escaping as part of the generated SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
savepointName :: String -> SavepointName
savepointName = SavepointName . identifier

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Expr.Internal.Name.SchemaName
( SchemaName
@ -27,21 +27,21 @@ E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype SchemaName
= SchemaName Identifier
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
, -- | @since 0.10.0.0
, -- | @since 1.0.0.0
IdentifierExpression
)
{- |
Construct a 'ColumnName' from a 'String' with proper escaping as part of the generated SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
schemaName :: String -> SchemaName
schemaName =

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Expr.Internal.Name.SequenceName
( SequenceName
@ -27,21 +27,21 @@ SQL. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype SequenceName
= SequenceName Identifier
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
, -- | @since 0.10.0.0
, -- | @since 1.0.0.0
IdentifierExpression
)
{- |
Construct a 'SequenceName' from a 'String' with proper escaping as part of the generated SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
sequenceName :: String -> SequenceName
sequenceName =

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Expr.Internal.Name.TableName
( TableName
@ -27,21 +27,21 @@ E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype TableName
= TableName Identifier
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
, -- | @since 0.10.0.0
, -- | @since 1.0.0.0
IdentifierExpression
)
{- |
Construct a 'TableName' from a 'String' with proper escaping as part of the generated SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
tableName :: String -> TableName
tableName =

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Expr.LimitExpr
( LimitExpr
@ -25,19 +25,19 @@ Type to represent a SQL limit expression. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype LimitExpr
= LimitExpr RawSql.RawSql
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
)
{- | Create a 'LimitExpr' for the given 'Int'. This ensures that the input value is used
as parameters in the generated SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
limitExpr :: Int -> LimitExpr
limitExpr limitValue =

View File

@ -3,7 +3,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Expr.Math
( plus
@ -26,7 +26,7 @@ import Orville.PostgreSQL.Expr.ValueExpression (ValueExpression)
{- | Apply a SQL + to the 'ValueExpression's. It is left to the caller to ensure that the operator
makes sense with the arguments being passed.
@since 0.10.0.0
@since 1.0.0.0
-}
plus :: ValueExpression -> ValueExpression -> ValueExpression
plus =
@ -35,7 +35,7 @@ plus =
{- | Apply a SQL - to the 'ValueExpression's. It is left to the caller to ensure that the operator
makes sense with the arguments being passed.
@since 0.10.0.0
@since 1.0.0.0
-}
minus :: ValueExpression -> ValueExpression -> ValueExpression
minus =
@ -44,7 +44,7 @@ minus =
{- | Apply a SQL * to the 'ValueExpression's. It is left to the caller to ensure that the operator
makes sense with the arguments being passed.
@since 0.10.0.0
@since 1.0.0.0
-}
multiply :: ValueExpression -> ValueExpression -> ValueExpression
multiply =
@ -53,7 +53,7 @@ multiply =
{- | Apply a SQL / to the 'ValueExpression's. It is left to the caller to ensure that the operator
makes sense with the arguments being passed.
@since 0.10.0.0
@since 1.0.0.0
-}
divide :: ValueExpression -> ValueExpression -> ValueExpression
divide =
@ -62,7 +62,7 @@ divide =
{- | Apply a SQL % to the 'ValueExpression's. It is left to the caller to ensure that the operator
makes sense with the arguments being passed.
@since 0.10.0.0
@since 1.0.0.0
-}
modulo :: ValueExpression -> ValueExpression -> ValueExpression
modulo =
@ -71,7 +71,7 @@ modulo =
{- | Apply a SQL ^ to the 'ValueExpression's. It is left to the caller to ensure that the operator
makes sense with the arguments being passed.
@since 0.10.0.0
@since 1.0.0.0
-}
exponentiate :: ValueExpression -> ValueExpression -> ValueExpression
exponentiate =
@ -80,7 +80,7 @@ exponentiate =
{- | Apply a SQL & to the 'ValueExpression's. It is left to the caller to ensure that the operator
makes sense with the arguments being passed.
@since 0.10.0.0
@since 1.0.0.0
-}
bitwiseAnd :: ValueExpression -> ValueExpression -> ValueExpression
bitwiseAnd =
@ -89,7 +89,7 @@ bitwiseAnd =
{- | Apply a SQL | to the 'ValueExpression's. It is left to the caller to ensure that the operator
makes sense with the arguments being passed.
@since 0.10.0.0
@since 1.0.0.0
-}
bitwiseOr :: ValueExpression -> ValueExpression -> ValueExpression
bitwiseOr =
@ -98,7 +98,7 @@ bitwiseOr =
{- | Apply a SQL # to the 'ValueExpression's. It is left to the caller to ensure that the operator
makes sense with the arguments being passed.
@since 0.10.0.0
@since 1.0.0.0
-}
bitwiseXor :: ValueExpression -> ValueExpression -> ValueExpression
bitwiseXor =
@ -107,7 +107,7 @@ bitwiseXor =
{- | Apply a SQL << to the 'ValueExpression's. It is left to the caller to ensure that the operator
makes sense with the arguments being passed.
@since 0.10.0.0
@since 1.0.0.0
-}
bitwiseShiftLeft :: ValueExpression -> ValueExpression -> ValueExpression
bitwiseShiftLeft =
@ -116,7 +116,7 @@ bitwiseShiftLeft =
{- | Apply a SQL >> to the 'ValueExpression's. It is left to the caller to ensure that the operator
makes sense with the arguments being passed.
@since 0.10.0.0
@since 1.0.0.0
-}
bitwiseShiftRight :: ValueExpression -> ValueExpression -> ValueExpression
bitwiseShiftRight =

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Expr.Name
( module Export

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Expr.OffsetExpr
( OffsetExpr
@ -25,19 +25,19 @@ Type to represent a SQL offset expression. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype OffsetExpr
= OffsetExpr RawSql.RawSql
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
)
{- | Create an 'OffsetExpr' for the given 'Int'. This ensures that the input value is used
as parameters in the generated SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
offsetExpr :: Int -> OffsetExpr
offsetExpr offsetValue =

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Expr.OrderBy
( OrderByClause
@ -38,7 +38,7 @@ Type to represent a SQL order by clause. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype OrderByClause
= OrderByClause RawSql.RawSql
@ -57,23 +57,23 @@ BY@ in sql). E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype OrderByExpr = OrderByExpr RawSql.RawSql
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
RawSql.SqlExpression
)
{- |
@since 0.10.0.0
@since 1.0.0.0
-}
instance Semigroup OrderByExpr where
(<>) = appendOrderByExpr
{- | Combines two 'OrderByExpr's with a comma between them.
@since 0.10.0.0
@since 1.0.0.0
-}
appendOrderByExpr :: OrderByExpr -> OrderByExpr -> OrderByExpr
appendOrderByExpr (OrderByExpr a) (OrderByExpr b) =
@ -82,7 +82,7 @@ appendOrderByExpr (OrderByExpr a) (OrderByExpr b) =
{- | Create a 'OrderByExpr' from some 'RawSql' and a 'OrderByDirection'. Note that it is up to the
caller to ensure that the given value can actually be used for a 'OrderByExpr'
@since 0.10.0.0
@since 1.0.0.0
-}
orderByExpr :: RawSql.RawSql -> OrderByDirection -> OrderByExpr
orderByExpr sql orderSql =
@ -91,7 +91,7 @@ orderByExpr sql orderSql =
{- | Create a 'OrderByExpr' for 'ColumnName' and 'OrderByDirection' pairs, ensuring commas as
needed.
@since 0.10.0.0
@since 1.0.0.0
-}
orderByColumnsExpr :: NonEmpty (ColumnName, OrderByDirection) -> OrderByExpr
orderByColumnsExpr =
@ -104,7 +104,7 @@ orderByColumnsExpr =
{-- |
Orders a query by the given column name in the given order direction.
@since 0.10.0.0
@since 1.0.0.0
-}
orderByColumnName :: ColumnName -> OrderByDirection -> OrderByExpr
orderByColumnName =
@ -119,7 +119,7 @@ Type to represent a SQL order by direction expression. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype OrderByDirection = OrderByDirection RawSql.RawSql
deriving (RawSql.SqlExpression)
@ -127,41 +127,41 @@ newtype OrderByDirection = OrderByDirection RawSql.RawSql
{- |
Type to represent the ordering of Null, intended to be used with 'OrderByDirection'.
@since 0.10.0.0
@since 1.0.0.0
-}
data NullsOrder
= NullsFirst
| NullsLast
deriving
( -- | @since 0.10.0.0
( -- | @since 1.0.0.0
Eq
, -- | @since 0.10.0.0
, -- | @since 1.0.0.0
Show
, -- | @since 0.10.0.0
, -- | @since 1.0.0.0
Ord
, -- | @since 0.10.0.0
, -- | @since 1.0.0.0
Enum
, -- | @since 0.10.0.0
, -- | @since 1.0.0.0
Bounded
)
{- | The SQL ASC order direction.
@since 0.10.0.0
@since 1.0.0.0
-}
ascendingOrder :: OrderByDirection
ascendingOrder = OrderByDirection $ RawSql.fromString "ASC"
{- | The SQL DESC order direction.
@since 0.10.0.0
@since 1.0.0.0
-}
descendingOrder :: OrderByDirection
descendingOrder = OrderByDirection $ RawSql.fromString "DESC"
{- | The SQL ASC order direction with NULLs ordered as given.
@since 0.10.0.0
@since 1.0.0.0
-}
ascendingOrderWith :: NullsOrder -> OrderByDirection
ascendingOrderWith no =
@ -169,7 +169,7 @@ ascendingOrderWith no =
{- | The SQL DESC order direction with NULLs ordered as given.
@since 0.10.0.0
@since 1.0.0.0
-}
descendingOrderWith :: NullsOrder -> OrderByDirection
descendingOrderWith no =

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Expr.Query
( QueryExpr
@ -46,7 +46,7 @@ Type to represent a SQL query, E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype QueryExpr
= QueryExpr RawSql.RawSql
@ -58,7 +58,7 @@ newtype QueryExpr
execution functions in "Orville.PostgreSQL.Execution" and
"Orville.PostgreSQL.Raw.RawSql".
@since 0.10.0.0
@since 1.0.0.0
-}
queryExpr :: SelectClause -> SelectList -> Maybe TableExpr -> QueryExpr
queryExpr querySelectClause selectList maybeTableExpr =
@ -88,7 +88,7 @@ in
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype SelectList = SelectList RawSql.RawSql
deriving (RawSql.SqlExpression)
@ -97,7 +97,7 @@ newtype SelectList = SelectList RawSql.RawSql
Constructs a 'SelectList' that will select all colums (i.e. the @*@ in
@SELECT *@").
@since 0.10.0.0
@since 1.0.0.0
-}
selectStar :: SelectList
selectStar =
@ -108,7 +108,7 @@ selectStar =
is a special case of 'selectDerivedColumns' where all the items to be
selected are simple column references.
@since 0.10.0.0
@since 1.0.0.0
-}
selectColumns :: [ColumnName] -> SelectList
selectColumns =
@ -123,7 +123,7 @@ Type to represent an individual item in a list of selected items. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype DerivedColumn = DerivedColumn RawSql.RawSql
deriving (RawSql.SqlExpression)
@ -133,7 +133,7 @@ newtype DerivedColumn = DerivedColumn RawSql.RawSql
column references or other expressions as allowed by 'DerivedColumn'. See
also 'selectColumns' the simpler case of selecting a list of column names.
@since 0.10.0.0
@since 1.0.0.0
-}
selectDerivedColumns :: [DerivedColumn] -> SelectList
selectDerivedColumns =
@ -144,7 +144,7 @@ selectDerivedColumns =
be given to the value in the result set. See 'deriveColumnAs' to give the
value a name in the result set.
@since 0.10.0.0
@since 1.0.0.0
-}
deriveColumn :: ValueExpression -> DerivedColumn
deriveColumn =
@ -154,7 +154,7 @@ deriveColumn =
Constructs a 'DerivedColumn' that will select the given value and give it
the specified column name in the result set.
@since 0.10.0.0
@since 1.0.0.0
-}
deriveColumnAs :: ValueExpression -> ColumnName -> DerivedColumn
deriveColumnAs valueExpr asColumn =
@ -178,7 +178,7 @@ Type to represent a table expression (including its associated options) in a
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype TableExpr
= TableExpr RawSql.RawSql
@ -187,7 +187,7 @@ newtype TableExpr
{- |
Constructs a 'TableExpr' with the given options.
@since 0.10.0.0
@since 1.0.0.0
-}
tableExpr ::
-- | The list of tables to query from

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Expr.ReturningExpr
( ReturningExpr
@ -25,7 +25,7 @@ Type to represent a @RETURNING@ clause in a SQL @SELECT@ statement. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype ReturningExpr
= ReturningExpr RawSql.RawSql
@ -35,7 +35,7 @@ newtype ReturningExpr
Constructs a 'ReturningExpr' that returns the items given in the
'SelectList'. Essentialy this retults @RETURNING <SelectList items>@
@since 0.10.0.0
@since 1.0.0.0
-}
returningExpr :: SelectList -> ReturningExpr
returningExpr selectList =

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Expr.Select
( SelectClause
@ -30,7 +30,7 @@ or
'SelectClause' provides a 'RawSql.SqlExpression' instance. See
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype SelectClause
= SelectClause RawSql.RawSql
@ -40,7 +40,7 @@ newtype SelectClause
Constructs a 'SelectClause' using the given 'SelectExpr', which may indicate
that this is a @DISTINCT@ select.
@since 0.10.0.0
@since 1.0.0.0
-}
selectClause :: SelectExpr -> SelectClause
selectClause expr = SelectClause (RawSql.fromString "SELECT " <> RawSql.toRawSql expr)
@ -53,7 +53,7 @@ Type to represent the any expression modifying the @SELECT@ part of a SQL. E.G.
'SelectExpr' provides a 'RawSql.SqlExpression' instance. See
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype SelectExpr = SelectExpr RawSql.RawSql
deriving (RawSql.SqlExpression)
@ -62,7 +62,7 @@ newtype SelectExpr = SelectExpr RawSql.RawSql
A simple value type used to indicate that a @SELECT@ should be distinct when
constructing a 'SelectExpr'
@since 0.10.0.0
@since 1.0.0.0
-}
data Distinct = Distinct
@ -70,7 +70,7 @@ data Distinct = Distinct
Constructs a 'SelectExpr' that may or may not make the @SELECT@ distinct,
dependending on whether 'Just Distinct' is passed or not.
@since 0.10.0.0
@since 1.0.0.0
-}
selectExpr :: Maybe Distinct -> SelectExpr
selectExpr mbDistinct =

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Expr.SequenceDefinition
( CreateSequenceExpr
@ -73,7 +73,7 @@ Type to represent a @CREATE SEQUENCE@ statement. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype CreateSequenceExpr
= CreateSequenceExpr RawSql.RawSql
@ -82,7 +82,7 @@ newtype CreateSequenceExpr
{- |
Constructs a 'CreateSequenceExpr' with the given sequence options.
@since 0.10.0.0
@since 1.0.0.0
-}
createSequenceExpr ::
-- | The name to be used for the sequence
@ -142,7 +142,7 @@ Type to represent a @CREATE SEQUENCE@ statement. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype AlterSequenceExpr
= AlterSequenceExpr RawSql.RawSql
@ -151,7 +151,7 @@ newtype AlterSequenceExpr
{- |
Constructs an 'AlterSequenceExpr' with the given sequence options.
@since 0.10.0.0
@since 1.0.0.0
-}
alterSequenceExpr ::
-- | The name of the sequence to alter
@ -192,7 +192,7 @@ Type to represent a @INCREMENT BY@ expression for sequences. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype IncrementByExpr
= IncrementByExpr RawSql.RawSql
@ -202,7 +202,7 @@ newtype IncrementByExpr
Constructs an 'IncrementByExpr' that will make the sequence increment by
the given value
@since 0.10.0.0
@since 1.0.0.0
-}
incrementBy :: Int64 -> IncrementByExpr
incrementBy n =
@ -219,7 +219,7 @@ Type to represent a @MINVALUE@ expression for sequences. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype MinValueExpr
= MinValueExpr RawSql.RawSql
@ -229,7 +229,7 @@ newtype MinValueExpr
Constructs an 'MinValueExpr' which gives the sequence the specified minimum
value
@since 0.10.0.0
@since 1.0.0.0
-}
minValue :: Int64 -> MinValueExpr
minValue n =
@ -241,7 +241,7 @@ minValue n =
Constructs an 'MinValueExpr' which gives the sequence no minimum value (i.e.
@NO MINVALUE@)
@since 0.10.0.0
@since 1.0.0.0
-}
noMinValue :: MinValueExpr
noMinValue =
@ -256,7 +256,7 @@ Type to represent a @MAXVALUE@ expression for sequences. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype MaxValueExpr
= MaxValueExpr RawSql.RawSql
@ -266,7 +266,7 @@ newtype MaxValueExpr
Constructs an 'maxValueExpr' which gives the sequence the specified maximum
value
@since 0.10.0.0
@since 1.0.0.0
-}
maxValue :: Int64 -> MaxValueExpr
maxValue n =
@ -278,7 +278,7 @@ maxValue n =
Constructs an 'MinValueExpr' which gives the sequence no maximum value (i.e.
@NO MAXVALUE@)
@since 0.10.0.0
@since 1.0.0.0
-}
noMaxValue :: MaxValueExpr
noMaxValue =
@ -293,7 +293,7 @@ Type to represent a @START WITH@ expression for sequences. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype StartWithExpr
= StartWithExpr RawSql.RawSql
@ -303,7 +303,7 @@ newtype StartWithExpr
Constructs a 'StartWithExpr' which gives the sequence the specified start
value
@since 0.10.0.0
@since 1.0.0.0
-}
startWith :: Int64 -> StartWithExpr
startWith n =
@ -320,7 +320,7 @@ Type to represent a @CACHE @ expression for sequences. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype CacheExpr
= CacheExpr RawSql.RawSql
@ -330,7 +330,7 @@ newtype CacheExpr
Constructs a 'CacheExpr' that will make the sequence pre-allocate the
specified number of sequence values.
@since 0.10.0.0
@since 1.0.0.0
-}
cache :: Int64 -> CacheExpr
cache n =
@ -351,7 +351,7 @@ or
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype CycleExpr
= CycleExpr RawSql.RawSql
@ -360,7 +360,7 @@ newtype CycleExpr
{- |
Constructs a 'CycleExpr' that indicate that the sequence should cycle.
@since 0.10.0.0
@since 1.0.0.0
-}
cycle :: CycleExpr
cycle = CycleExpr $ RawSql.fromString "CYCLE"
@ -368,7 +368,7 @@ cycle = CycleExpr $ RawSql.fromString "CYCLE"
{- |
Constructs a 'CycleExpr' that indicate that the sequence should not cycle.
@since 0.10.0.0
@since 1.0.0.0
-}
noCycle :: CycleExpr
noCycle = CycleExpr $ RawSql.fromString "NO CYCLE"
@ -377,7 +377,7 @@ noCycle = CycleExpr $ RawSql.fromString "NO CYCLE"
Constructs a 'CycleExpr' will cause the sequence to cycle if the flag passed
is 'True'.
@since 0.10.0.0
@since 1.0.0.0
-}
cycleIfTrue :: Bool -> CycleExpr
cycleIfTrue cycleFlag =
@ -394,7 +394,7 @@ Type to represent a @DROP SEQUENCE@ statement. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype DropSequenceExpr
= DropSequenceExpr RawSql.RawSql
@ -405,7 +405,7 @@ newtype DropSequenceExpr
You maybe specific an 'IfExists' argument if you want to include an @IF
EXISTS@ condition in the statement.
@since 0.10.0.0
@since 1.0.0.0
-}
dropSequenceExpr :: Maybe IfExists -> Qualified SequenceName -> DropSequenceExpr
dropSequenceExpr maybeIfExists sequenceName =
@ -426,7 +426,7 @@ dropSequenceExpr maybeIfExists sequenceName =
constructed 'ValueExpression' with 'Orville.PostgreSQL.Expr.deriveColumnAs'
to build the item to select.
@since 0.10.0.0
@since 1.0.0.0
-}
nextVal :: Qualified SequenceName -> ValueExpression
nextVal sequenceName =
@ -437,7 +437,7 @@ nextVal sequenceName =
{- |
The @nextval@ PostgreSQL function.
@since 0.10.0.0
@since 1.0.0.0
-}
nextValFunction :: FunctionName
nextValFunction =
@ -450,7 +450,7 @@ nextValFunction =
constructed 'ValueExpression' with 'Orville.PostgreSQL.Expr.deriveColumnAs'
to build the item to select.
@since 0.10.0.0
@since 1.0.0.0
-}
currVal :: Qualified SequenceName -> ValueExpression
currVal sequenceName =
@ -461,7 +461,7 @@ currVal sequenceName =
{- |
The @currval@ PostgreSQL function.
@since 0.10.0.0
@since 1.0.0.0
-}
currValFunction :: FunctionName
currValFunction =
@ -474,7 +474,7 @@ currValFunction =
'ValueExpression' with 'Orville.PostgreSQL.Expr.deriveColumnAs' to build the
item to select.
@since 0.10.0.0
@since 1.0.0.0
-}
setVal :: Qualified SequenceName -> Int64 -> ValueExpression
setVal sequenceName newValue =
@ -487,7 +487,7 @@ setVal sequenceName newValue =
{- |
The @setval@ PostgreSQL function.
@since 0.10.0.0
@since 1.0.0.0
-}
setValFunction :: FunctionName
setValFunction =

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Expr.TableConstraint
( TableConstraint
@ -42,7 +42,7 @@ Type to represent a table constraint that would be part of a @CREATE TABLE@ or
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype TableConstraint
= TableConstraint RawSql.RawSql
@ -52,7 +52,7 @@ newtype TableConstraint
Constructs a 'TableConstraint' will create a @UNIQUE@ constraint on the
given columns.
@since 0.10.0.0
@since 1.0.0.0
-}
uniqueConstraint :: NonEmpty ColumnName -> TableConstraint
uniqueConstraint columnNames =
@ -72,7 +72,7 @@ the @CASCADE@ in
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype ForeignKeyActionExpr
= ForeignKeyActionExpr RawSql.RawSql
@ -81,7 +81,7 @@ newtype ForeignKeyActionExpr
{- |
The foreign key action @RESTRICT@.
@since 0.10.0.0
@since 1.0.0.0
-}
restrictExpr :: ForeignKeyActionExpr
restrictExpr = ForeignKeyActionExpr $ RawSql.fromString "RESTRICT"
@ -89,7 +89,7 @@ restrictExpr = ForeignKeyActionExpr $ RawSql.fromString "RESTRICT"
{- |
The foreign key action @CASCADE@.
@since 0.10.0.0
@since 1.0.0.0
-}
cascadeExpr :: ForeignKeyActionExpr
cascadeExpr = ForeignKeyActionExpr $ RawSql.fromString "CASCADE"
@ -97,7 +97,7 @@ cascadeExpr = ForeignKeyActionExpr $ RawSql.fromString "CASCADE"
{- |
The foreign key action @SET NULL@.
@since 0.10.0.0
@since 1.0.0.0
-}
setNullExpr :: ForeignKeyActionExpr
setNullExpr = ForeignKeyActionExpr $ RawSql.fromString "SET NULL"
@ -105,7 +105,7 @@ setNullExpr = ForeignKeyActionExpr $ RawSql.fromString "SET NULL"
{- |
The foreign key action @SET DEFAULT@.
@since 0.10.0.0
@since 1.0.0.0
-}
setDefaultExpr :: ForeignKeyActionExpr
setDefaultExpr = ForeignKeyActionExpr $ RawSql.fromString "SET DEFAULT"
@ -120,7 +120,7 @@ the @ON UPDATE RESTRICT@ in
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype ForeignKeyUpdateActionExpr
= ForeignKeyUpdateActionExpr RawSql.RawSql
@ -130,7 +130,7 @@ newtype ForeignKeyUpdateActionExpr
Constructs a 'ForeignKeyActionExpr' that use the given 'ForeignKeyActionExpr'
in an @ON UPDATE@ clause for a foreign key.
@since 0.10.0.0
@since 1.0.0.0
-}
foreignKeyUpdateActionExpr :: ForeignKeyActionExpr -> ForeignKeyUpdateActionExpr
foreignKeyUpdateActionExpr action =
@ -149,7 +149,7 @@ the @ON DELETE RESTRICT@ in
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype ForeignKeyDeleteActionExpr
= ForeignKeyDeleteActionExpr RawSql.RawSql
@ -159,7 +159,7 @@ newtype ForeignKeyDeleteActionExpr
Constructs a 'ForeignKeyActionExpr' that use the given 'ForeignKeyActionExpr'
in an @ON UPDATE@ clause for a foreign key.
@since 0.10.0.0
@since 1.0.0.0
-}
foreignKeyDeleteActionExpr :: ForeignKeyActionExpr -> ForeignKeyDeleteActionExpr
foreignKeyDeleteActionExpr action =
@ -171,7 +171,7 @@ foreignKeyDeleteActionExpr action =
{- |
Constructs a 'TableConstraint' that represent a @FOREIGN KEY@ constraint
@since 0.10.0.0
@since 1.0.0.0
-}
foreignKeyConstraint ::
-- | The names of the columns in the source table that form the foreign key

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Expr.TableDefinition
( CreateTableExpr
@ -52,7 +52,7 @@ Type to represent a @CREATE TABLE@ statement. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype CreateTableExpr
= CreateTableExpr RawSql.RawSql
@ -61,7 +61,7 @@ newtype CreateTableExpr
{- |
Constructs a 'CreateTableExpr' with the given options.
@since 0.10.0.0
@since 1.0.0.0
-}
createTableExpr ::
-- | The name to be use for the table
@ -107,7 +107,7 @@ Type to represent a the primary key of a table. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype PrimaryKeyExpr
= PrimaryKeyExpr RawSql.RawSql
@ -116,7 +116,7 @@ newtype PrimaryKeyExpr
{- |
Constructs a 'PrimaryKeyExpr' with the given columns
@since 0.10.0.0
@since 1.0.0.0
-}
primaryKeyExpr :: NonEmpty ColumnName -> PrimaryKeyExpr
primaryKeyExpr columnNames =
@ -137,7 +137,7 @@ Type to represent a @ALTER TABLE@ statement. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype AlterTableExpr
= AlterTableExpr RawSql.RawSql
@ -146,7 +146,7 @@ newtype AlterTableExpr
{- |
Constructs an 'AlterTableExpr' with the given alter table actions.
@since 0.10.0.0
@since 1.0.0.0
-}
alterTableExpr :: Qualified TableName -> NonEmpty AlterTableAction -> AlterTableExpr
alterTableExpr tableName actions =
@ -165,7 +165,7 @@ Type to represent an action as part of an @ALTER TABLE@ statement. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype AlterTableAction
= AlterTableAction RawSql.RawSql
@ -175,7 +175,7 @@ newtype AlterTableAction
Constructs an 'AlterTableAction' that will add the specified column to the
table.
@since 0.10.0.0
@since 1.0.0.0
-}
addColumn :: ColumnDefinition -> AlterTableAction
addColumn columnDef =
@ -186,7 +186,7 @@ addColumn columnDef =
Constructs an 'AlterTableAction' that will drop the specified column from the
table.
@since 0.10.0.0
@since 1.0.0.0
-}
dropColumn :: ColumnName -> AlterTableAction
dropColumn columnName =
@ -197,7 +197,7 @@ dropColumn columnName =
Constructs an 'AlterTableAction' that will add the specified constraint to the
table.
@since 0.10.0.0
@since 1.0.0.0
-}
addConstraint :: TableConstraint -> AlterTableAction
addConstraint constraint =
@ -208,7 +208,7 @@ addConstraint constraint =
Constructs an 'AlterTableAction' that will drop the specified constraint from the
table.
@since 0.10.0.0
@since 1.0.0.0
-}
dropConstraint :: ConstraintName -> AlterTableAction
dropConstraint constraintName =
@ -219,7 +219,7 @@ dropConstraint constraintName =
Constructs an 'AlterTableAction' that will alter the type of the specified
column.
@since 0.10.0.0
@since 1.0.0.0
-}
alterColumnType ::
-- | The name of the column whose type willbe altered
@ -251,7 +251,7 @@ the type of a column. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype UsingClause
= UsingClause RawSql.RawSql
@ -260,7 +260,7 @@ newtype UsingClause
{- |
Constructs a 'UsingClause' that will cast the column to the specified type.
@since 0.10.0.0
@since 1.0.0.0
-}
usingCast :: ColumnName -> DataType -> UsingClause
usingCast columnName dataType =
@ -274,7 +274,7 @@ usingCast columnName dataType =
Constructs an 'AlterTableAction' that will alter the nullability of the
column.
@since 0.10.0.0
@since 1.0.0.0
-}
alterColumnNullability :: ColumnName -> AlterNotNull -> AlterTableAction
alterColumnNullability columnName alterNotNull =
@ -295,7 +295,7 @@ Type to represent an action to alter the nullability of a column. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype AlterNotNull
= AlterNotNull RawSql.RawSql
@ -304,7 +304,7 @@ newtype AlterNotNull
{- |
Sets the column to not null via @SET NOT NULL@
@since 0.10.0.0
@since 1.0.0.0
-}
setNotNull :: AlterNotNull
setNotNull =
@ -313,7 +313,7 @@ setNotNull =
{- |
Sets the column to allow null via @DROP NOT NULL@
@since 0.10.0.0
@since 1.0.0.0
-}
dropNotNull :: AlterNotNull
dropNotNull =
@ -323,7 +323,7 @@ dropNotNull =
Constructs an 'AlterTableAction' that will use @DROP DEFAULT@ to drop the
default value of the specified column.
@since 0.10.0.0
@since 1.0.0.0
-}
alterColumnDropDefault :: ColumnName -> AlterTableAction
alterColumnDropDefault columnName =
@ -339,7 +339,7 @@ alterColumnDropDefault columnName =
Constructs an 'AlterTableAction' that will use @SET DEFAULT@ to set the
default value of the specified column.
@since 0.10.0.0
@since 1.0.0.0
-}
alterColumnSetDefault ::
RawSql.SqlExpression valueExpression =>
@ -365,7 +365,7 @@ Type to represent a @DROP TABLE@ statement. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype DropTableExpr
= DropTableExpr RawSql.RawSql
@ -374,7 +374,7 @@ newtype DropTableExpr
{- |
Constructs an 'DropTableExpr' that will drop the specified table.
@since 0.10.0.0
@since 1.0.0.0
-}
dropTableExpr :: Maybe IfExists -> Qualified TableName -> DropTableExpr
dropTableExpr maybeIfExists tableName =

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Expr.TableReferenceList
( TableReferenceList
@ -30,7 +30,7 @@ in
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype TableReferenceList
= TableReferenceList RawSql.RawSql
@ -40,7 +40,7 @@ newtype TableReferenceList
Constructs a 'TableReferenceList' consisting of just the specified table
name.
@since 0.10.0.0
@since 1.0.0.0
-}
referencesTable :: Qualified TableName -> TableReferenceList
referencesTable qualifiedTableName =

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Expr.Time
( now
@ -28,7 +28,7 @@ import qualified Orville.PostgreSQL.Raw.RawSql as RawSql
{- |
The value of the current time as returned by the PostgreSQL function @now()@.
@since 0.10.0.0
@since 1.0.0.0
-}
now :: ValueExpression
now = functionCall (functionName "now") []
@ -38,7 +38,7 @@ now = functionCall (functionName "now") []
calling @make_interval@ with the specified time intervals passed as named
arguments.
@since 0.10.0.0
@since 1.0.0.0
-}
makeInterval :: [(IntervalArgument, ValueExpression)] -> ValueExpression
makeInterval args =
@ -56,7 +56,7 @@ Type to represent the name of a time interval argument to the PostgreSQL
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype IntervalArgument
= IntervalArgument ParameterName
@ -66,7 +66,7 @@ newtype IntervalArgument
Constructs an arbitrary 'IntervalArgument' with whatever name you specify. It
is up to you to ensure that name a valid argument name for @make_interval@.
@since 0.10.0.0
@since 1.0.0.0
-}
unsafeIntervalArg :: String -> IntervalArgument
unsafeIntervalArg =
@ -75,7 +75,7 @@ unsafeIntervalArg =
{- |
The @years@ argument to @make_interval@.
@since 0.10.0.0
@since 1.0.0.0
-}
years :: IntervalArgument
years = unsafeIntervalArg "years"
@ -83,7 +83,7 @@ years = unsafeIntervalArg "years"
{- |
The @months@ argument to @make_interval@.
@since 0.10.0.0
@since 1.0.0.0
-}
months :: IntervalArgument
months = unsafeIntervalArg "months"
@ -91,7 +91,7 @@ months = unsafeIntervalArg "months"
{- |
The @weeks@ argument to @make_interval@.
@since 0.10.0.0
@since 1.0.0.0
-}
weeks :: IntervalArgument
weeks = unsafeIntervalArg "weeks"
@ -99,7 +99,7 @@ weeks = unsafeIntervalArg "weeks"
{- |
The @days@ argument to @make_interval@.
@since 0.10.0.0
@since 1.0.0.0
-}
days :: IntervalArgument
days = unsafeIntervalArg "days"
@ -107,7 +107,7 @@ days = unsafeIntervalArg "days"
{- |
The @hours@ argument to @make_interval@.
@since 0.10.0.0
@since 1.0.0.0
-}
hours :: IntervalArgument
hours = unsafeIntervalArg "hours"
@ -115,7 +115,7 @@ hours = unsafeIntervalArg "hours"
{- |
The @mins@ argument to @make_interval@.
@since 0.10.0.0
@since 1.0.0.0
-}
minutes :: IntervalArgument
minutes = unsafeIntervalArg "mins"
@ -123,7 +123,7 @@ minutes = unsafeIntervalArg "mins"
{- |
The @secs@ argument to @make_interval@.
@since 0.10.0.0
@since 1.0.0.0
-}
seconds :: IntervalArgument
seconds = unsafeIntervalArg "secs"

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Expr.Transaction
( BeginTransactionExpr
@ -47,7 +47,7 @@ Type to represent the name of a begin transaction statement. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype BeginTransactionExpr
= BeginTransactionExpr RawSql.RawSql
@ -57,7 +57,7 @@ newtype BeginTransactionExpr
Constructs a 'BeginTransactionExpr' that will begin a transaction using
the specified mode, if any.
@since 0.10.0.0
@since 1.0.0.0
-}
beginTransaction :: Maybe TransactionMode -> BeginTransactionExpr
beginTransaction maybeTransactionMode =
@ -76,7 +76,7 @@ Type to represent the a transaction mode. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype TransactionMode
= TransactionMode RawSql.RawSql
@ -85,7 +85,7 @@ newtype TransactionMode
{- |
The @READ WRITE@ transaction mode.
@since 0.10.0.0
@since 1.0.0.0
-}
readWrite :: TransactionMode
readWrite =
@ -94,7 +94,7 @@ readWrite =
{- |
The @READ ONLY@ transaction mode.
@since 0.10.0.0
@since 1.0.0.0
-}
readOnly :: TransactionMode
readOnly =
@ -103,7 +103,7 @@ readOnly =
{- |
The @DEFERRABLE@ transaction mode.
@since 0.10.0.0
@since 1.0.0.0
-}
deferrable :: TransactionMode
deferrable =
@ -112,7 +112,7 @@ deferrable =
{- |
The @NOT DEFERRABLE@ transaction mode.
@since 0.10.0.0
@since 1.0.0.0
-}
notDeferrable :: TransactionMode
notDeferrable =
@ -121,7 +121,7 @@ notDeferrable =
{- |
An @ISOLATION LEVEL@ transaction mode with the given 'IsolationLevel'.
@since 0.10.0.0
@since 1.0.0.0
-}
isolationLevel :: IsolationLevel -> TransactionMode
isolationLevel level =
@ -137,7 +137,7 @@ Type to represent the a transaction isolation level. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype IsolationLevel
= IsolationLevel RawSql.RawSql
@ -146,7 +146,7 @@ newtype IsolationLevel
{- |
The @SERIALIZABLE@ isolation level.
@since 0.10.0.0
@since 1.0.0.0
-}
serializable :: IsolationLevel
serializable =
@ -155,7 +155,7 @@ serializable =
{- |
The @REPEATABLE READ@ isolation level.
@since 0.10.0.0
@since 1.0.0.0
-}
repeatableRead :: IsolationLevel
repeatableRead =
@ -164,7 +164,7 @@ repeatableRead =
{- |
The @READ COMMITTED@ isolation level.
@since 0.10.0.0
@since 1.0.0.0
-}
readCommitted :: IsolationLevel
readCommitted =
@ -173,7 +173,7 @@ readCommitted =
{- |
The @READ UNCOMMITTED@ isolation level.
@since 0.10.0.0
@since 1.0.0.0
-}
readUncommitted :: IsolationLevel
readUncommitted =
@ -188,7 +188,7 @@ Type to represent the transaction commit statement. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype CommitExpr
= CommitExpr RawSql.RawSql
@ -197,7 +197,7 @@ newtype CommitExpr
{- |
A @COMMIT@ transaction statement
@since 0.10.0.0
@since 1.0.0.0
-}
commit :: CommitExpr
commit =
@ -212,7 +212,7 @@ Type to represent the transaction rollback statement. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype RollbackExpr
= RollbackExpr RawSql.RawSql
@ -221,7 +221,7 @@ newtype RollbackExpr
{- |
A @ROLLBACK@ transaction statement
@since 0.10.0.0
@since 1.0.0.0
-}
rollback :: RollbackExpr
rollback =
@ -231,7 +231,7 @@ rollback =
A @ROLLBACK TO@ transaction statement that will rollback to the specified
savepoint.
@since 0.10.0.0
@since 1.0.0.0
-}
rollbackTo :: Name.SavepointName -> RollbackExpr
rollbackTo savepointName =
@ -247,7 +247,7 @@ Type to represent the transaction savepoint statement. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype SavepointExpr
= SavepointExpr RawSql.RawSql
@ -256,7 +256,7 @@ newtype SavepointExpr
{- |
A @SAVEPOINT@ statement that will create a savepoint with the given name.
@since 0.10.0.0
@since 1.0.0.0
-}
savepoint :: Name.SavepointName -> SavepointExpr
savepoint savepointName =
@ -272,7 +272,7 @@ Type to represent the transaction release savepoint statement. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype ReleaseSavepointExpr
= ReleaseSavepontExpr RawSql.RawSql
@ -281,7 +281,7 @@ newtype ReleaseSavepointExpr
{- |
A @RELEASE SAVEPOINT@ statement that will release the specified savepoint.
@since 0.10.0.0
@since 1.0.0.0
-}
releaseSavepoint :: Name.SavepointName -> ReleaseSavepointExpr
releaseSavepoint savepointName =

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Expr.Update
( UpdateExpr
@ -37,7 +37,7 @@ Type to represent the transaction a SQL @UPDATE@ statement. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype UpdateExpr
= UpdateExpr RawSql.RawSql
@ -46,7 +46,7 @@ newtype UpdateExpr
{- |
Constructs an 'UpdateExpr' with the given options.
@since 0.10.0.0
@since 1.0.0.0
-}
updateExpr ::
-- | The name of the table to be updated
@ -80,7 +80,7 @@ Type to represent the list of updates to be made in a @UPDATE@ statament. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype SetClauseList
= SetClauseList RawSql.RawSql
@ -89,7 +89,7 @@ newtype SetClauseList
{- |
Constructs a 'SetClauseList' with the specified set clauses
@since 0.10.0.0
@since 1.0.0.0
-}
setClauseList :: NonEmpty SetClause -> SetClauseList
setClauseList =
@ -104,7 +104,7 @@ Type to represent a single updates to be made in a @UPDATE@ statament. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype SetClause
= SetClause RawSql.RawSql
@ -114,7 +114,7 @@ newtype SetClause
Constructs a 'SetClause' that will set the specified column to the specified
value.
@since 0.10.0.0
@since 1.0.0.0
-}
setColumn :: ColumnName -> SqlValue.SqlValue -> SetClause
setColumn columnName value =

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Expr.ValueExpression
( ValueExpression
@ -37,7 +37,7 @@ E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype ValueExpression = ValueExpression RawSql.RawSql
deriving (RawSql.SqlExpression)
@ -48,7 +48,7 @@ E.G.
> foo :: integer
@since 0.10.0.0
@since 1.0.0.0
-}
cast :: ValueExpression -> DataType -> ValueExpression
cast value dataType =
@ -63,7 +63,7 @@ is the equivalent of simply writing the column name as the expression. E.G.
> foo
@since 0.10.0.0
@since 1.0.0.0
-}
columnReference :: ColumnName -> ValueExpression
columnReference = ValueExpression . RawSql.toRawSql
@ -75,7 +75,7 @@ columnReference = ValueExpression . RawSql.toRawSql
where PostgreSQL does not support values passed as paremeters where this
cannot be used.
@since 0.10.0.0
@since 1.0.0.0
-}
valueExpression :: SqlValue -> ValueExpression
valueExpression = ValueExpression . RawSql.parameter
@ -86,7 +86,7 @@ expressions. E.G.
> (foo, bar, now())
@since 0.10.0.0
@since 1.0.0.0
-}
rowValueConstructor :: NE.NonEmpty ValueExpression -> ValueExpression
rowValueConstructor elements =
@ -101,7 +101,7 @@ function with the given arguments passed as position parameters. E.G.
> nextval(sequence_name)
@since 0.10.0.0
@since 1.0.0.0
-}
functionCall :: FunctionName -> [ValueExpression] -> ValueExpression
functionCall functionName parameters =
@ -125,7 +125,7 @@ in
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype ParameterName = ParameterName RawSql.RawSql
deriving (RawSql.SqlExpression)
@ -136,7 +136,7 @@ function with the given arguments passed as named parameters. E.G.
> make_interval(years => 1)
@since 0.10.0.0
@since 1.0.0.0
-}
functionCallNamedParams :: FunctionName -> [(ParameterName, ValueExpression)] -> ValueExpression
functionCallNamedParams functionName parameters =
@ -150,7 +150,7 @@ functionCallNamedParams functionName parameters =
Constructs a sql fragment that will pass the given named argument with the
specified value.
@since 0.10.0.0
@since 1.0.0.0
-}
namedParameterArgument :: ParameterName -> ValueExpression -> RawSql.RawSql
namedParameterArgument name value =

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Expr.WhereClause
( WhereClause
@ -54,7 +54,7 @@ Type to represent a @WHERE@ clause restriction an a @SELECT@, @UPDATE@ or
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype WhereClause
= WhereClause RawSql.RawSql
@ -65,7 +65,7 @@ Constructs a 'WHERE' clause from the given 'BooleanExpr'. E.G.
> WHERE <boolean expr>
@since 0.10.0.0
@since 1.0.0.0
-}
whereClause :: BooleanExpr -> WhereClause
whereClause booleanExpr =
@ -82,7 +82,7 @@ can used with boolean logic functions. E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype BooleanExpr
= BooleanExpr RawSql.RawSql
@ -92,7 +92,7 @@ newtype BooleanExpr
Constructs a 'BooleanExpr' whose value the SQL literal @TRUE@ or @FALSE@
depending on the argument given.
@since 0.10.0.0
@since 1.0.0.0
-}
literalBooleanExpr :: Bool -> BooleanExpr
literalBooleanExpr bool =
@ -105,7 +105,7 @@ literalBooleanExpr bool =
Converts a 'BooleanExpr' to a 'ValueExpression' so that it can be used
anywhere 'ValueExpression' is allowed.
@since 0.10.0.0
@since 1.0.0.0
-}
booleanValueExpression :: BooleanExpr -> ValueExpression
booleanValueExpression (BooleanExpr rawSql) =
@ -116,7 +116,7 @@ booleanValueExpression (BooleanExpr rawSql) =
to ensure that the associativity of expression in the resulting SQL matches
the associtivity implied by this Haskell function.
@since 0.10.0.0
@since 1.0.0.0
-}
orExpr :: BooleanExpr -> BooleanExpr -> BooleanExpr
orExpr left right =
@ -128,7 +128,7 @@ orExpr left right =
{- |
The SQL @OR@ operator (alias for 'orExpr')
@since 0.10.0.0
@since 1.0.0.0
-}
(.||) :: BooleanExpr -> BooleanExpr -> BooleanExpr
(.||) = orExpr
@ -140,7 +140,7 @@ infixr 8 .||
to ensure that the associativity of expression in the resulting SQL matches
the associtivity implied by this Haskell function.
@since 0.10.0.0
@since 1.0.0.0
-}
andExpr :: BooleanExpr -> BooleanExpr -> BooleanExpr
andExpr left right =
@ -152,7 +152,7 @@ andExpr left right =
{- |
The SQL @AND@ operator (alias for 'andExpr')
@since 0.10.0.0
@since 1.0.0.0
-}
(.&&) :: BooleanExpr -> BooleanExpr -> BooleanExpr
(.&&) = andExpr
@ -163,7 +163,7 @@ infixr 8 .&&
The SQL @IN@ operator. The result will be @TRUE@ if the given value
appears in the list of values given.
@since 0.10.0.0
@since 1.0.0.0
-}
valueIn :: ValueExpression -> NE.NonEmpty ValueExpression -> BooleanExpr
valueIn needle haystack =
@ -173,7 +173,7 @@ valueIn needle haystack =
The SQL @IN@ operator. The result will be @TRUE@ if the given value
does not appear in the list of values given.
@since 0.10.0.0
@since 1.0.0.0
-}
valueNotIn :: ValueExpression -> NE.NonEmpty ValueExpression -> BooleanExpr
valueNotIn needle haystack =
@ -184,7 +184,7 @@ valueNotIn needle haystack =
tuple in SQL and check if it is in a list of tuples. It is up to the caller
to ensure that all the tuples given have the same arity.
@since 0.10.0.0
@since 1.0.0.0
-}
tupleIn :: NE.NonEmpty ValueExpression -> NE.NonEmpty (NE.NonEmpty ValueExpression) -> BooleanExpr
tupleIn needle haystack =
@ -197,7 +197,7 @@ tupleIn needle haystack =
construct a tuple in SQL and check if it is not in a list of tuples. It is up
to the caller to ensure that all the tuples given have the same arity.
@since 0.10.0.0
@since 1.0.0.0
-}
tupleNotIn :: NE.NonEmpty ValueExpression -> NE.NonEmpty (NE.NonEmpty ValueExpression) -> BooleanExpr
tupleNotIn needle haystack =
@ -210,7 +210,7 @@ tupleNotIn needle haystack =
'ValueExpression' and 'InValuePredicate'. It is up to the caller to ensure
the expressions given makes sense together.
@since 0.10.0.0
@since 1.0.0.0
-}
inPredicate :: ValueExpression -> InValuePredicate -> BooleanExpr
inPredicate predicand predicate =
@ -224,7 +224,7 @@ inPredicate predicand predicate =
'ValueExpression' and 'InValuePredicate'. It is up to the caller to ensure
the expressions given makes sense together.
@since 0.10.0.0
@since 1.0.0.0
-}
notInPredicate :: ValueExpression -> InValuePredicate -> BooleanExpr
notInPredicate predicand predicate =
@ -243,7 +243,7 @@ E.G.
'RawSql.unsafeSqlExpression' for how to construct a value with your own custom
SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype InValuePredicate
= InValuePredicate RawSql.RawSql
@ -252,7 +252,7 @@ newtype InValuePredicate
{- |
Constructs an 'InValuePredicate' from the given list of 'ValueExpression'
@since 0.10.0.0
@since 1.0.0.0
-}
inValueList :: NE.NonEmpty ValueExpression -> InValuePredicate
inValueList values =
@ -264,7 +264,7 @@ inValueList values =
{- |
Surrounds the given 'BooleanExpr' with parentheses.
@since 0.10.0.0
@since 1.0.0.0
-}
parenthesized :: BooleanExpr -> BooleanExpr
parenthesized expr =
@ -274,7 +274,7 @@ parenthesized expr =
{- |
The SQL @=@ operator.
@since 0.10.0.0
@since 1.0.0.0
-}
equals :: ValueExpression -> ValueExpression -> BooleanExpr
equals =
@ -283,7 +283,7 @@ equals =
{- |
The SQL @<>@ operator.
@since 0.10.0.0
@since 1.0.0.0
-}
notEquals :: ValueExpression -> ValueExpression -> BooleanExpr
notEquals =
@ -292,7 +292,7 @@ notEquals =
{- |
The SQL @>@ operator.
@since 0.10.0.0
@since 1.0.0.0
-}
greaterThan :: ValueExpression -> ValueExpression -> BooleanExpr
greaterThan =
@ -301,7 +301,7 @@ greaterThan =
{- |
The SQL @<@ operator.
@since 0.10.0.0
@since 1.0.0.0
-}
lessThan :: ValueExpression -> ValueExpression -> BooleanExpr
lessThan =
@ -310,7 +310,7 @@ lessThan =
{- |
The SQL @>=@ operator.
@since 0.10.0.0
@since 1.0.0.0
-}
greaterThanOrEqualTo :: ValueExpression -> ValueExpression -> BooleanExpr
greaterThanOrEqualTo =
@ -319,7 +319,7 @@ greaterThanOrEqualTo =
{- |
The SQL @<=@ operator.
@since 0.10.0.0
@since 1.0.0.0
-}
lessThanOrEqualTo :: ValueExpression -> ValueExpression -> BooleanExpr
lessThanOrEqualTo =
@ -328,7 +328,7 @@ lessThanOrEqualTo =
{- |
The SQL @LIKE@ operator.
@since 0.10.0.0
@since 1.0.0.0
-}
like :: ValueExpression -> ValueExpression -> BooleanExpr
like =
@ -337,7 +337,7 @@ like =
{- |
The SQL @ILIKE@ operator.
@since 0.10.0.0
@since 1.0.0.0
-}
likeInsensitive :: ValueExpression -> ValueExpression -> BooleanExpr
likeInsensitive =
@ -346,7 +346,7 @@ likeInsensitive =
{- |
The SQL @IS NULL@ condition.
@since 0.10.0.0
@since 1.0.0.0
-}
isNull :: ValueExpression -> BooleanExpr
isNull value =
@ -358,7 +358,7 @@ isNull value =
{- |
The SQL @IS NOT NULL@ condition.
@since 0.10.0.0
@since 1.0.0.0
-}
isNotNull :: ValueExpression -> BooleanExpr
isNotNull value =

View File

@ -3,7 +3,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Internal.Bracket
( bracketWithResult
@ -27,7 +27,7 @@ data BracketResult
our exception handling semantics without forcing the Orville user's choice of
library for lifting and unlift IO actions (e.g. UnliftIO).
@since 0.10.0.0
@since 1.0.0.0
-}
bracketWithResult ::
(MonadIO m, MonadOrvilleControl m) =>
@ -54,7 +54,7 @@ bracketWithResult acquire release action = do
exception. This is mostly useful to force the exception being caught to be of
the type 'SomeException'.
@since 0.10.0.0
@since 1.0.0.0
-}
handleAndRethrow ::
MonadIO m =>

View File

@ -3,7 +3,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Internal.Extra.NonEmpty
( foldl1'

View File

@ -3,7 +3,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Internal.FieldName
( FieldName
@ -21,7 +21,7 @@ import qualified Orville.PostgreSQL.Expr as Expr
{- |
A simple type to represent the name of a field.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype FieldName
= FieldName B8.ByteString
@ -31,7 +31,7 @@ newtype FieldName
Convert a field name to an 'Expr.ColumnName' for usage in SQL expressions.
The field name will be properly quoted and escaped.
@since 0.10.0.0
@since 1.0.0.0
-}
fieldNameToColumnName :: FieldName -> Expr.ColumnName
fieldNameToColumnName (FieldName name) =
@ -40,7 +40,7 @@ fieldNameToColumnName (FieldName name) =
{- |
Constructs a 'FieldName' from a 'String'
@since 0.10.0.0
@since 1.0.0.0
-}
stringToFieldName :: String -> FieldName
stringToFieldName =
@ -49,7 +49,7 @@ stringToFieldName =
{- |
Converts a 'FieldName' back to a 'String'
@since 0.10.0.0
@since 1.0.0.0
-}
fieldNameToString :: FieldName -> String
fieldNameToString =
@ -58,7 +58,7 @@ fieldNameToString =
{- |
Converts a 'FieldName' back to a 'B8.ByteString'
@since 0.10.0.0
@since 1.0.0.0
-}
fieldNameToByteString :: FieldName -> B8.ByteString
fieldNameToByteString (FieldName name) =
@ -67,7 +67,7 @@ fieldNameToByteString (FieldName name) =
{- |
Constructs a 'FieldName' from a 'B8.ByteString'
@since 0.10.0.0
@since 1.0.0.0
-}
byteStringToFieldName :: B8.ByteString -> FieldName
byteStringToFieldName = FieldName

View File

@ -3,7 +3,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Internal.IndexDefinition
( IndexDefinition
@ -37,7 +37,7 @@ import qualified Orville.PostgreSQL.Marshall.FieldDefinition as FieldDefinition
'Orville.PostgreSQL.addTableIndexes'. to add them to your table definition.
Orville will then add the index next time you run auto-migrations.
@since 0.10.0.0
@since 1.0.0.0
-}
data IndexDefinition = IndexDefinition
{ i_indexCreateExpr ::
@ -55,7 +55,7 @@ data IndexDefinition = IndexDefinition
be feasible. See the 'Asynchronous' creation strategy for how to work around
this.
@since 0.10.0.0
@since 1.0.0.0
-}
setIndexCreationStrategy ::
IndexCreationStrategy ->
@ -71,7 +71,7 @@ setIndexCreationStrategy strategy indexDef =
described by the 'IndexDefinition'. By default all indexes are created using
the 'Transactional' strategy.
@since 0.10.0.0
@since 1.0.0.0
-}
indexCreationStrategy ::
IndexDefinition ->
@ -83,7 +83,7 @@ indexCreationStrategy =
Defines how an 'IndexDefinition' will be execute to add an index to a table.
By default all indexes a created via the 'Transactional'
@since 0.10.0.0
@since 1.0.0.0
-}
data IndexCreationStrategy
= -- |
@ -116,7 +116,7 @@ data IndexCreationStrategy
the constructor functions that build an 'IndexDefinition' will create this
automatically for you.
@since 0.10.0.0
@since 1.0.0.0
-}
data IndexMigrationKey
= AttributeBasedIndexKey AttributeBasedIndexMigrationKey
@ -129,7 +129,7 @@ data IndexMigrationKey
index structure it wants to create. If no matching index is found it will
create a new index.
@since 0.10.0.0
@since 1.0.0.0
-}
data AttributeBasedIndexMigrationKey = AttributeBasedIndexMigrationKey
{ indexKeyUniqueness :: Expr.IndexUniqueness
@ -146,14 +146,14 @@ data AttributeBasedIndexMigrationKey = AttributeBasedIndexMigrationKey
where Orville is not able to do an accurate structural comparison of the
desired index structure against the existing indexes.
@since 0.10.0.0
@since 1.0.0.0
-}
type NamedIndexMigrationKey = String
{- |
Gets the 'IndexMigrationKey' for the 'IndexDefinition'
@since 0.10.0.0
@since 1.0.0.0
-}
indexMigrationKey :: IndexDefinition -> IndexMigrationKey
indexMigrationKey = i_indexMigrationKey
@ -162,7 +162,7 @@ indexMigrationKey = i_indexMigrationKey
Gets the SQL expression that will be used to add the index to the specified
table.
@since 0.10.0.0
@since 1.0.0.0
-}
indexCreateExpr :: IndexDefinition -> Expr.Qualified Expr.TableName -> Expr.CreateIndexExpr
indexCreateExpr indexDef =
@ -174,7 +174,7 @@ indexCreateExpr indexDef =
Constructs an 'IndexDefinition' for a non-unique index on the given
columns
@since 0.10.0.0
@since 1.0.0.0
-}
nonUniqueIndex :: NonEmpty FieldDefinition.FieldName -> IndexDefinition
nonUniqueIndex =
@ -184,7 +184,7 @@ nonUniqueIndex =
Constructs an 'IndexDefinition' for a non-unique index with given SQL and
index name
@since 0.10.0.0
@since 1.0.0.0
-}
nonUniqueNamedIndex :: String -> Expr.IndexBodyExpr -> IndexDefinition
nonUniqueNamedIndex =
@ -194,7 +194,7 @@ nonUniqueNamedIndex =
Constructs an 'IndexDefinition' for a @UNIQUE@ index on the given
columns.
@since 0.10.0.0
@since 1.0.0.0
-}
uniqueIndex :: NonEmpty FieldDefinition.FieldName -> IndexDefinition
uniqueIndex =
@ -204,7 +204,7 @@ uniqueIndex =
Constructs an 'IndexDefinition' for a @UNIQUE@ index on the given
columns.
@since 0.10.0.0
@since 1.0.0.0
-}
uniqueNamedIndex :: String -> Expr.IndexBodyExpr -> IndexDefinition
uniqueNamedIndex =
@ -214,7 +214,7 @@ uniqueNamedIndex =
Constructs an 'IndexDefinition' for an index on the given columns with the
given uniquness.
@since 0.10.0.0
@since 1.0.0.0
-}
mkIndexDefinition ::
Expr.IndexUniqueness ->
@ -245,7 +245,7 @@ mkIndexDefinition uniqueness fieldNames =
Constructs an 'IndexDefinition' for an index with the given uniqueness, given
name, and given SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
mkNamedIndexDefinition ::
Expr.IndexUniqueness ->
@ -272,7 +272,7 @@ mkNamedIndexDefinition uniqueness indexName bodyExpr =
Internal helper to determine whether @CONCURRENTLY@ should be included in
the SQL to create the index.
@since 0.10.0.0
@since 1.0.0.0
-}
mkMaybeConcurrently :: IndexCreationStrategy -> Maybe Expr.ConcurrentlyExpr
mkMaybeConcurrently strategy =

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Internal.MigrationLock
( withMigrationLock
@ -31,7 +31,7 @@ import qualified Orville.PostgreSQL.Raw.SqlValue as SqlValue
indicates to other Orville processes that a database migration is being done
an no others should be performed concurrently.
@since 0.10.0.0
@since 1.0.0.0
-}
withMigrationLock :: Monad.MonadOrville m => m a -> m a
withMigrationLock action =
@ -110,7 +110,7 @@ releaseLockExpr =
Raised if 'withMigrationLock' cannot acquire the migration lock in a
timely manner.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype MigrationLockError
= MigrationLockError String

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Internal.OrvilleState
( OrvilleState
@ -54,7 +54,7 @@ import qualified Orville.PostgreSQL.Raw.SqlCommenter as SqlCommenter
transactions, etc. 'newOrvilleState' should be used to create an appopriate
initial state for your monad's context.
@since 0.10.0.0
@since 1.0.0.0
-}
data OrvilleState = OrvilleState
{ _orvilleConnectionPool :: Pool Connection
@ -69,7 +69,7 @@ data OrvilleState = OrvilleState
{- |
Get the connection pool being used for the 'OrvilleState'
@since 0.10.0.0
@since 1.0.0.0
-}
orvilleConnectionPool :: OrvilleState -> Pool Connection
orvilleConnectionPool =
@ -79,7 +79,7 @@ orvilleConnectionPool =
INTERNAL: The 'ConnectionState' indicates whether Orville currently has a connection
open, and contains the connection if it does.
@since 0.10.0.0
@since 1.0.0.0
-}
orvilleConnectionState :: OrvilleState -> ConnectionState
orvilleConnectionState =
@ -89,7 +89,7 @@ orvilleConnectionState =
The 'ErrorDetailLevel' controls how much information Orville includes in
error messages it generates when data cannot be decoded rows in the database.
@since 0.10.0.0
@since 1.0.0.0
-}
orvilleErrorDetailLevel :: OrvilleState -> ErrorDetailLevel
orvilleErrorDetailLevel =
@ -99,7 +99,7 @@ orvilleErrorDetailLevel =
Orville will call the transaction callback any time a transaction event
occurrs. You can register a callback with 'addTransactionCallBack'.
@since 0.10.0.0
@since 1.0.0.0
-}
orvilleTransactionCallback :: OrvilleState -> TransactionEvent -> IO ()
orvilleTransactionCallback =
@ -110,7 +110,7 @@ orvilleTransactionCallback =
this via 'setBeginTransactionExpr' to have fine grained control over the
transaction parameters, such as isolation level.
@since 0.10.0.0
@since 1.0.0.0
-}
orvilleBeginTransactionExpr :: OrvilleState -> Expr.BeginTransactionExpr
orvilleBeginTransactionExpr =
@ -121,7 +121,7 @@ orvilleBeginTransactionExpr =
be modified with 'addSqlCommenterAttributes'. See
https://google.github.io/sqlcommenter/.
@since 0.10.0.0
@since 1.0.0.0
-}
orvilleSqlCommenterAttributes :: OrvilleState -> Maybe SqlCommenter.SqlCommenterAttributes
orvilleSqlCommenterAttributes =
@ -143,7 +143,7 @@ orvilleSqlCommenterAttributes =
callbacks that either raise no exceptions or can handle their own exceptions
cleanly.
@since 0.10.0.0
@since 1.0.0.0
-}
addTransactionCallback ::
(TransactionEvent -> IO ()) ->
@ -164,7 +164,7 @@ addTransactionCallback newCallback state =
Creates a appropriate initial 'OrvilleState' that will use the connection
pool given to initiate connections to the database.
@since 0.10.0.0
@since 1.0.0.0
-}
newOrvilleState :: ErrorDetailLevel -> Pool Connection -> OrvilleState
newOrvilleState errorDetailLevel pool =
@ -184,7 +184,7 @@ newOrvilleState errorDetailLevel pool =
monad from another and they should not share the same connection and
transaction state.
@since 0.10.0.0
@since 1.0.0.0
-}
resetOrvilleState :: OrvilleState -> OrvilleState
resetOrvilleState =
@ -198,7 +198,7 @@ resetOrvilleState =
all queries. This is used by 'withConnection' to track the connection it
retrieves from the pool.
@since 0.10.0.0
@since 1.0.0.0
-}
connectState :: ConnectedState -> OrvilleState -> OrvilleState
connectState connectedState state =
@ -214,7 +214,7 @@ connectState connectedState state =
multiple operations that needs to be run on the same connection (e.g.
multiple operations inside a transaction).
@since 0.10.0.0
@since 1.0.0.0
-}
data ConnectionState
= NotConnected
@ -224,7 +224,7 @@ data ConnectionState
INTERNAL: This type is used hold the connection while it is open and
track the state of open transactions and savepoints on the connection.
@since 0.10.0.0
@since 1.0.0.0
-}
data ConnectedState = ConnectedState
{ connectedConnection :: Connection
@ -235,7 +235,7 @@ data ConnectedState = ConnectedState
INTERNAL: This type is use to track the state of open transactions and
savepoints on an open connection.
@since 0.10.0.0
@since 1.0.0.0
-}
data TransactionState
= OutermostTransaction
@ -245,7 +245,7 @@ data TransactionState
INTERNAL: Constructs a new 'TransactionState' to represent beginning a
new transaction in SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
newTransaction :: Maybe TransactionState -> TransactionState
newTransaction maybeTransactionState =
@ -260,7 +260,7 @@ newTransaction maybeTransactionState =
{- |
An internal Orville identifier for a savepoint in a PostgreSQL transaction.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype Savepoint
= Savepoint Int
@ -270,7 +270,7 @@ newtype Savepoint
The initial identifier Orville uses to track the first savepoint within
a transaction.
@since 0.10.0.0
@since 1.0.0.0
-}
initialSavepoint :: Savepoint
initialSavepoint =
@ -280,7 +280,7 @@ initialSavepoint =
Determines identifier for the next savepoint in a transaction after the
given saveponit>
@since 0.10.0.0
@since 1.0.0.0
-}
nextSavepoint :: Savepoint -> Savepoint
nextSavepoint (Savepoint n) =
@ -290,7 +290,7 @@ nextSavepoint (Savepoint n) =
Indicates how many levels of nested savepoints the given 'Savepoint'
identifier represents.
@since 0.10.0.0
@since 1.0.0.0
-}
savepointNestingLevel :: Savepoint -> Int
savepointNestingLevel (Savepoint n) = n
@ -301,7 +301,7 @@ savepointNestingLevel (Savepoint n) = n
The callback will be called after the even in question has been succesfully
executed.
@since 0.10.0.0
@since 1.0.0.0
-}
data TransactionEvent
= -- | Indicates a new transaction has been started
@ -329,7 +329,7 @@ data TransactionEvent
{- |
The default transaction callback is simply a no-op.
@since 0.10.0.0
@since 1.0.0.0
-}
defaultTransactionCallback :: TransactionEvent -> IO ()
defaultTransactionCallback = const (pure ())
@ -338,7 +338,7 @@ defaultTransactionCallback = const (pure ())
Constructs the appropriate 'TransactionEvent' for opening a new transaction
based on the current 'TransactionState'.
@since 0.10.0.0
@since 1.0.0.0
-}
openTransactionEvent :: TransactionState -> TransactionEvent
openTransactionEvent txnState =
@ -350,7 +350,7 @@ openTransactionEvent txnState =
Constructs the appropriate 'TransactionEvent' for rolling back the innermost
transaction based on the current 'TransactionState'.
@since 0.10.0.0
@since 1.0.0.0
-}
rollbackTransactionEvent :: TransactionState -> TransactionEvent
rollbackTransactionEvent txnState =
@ -362,7 +362,7 @@ rollbackTransactionEvent txnState =
Constructs the appropriate 'TransactionEvent' to represent a transaction
completely successfully based on the current 'TransactionState'.
@since 0.10.0.0
@since 1.0.0.0
-}
transactionSuccessEvent :: TransactionState -> TransactionEvent
transactionSuccessEvent txnState =
@ -374,7 +374,7 @@ transactionSuccessEvent txnState =
The callback Orville will call whenever it wants to run SQL. You can
register a callback using 'addSqlExecutionCallback'.
@since 0.10.0.0
@since 1.0.0.0
-}
orvilleSqlExecutionCallback ::
OrvilleState ->
@ -390,7 +390,7 @@ orvilleSqlExecutionCallback =
The default SQL execption callback simply runs the IO action given without
doing anything else.
@since 0.10.0.0
@since 1.0.0.0
-}
defaultSqlExectionCallback :: QueryType -> RawSql.RawSql -> IO a -> IO a
defaultSqlExectionCallback _ _ io = io
@ -409,7 +409,7 @@ defaultSqlExectionCallback _ _ io = io
they implement themelves. Any callbacks should allow for the possibility that
the IO action they are given may raise an exception.
@since 0.10.0.0
@since 1.0.0.0
-}
addSqlExecutionCallback ::
(forall a. QueryType -> RawSql.RawSql -> IO a -> IO a) ->
@ -428,7 +428,7 @@ addSqlExecutionCallback outerCallback state =
The default begin transaction expression is simply @BEGIN TRANSACTION@
with no options specified.
@since 0.10.0.0
@since 1.0.0.0
-}
defaultBeginTransactionExpr :: Expr.BeginTransactionExpr
defaultBeginTransactionExpr =
@ -439,7 +439,7 @@ defaultBeginTransactionExpr =
control the transaction isolation level by building your own
'Expr.BeginTransactionExpr' with the desired isolation level.
@since 0.10.0.0
@since 1.0.0.0
-}
setBeginTransactionExpr ::
Expr.BeginTransactionExpr ->
@ -453,7 +453,7 @@ setBeginTransactionExpr expr state =
{- |
Sets the SqlCommenterAttributes that Orville will then add to any following statement executions.
@since 0.10.0.0
@since 1.0.0.0
-}
setSqlCommenterAttributes ::
SqlCommenter.SqlCommenterAttributes ->
@ -467,7 +467,7 @@ setSqlCommenterAttributes comments state =
{- |
Adds the SqlCommenterAttributes to the already existing that Orville will then add to any following statement executions.
@since 0.10.0.0
@since 1.0.0.0
-}
addSqlCommenterAttributes ::
SqlCommenter.SqlCommenterAttributes ->

View File

@ -3,7 +3,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Internal.RowCountExpectation
( expectExactlyOneRow
@ -19,7 +19,7 @@ import Control.Monad.IO.Class (MonadIO (liftIO))
thrown if the returning clause from an insert statement for a single record
returned 0 records or more than 1 record.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype RowCountExpectationError
= RowCountExpectationError String

View File

@ -11,7 +11,7 @@ This includes a number of lowel-level items not exported by
"Orville.PostgreSQL" that give you more control (and therefore responsibility)
over how the marshalling is performed.
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Marshall
( module Orville.PostgreSQL.Marshall.SqlMarshaller

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Marshall.DefaultValue
( DefaultValue
@ -53,7 +53,7 @@ import qualified Orville.PostgreSQL.Raw.RawSql as RawSql
database-assigned values such as using 'now()' to set a 'created_at' column
on a row automatically in the database.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype DefaultValue a
= DefaultValue Expr.ValueExpression
@ -62,7 +62,7 @@ newtype DefaultValue a
Builds a default value for any 'Integral' type @n@ by converting it an
'Integer'.
@since 0.10.0.0
@since 1.0.0.0
-}
integralDefault :: Integral n => n -> DefaultValue n
integralDefault n =
@ -86,7 +86,7 @@ integralDefault n =
This is a specialization of 'integerDefault'.
@since 0.10.0.0
@since 1.0.0.0
-}
smallIntegerDefault :: Int16 -> DefaultValue Int16
smallIntegerDefault = integralDefault
@ -96,7 +96,7 @@ smallIntegerDefault = integralDefault
This is a specialization of 'integerDefault'.
@since 0.10.0.0
@since 1.0.0.0
-}
integerDefault :: Int32 -> DefaultValue Int32
integerDefault = integralDefault
@ -106,7 +106,7 @@ integerDefault = integralDefault
This is a specialization of 'integerDefault'.
@since 0.10.0.0
@since 1.0.0.0
-}
bigIntegerDefault :: Int64 -> DefaultValue Int64
bigIntegerDefault = integralDefault
@ -114,7 +114,7 @@ bigIntegerDefault = integralDefault
{- |
Builds a default value from a 'Double' field with double fields.
@since 0.10.0.0
@since 1.0.0.0
-}
doubleDefault :: Double -> DefaultValue Double
doubleDefault d =
@ -135,7 +135,7 @@ doubleDefault d =
{- |
Builds a default value from a 'Bool', for use with boolean fields.
@since 0.10.0.0
@since 1.0.0.0
-}
booleanDefault :: Bool -> DefaultValue Bool
booleanDefault bool =
@ -151,7 +151,7 @@ booleanDefault bool =
Builds a default value from a 'T.Text', for use with unbounded, bounded
and fixed-length text fields.
@since 0.10.0.0
@since 1.0.0.0
-}
textDefault :: T.Text -> DefaultValue T.Text
textDefault text =
@ -162,7 +162,7 @@ textDefault text =
{- |
Builds a default value from a 'Time.Day' for use with date fields.
@since 0.10.0.0
@since 1.0.0.0
-}
dateDefault :: Time.Day -> DefaultValue Time.Day
dateDefault day =
@ -180,7 +180,7 @@ dateDefault day =
For use with date fields.
@since 0.10.0.0
@since 1.0.0.0
-}
currentDateDefault :: DefaultValue Time.Day
currentDateDefault =
@ -192,7 +192,7 @@ currentDateDefault =
{- |
Builds a default value from a 'Time.UTCTime' for use with utc timestamp fields.
@since 0.10.0.0
@since 1.0.0.0
-}
utcTimestampDefault :: Time.UTCTime -> DefaultValue Time.UTCTime
utcTimestampDefault utcTime =
@ -210,7 +210,7 @@ utcTimestampDefault utcTime =
For use with utc timestamp fields.
@since 0.10.0.0
@since 1.0.0.0
-}
currentUTCTimestampDefault :: DefaultValue Time.UTCTime
currentUTCTimestampDefault =
@ -219,7 +219,7 @@ currentUTCTimestampDefault =
{- |
Builds a default value from a 'Time.LocalTime' for use with local timestamp fields.
@since 0.10.0.0
@since 1.0.0.0
-}
localTimestampDefault :: Time.LocalTime -> DefaultValue Time.LocalTime
localTimestampDefault localTime =
@ -241,7 +241,7 @@ localTimestampDefault localTime =
For use with local timestamp fields.
@since 0.10.0.0
@since 1.0.0.0
-}
currentLocalTimestampDefault :: DefaultValue Time.LocalTime
currentLocalTimestampDefault =
@ -254,7 +254,7 @@ currentLocalTimestampDefault =
with a column whose database type is the same as the one the 'DefaultValue'
was originally intended for, everything will work as expected.
@since 0.10.0.0
@since 1.0.0.0
-}
coerceDefaultValue :: DefaultValue a -> DefaultValue b
coerceDefaultValue (DefaultValue expression) =
@ -263,7 +263,7 @@ coerceDefaultValue (DefaultValue expression) =
{- |
Returns database value expression for the default value
@since 0.10.0.0
@since 1.0.0.0
-}
defaultValueExpression :: DefaultValue a -> Expr.ValueExpression
defaultValueExpression (DefaultValue expression) =
@ -285,7 +285,7 @@ defaultValueExpression (DefaultValue expression) =
form, auto migration will continue to execute SQL statements to update the
schema even when it does not need to.
@since 0.10.0.0
@since 1.0.0.0
-}
rawSqlDefault :: Expr.ValueExpression -> DefaultValue a
rawSqlDefault =

View File

@ -12,7 +12,7 @@ that a Haskell field is mapped to via a
'Orville.PostgreSQL.Marhall.SqlMarshaller'. It is also used for constructing
boolean conditions for matching rows in queries.
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Marshall.FieldDefinition
( FieldDefinition
@ -119,7 +119,7 @@ import qualified Orville.PostgreSQL.Schema.TableIdentifier as TableIdentifier
how to marshall to and from the database representation of SQL type for
the field.
@since 0.10.0.0
@since 1.0.0.0
-}
data FieldDefinition nullability a = FieldDefinition
{ i_fieldName :: FieldName
@ -133,7 +133,7 @@ data FieldDefinition nullability a = FieldDefinition
{- |
The name used in database queries to reference the field.
@since 0.10.0.0
@since 1.0.0.0
-}
fieldName :: FieldDefinition nullability a -> FieldName
fieldName = i_fieldName
@ -141,7 +141,7 @@ fieldName = i_fieldName
{- |
Returns the description that was passed to 'setFieldDescription', if any.
@since 0.10.0.0
@since 1.0.0.0
-}
fieldDescription :: FieldDefinition nullability a -> Maybe String
fieldDescription = i_fieldDescription
@ -151,7 +151,7 @@ fieldDescription = i_fieldDescription
anywhere by Orville itself, but users can retrieve the description via
'fieldDescription' for their own purposes (e.g. generating documentation).
@since 0.10.0.0
@since 1.0.0.0
-}
setFieldDescription :: String -> FieldDefinition nullability a -> FieldDefinition nullability a
setFieldDescription description fieldDef =
@ -164,7 +164,7 @@ setFieldDescription description fieldDef =
used to define the field as well as how to mashall Haskell values to and
from the database.
@since 0.10.0.0
@since 1.0.0.0
-}
fieldType :: FieldDefinition nullability a -> SqlType.SqlType a
fieldType = i_fieldType
@ -172,7 +172,7 @@ fieldType = i_fieldType
{- |
Returns the default value definition for the field, if any has been set.
@since 0.10.0.0
@since 1.0.0.0
-}
fieldDefaultValue :: FieldDefinition nullability a -> Maybe (DefaultValue.DefaultValue a)
fieldDefaultValue = i_fieldDefaultValue
@ -184,7 +184,7 @@ fieldDefaultValue = i_fieldDefaultValue
constructors around the 'FieldDefinition' that you can pattern match on to
then work with a concrete 'Nullable' or 'NotNull' field.
@since 0.10.0.0
@since 1.0.0.0
-}
data FieldNullability a
= NullableField (FieldDefinition Nullable a)
@ -196,7 +196,7 @@ data FieldNullability a
extract the either 'Nullable' or 'NotNull' not field for cases where you
may require different logic based on the nullability of a field.
@since 0.10.0.0
@since 1.0.0.0
-}
fieldNullability :: FieldDefinition nullability a -> FieldNullability a
fieldNullability field =
@ -207,7 +207,7 @@ fieldNullability field =
{- |
Indicates whether a field is nullable.
@since 0.10.0.0
@since 1.0.0.0
-}
fieldIsNotNullable :: FieldDefinition nullability a -> Bool
fieldIsNotNullable field =
@ -219,7 +219,7 @@ fieldIsNotNullable field =
A list a table constraints that will be included on any table that uses this
field definition.
@since 0.10.0.0
@since 1.0.0.0
-}
fieldTableConstraints ::
FieldDefinition nullability a ->
@ -250,7 +250,7 @@ fieldTableConstraints fieldDef =
'TableDefinition'. Any previously added constraint with the same key is
replaced by the new one.
@since 0.10.0.0
@since 1.0.0.0
-}
addFieldTableConstraints ::
[FieldName -> ConstraintDefinition.ConstraintDefinition] ->
@ -267,7 +267,7 @@ addFieldTableConstraints constraintDefs fieldDef =
'addFieldTableConstraints'). This constraint will be included on any table
that uses the field definition.
@since 0.10.0.0
@since 1.0.0.0
-}
addForeignKeyConstraint ::
-- | Identifier of the table referenced by the foreign key
@ -286,7 +286,7 @@ addForeignKeyConstraint foreignTableId foreignFieldName =
Adds a @FOREIGN KEY@ constraint to the 'FieldDefinition'. This constraint
will be included on any table that uses the field definition.
@since 0.10.0.0
@since 1.0.0.0
-}
addForeignKeyConstraintWithOptions ::
-- | Identifier of the table referenced by the foreign key
@ -316,7 +316,7 @@ addForeignKeyConstraintWithOptions foreignTableId foreignFieldName options field
Adds a @UNIQUE@ constraint to the 'FieldDefinition'. This constraint
will be included on any table that uses the field definition.
@since 0.10.0.0
@since 1.0.0.0
-}
addUniqueConstraint ::
FieldDefinition nullability a ->
@ -333,7 +333,7 @@ addUniqueConstraint fieldDef =
representation and packages the resul as a 'Expr.ValueExression' so that
it can be easily used with other @Expr@ functions.
@since 0.10.0.0
@since 1.0.0.0
-}
fieldValueToExpression :: FieldDefinition nullability a -> a -> Expr.ValueExpression
fieldValueToExpression field =
@ -343,7 +343,7 @@ fieldValueToExpression field =
Mashalls a Haskell value to be stored in the field to its 'SqlValue'
representation.
@since 0.10.0.0
@since 1.0.0.0
-}
fieldValueToSqlValue :: FieldDefinition nullability a -> a -> SqlValue.SqlValue
fieldValueToSqlValue =
@ -353,7 +353,7 @@ fieldValueToSqlValue =
Marshalls a 'SqlValue' from the database into the Haskell value that represents it.
This may fail, in which case a 'Left' is returned with an error message.
@since 0.10.0.0
@since 1.0.0.0
-}
fieldValueFromSqlValue :: FieldDefinition nullability a -> SqlValue.SqlValue -> Either String a
fieldValueFromSqlValue =
@ -363,7 +363,7 @@ fieldValueFromSqlValue =
Constructs the 'Expr.ColumnName' for a field for use in SQL expressions
from the 'Expr' module.
@since 0.10.0.0
@since 1.0.0.0
-}
fieldColumnName :: FieldDefinition nullability a -> Expr.ColumnName
fieldColumnName =
@ -373,7 +373,7 @@ fieldColumnName =
Constructs the 'Expr.ValueExpression for a field for use in SQL expressions
from the 'Expr' module.
@since 0.10.0.0
@since 1.0.0.0
-}
fieldColumnReference :: FieldDefinition nullability a -> Expr.ValueExpression
fieldColumnReference =
@ -383,7 +383,7 @@ fieldColumnReference =
Constructions the equivalant 'Expr.FieldDefinition' as a SQL expression,
generally for use in DDL for creating column in a table.
@since 0.10.0.0
@since 1.0.0.0
-}
fieldColumnDefinition :: FieldDefinition nullability a -> Expr.ColumnDefinition
fieldColumnDefinition fieldDef =
@ -398,7 +398,7 @@ fieldColumnDefinition fieldDef =
this only handles nullability, but if we add support for more constraints
directly on columns it may end up handling those as well.
@since 0.10.0.0
@since 1.0.0.0
-}
fieldColumnConstraint :: FieldDefinition nullabily a -> Expr.ColumnConstraint
fieldColumnConstraint fieldDef =
@ -420,7 +420,7 @@ fieldColumnConstraint fieldDef =
This allows functions that work only on 'Nullable' or 'NotNull' fields to
indicate this in their type signatures as appropriate.
@since 0.10.0.0
@since 1.0.0.0
-}
data NullabilityGADT nullability where
NullableGADT :: NullabilityGADT Nullable
@ -432,7 +432,7 @@ data NullabilityGADT nullability where
represents a field that is marked not-null in the database schema. See the
'Nullability' type for the value-level representation of field nullability.
@since 0.10.0.0
@since 1.0.0.0
-}
data NotNull
@ -441,7 +441,7 @@ data NotNull
represents a field that is marked nullable in the database schema. See the
'Nullability' type for the value-level representation of field nullability.
@since 0.10.0.0
@since 1.0.0.0
-}
data Nullable
@ -449,7 +449,7 @@ data Nullable
Builds a 'FieldDefinition' that stores Haskell 'Int32' values as the
PostgreSQL "INT" type.
@since 0.10.0.0
@since 1.0.0.0
-}
integerField ::
-- | Name of the field in the database
@ -461,7 +461,7 @@ integerField = fieldOfType SqlType.integer
Builds a 'FieldDefinition' that stores Haskell 'Int16' values as the
PostgreSQL "SMALLINT" type.
@since 0.10.0.0
@since 1.0.0.0
-}
smallIntegerField ::
-- | Name of the field in the database
@ -473,7 +473,7 @@ smallIntegerField = fieldOfType SqlType.smallInteger
Builds a 'FieldDefinition' that stores an 'Int32' value as the "SERIAL"
type. This can be used to create auto-incrementing columns.
@since 0.10.0.0
@since 1.0.0.0
-}
serialField ::
-- | Name of the field in the database
@ -485,7 +485,7 @@ serialField = fieldOfType SqlType.serial
Builds a 'FieldDefinition' that stores Haskell 'Int64' values as the
PostgreSQL "BIGINT" type.
@since 0.10.0.0
@since 1.0.0.0
-}
bigIntegerField ::
-- | Name of the field in the database
@ -497,7 +497,7 @@ bigIntegerField = fieldOfType SqlType.bigInteger
Builds a 'FieldDefinition' that stores an 'Int64' value as the "BIGSERIAL"
type. This can be used to create auto-incrementing columns.
@since 0.10.0.0
@since 1.0.0.0
-}
bigSerialField ::
-- | Name of the field in the database
@ -511,7 +511,7 @@ bigSerialField = fieldOfType SqlType.bigSerial
up to 15 digits of precision, so some rounding may occur when values are
stored in the database.
@since 0.10.0.0
@since 1.0.0.0
-}
doubleField ::
-- | Name of the field in the database
@ -523,7 +523,7 @@ doubleField = fieldOfType SqlType.double
Builds a 'FieldDefinition' that stores Haskell 'Bool' values as the
PostgreSQL "BOOLEAN" type.
@since 0.10.0.0
@since 1.0.0.0
-}
booleanField ::
-- | Name of the field in the database
@ -536,7 +536,7 @@ booleanField = fieldOfType SqlType.boolean
PostgreSQL "TEXT" type. Note that this PostgreSQL has no particular
limit on the length of text stored.
@since 0.10.0.0
@since 1.0.0.0
-}
unboundedTextField ::
-- | Name of the field in the database
@ -549,7 +549,7 @@ unboundedTextField = fieldOfType SqlType.unboundedText
PostgreSQL "VARCHAR" type. Attempting to store a value beyond the length
specified will cause an error.
@since 0.10.0.0
@since 1.0.0.0
-}
boundedTextField ::
-- | Name of the field in the database
@ -565,7 +565,7 @@ boundedTextField name len = fieldOfType (SqlType.boundedText len) name
specified will cause an error. Storing a value that is not the full
length of the field will result in padding by the database.
@since 0.10.0.0
@since 1.0.0.0
-}
fixedTextField ::
-- | Name of the field in the database
@ -583,7 +583,7 @@ fixedTextField name len = fieldOfType (SqlType.fixedText len) name
See https://www.postgresql.org/docs/current/datatype-textsearch.html for
information about how PostgreSQL creates @tsvector@ values from strings.
@since 0.10.0.0
@since 1.0.0.0
-}
textSearchVectorField :: String -> FieldDefinition NotNull T.Text
textSearchVectorField = fieldOfType SqlType.textSearchVector
@ -592,7 +592,7 @@ textSearchVectorField = fieldOfType SqlType.textSearchVector
Builds a 'FieldDefinition' that stores Haskell 'T.Text' values as the
PostgreSQL "JSONB" type.
@since 0.10.0.0
@since 1.0.0.0
-}
jsonbField ::
String ->
@ -603,7 +603,7 @@ jsonbField = fieldOfType SqlType.jsonb
Builds a 'FieldDefinition' that stores Haskell 'Time.Day' values as the
PostgreSQL "DATE" type.
@since 0.10.0.0
@since 1.0.0.0
-}
dateField ::
-- | Name of the field in the database
@ -615,7 +615,7 @@ dateField = fieldOfType SqlType.date
Builds a 'FieldDefinition' that stores Haskell 'Time.UTCTime' values as the
PostgreSQL "TIMESTAMP with time zone" type.
@since 0.10.0.0
@since 1.0.0.0
-}
utcTimestampField ::
-- | Name of the field in the database
@ -627,7 +627,7 @@ utcTimestampField = fieldOfType SqlType.timestamp
Builds a 'FieldDefinition' that stores Haskell 'Time.UTCTime' values as the
PostgreSQL "TIMESTAMP without time zone" type.
@since 0.10.0.0
@since 1.0.0.0
-}
localTimestampField ::
-- | Name of the field in the database
@ -639,7 +639,7 @@ localTimestampField = fieldOfType SqlType.timestampWithoutZone
Builds a 'FieldDefinition' that stores Haskell 'UUID.UUID' values as the
PostgreSQL "UUID" type.
@since 0.10.0.0
@since 1.0.0.0
-}
uuidField ::
-- | Name of the field in the database
@ -654,7 +654,7 @@ uuidField = fieldOfType SqlType.uuid
other functions in this module for creating 'FieldDefinition's for your
custom type.
@since 0.10.0.0
@since 1.0.0.0
-}
fieldOfType ::
-- | 'SqlType' that represents the PostgreSQL data type for the field.
@ -678,7 +678,7 @@ fieldOfType sqlType name =
the value 'Nothing' will be used to represent 'NULL' values when converting
to and from sql.
@since 0.10.0.0
@since 1.0.0.0
-}
nullableField :: FieldDefinition NotNull a -> FieldDefinition Nullable (Maybe a)
nullableField field =
@ -715,7 +715,7 @@ nullableField field =
make fields 'Nullable' but need the value to be decoded in its underlying
type when reading back (e.g. 'maybeMapper' from 'SqlMarshaller').
@since 0.10.0.0
@since 1.0.0.0
-}
asymmetricNullableField :: FieldDefinition Nullable a -> FieldDefinition Nullable (Maybe a)
asymmetricNullableField field =
@ -744,7 +744,7 @@ asymmetricNullableField field =
See 'SqlType.convertSqlType' and 'SqlType.tryConvertSqlType' for functions
to create the conversion needed as the first argument to 'convertField'.
@since 0.10.0.0
@since 1.0.0.0
-}
convertField ::
(SqlType.SqlType a -> SqlType.SqlType b) ->
@ -761,7 +761,7 @@ convertField conversion fieldDef =
'Coere.Coercible'. This is particularly useful for newtype wrappers around
primitive types.
@since 0.10.0.0
@since 1.0.0.0
-}
coerceField ::
(Coerce.Coercible a b, Coerce.Coercible b a) =>
@ -778,7 +778,7 @@ coerceField =
to safely to an existing table as long as a reasonable default value is
available to use.
@since 0.10.0.0
@since 1.0.0.0
-}
setDefaultValue ::
DefaultValue.DefaultValue a ->
@ -793,7 +793,7 @@ setDefaultValue defaultValue fieldDef =
Removes any default value that may have been set on a field via
@setDefaultValue@.
@since 0.10.0.0
@since 1.0.0.0
-}
removeDefaultValue ::
FieldDefinition nullability a ->
@ -806,7 +806,7 @@ removeDefaultValue fieldDef =
{- |
Adds a prefix, followed by an underscore, to a field's name.
@since 0.10.0.0
@since 1.0.0.0
-}
prefixField ::
String ->
@ -822,7 +822,7 @@ prefixField prefix fieldDef =
field definition to the given value. The value is be converted to SQL
value using 'fieldValueToSqlValue'
@since 0.10.0.0
@since 1.0.0.0
-}
setField :: FieldDefinition nullability a -> a -> Expr.SetClause
setField fieldDef value =
@ -833,7 +833,7 @@ setField fieldDef value =
{- |
Operator alias for 'setField'
@since 0.10.0.0
@since 1.0.0.0
-}
(.:=) :: FieldDefinition nullability a -> a -> Expr.SetClause
(.:=) = setField
@ -841,7 +841,7 @@ setField fieldDef value =
{- |
Checks that the value in a field equals a particular value.
@since 0.10.0.0
@since 1.0.0.0
-}
fieldEquals :: FieldDefinition nullability a -> a -> Expr.BooleanExpr
fieldEquals =
@ -850,7 +850,7 @@ fieldEquals =
{- |
Operator alias for 'fieldEquals'
@since 0.10.0.0
@since 1.0.0.0
-}
(.==) :: FieldDefinition nullability a -> a -> Expr.BooleanExpr
(.==) = fieldEquals
@ -860,7 +860,7 @@ infixl 9 .==
{- |
Checks that the value in a field does not equal a particular value.
@since 0.10.0.0
@since 1.0.0.0
-}
fieldNotEquals :: FieldDefinition nullability a -> a -> Expr.BooleanExpr
fieldNotEquals =
@ -869,7 +869,7 @@ fieldNotEquals =
{- |
Operator alias for 'fieldNotEquals'
@since 0.10.0.0
@since 1.0.0.0
-}
(./=) :: FieldDefinition nullability a -> a -> Expr.BooleanExpr
(./=) = fieldNotEquals
@ -879,7 +879,7 @@ infixl 9 ./=
{- |
Checks that the value in a field is greater than a particular value.
@since 0.10.0.0
@since 1.0.0.0
-}
fieldGreaterThan :: FieldDefinition nullability a -> a -> Expr.BooleanExpr
fieldGreaterThan =
@ -888,7 +888,7 @@ fieldGreaterThan =
{- |
Operator alias for 'fieldGreaterThan'
@since 0.10.0.0
@since 1.0.0.0
-}
(.>) :: FieldDefinition nullability a -> a -> Expr.BooleanExpr
(.>) = fieldGreaterThan
@ -898,7 +898,7 @@ infixl 9 .>
{- |
Checks that the value in a field is less than a particular value.
@since 0.10.0.0
@since 1.0.0.0
-}
fieldLessThan :: FieldDefinition nullability a -> a -> Expr.BooleanExpr
fieldLessThan =
@ -907,7 +907,7 @@ fieldLessThan =
{- |
Operator alias for 'fieldLessThan'
@since 0.10.0.0
@since 1.0.0.0
-}
(.<) :: FieldDefinition nullability a -> a -> Expr.BooleanExpr
(.<) = fieldLessThan
@ -917,7 +917,7 @@ infixl 9 .<
{- |
Checks that the value in a field is greater than or equal to a particular value.
@since 0.10.0.0
@since 1.0.0.0
-}
fieldGreaterThanOrEqualTo :: FieldDefinition nullability a -> a -> Expr.BooleanExpr
fieldGreaterThanOrEqualTo =
@ -926,7 +926,7 @@ fieldGreaterThanOrEqualTo =
{- |
Operator alias for 'fieldGreaterThanOrEqualTo'
@since 0.10.0.0
@since 1.0.0.0
-}
(.>=) :: FieldDefinition nullability a -> a -> Expr.BooleanExpr
(.>=) = fieldGreaterThanOrEqualTo
@ -936,7 +936,7 @@ infixl 9 .>=
{- |
Checks that the value in a field is less than or equal to a particular value.
@since 0.10.0.0
@since 1.0.0.0
-}
fieldLessThanOrEqualTo :: FieldDefinition nullability a -> a -> Expr.BooleanExpr
fieldLessThanOrEqualTo =
@ -945,7 +945,7 @@ fieldLessThanOrEqualTo =
{- |
Operator alias for 'fieldLessThanOrEqualTo'
@since 0.10.0.0
@since 1.0.0.0
-}
(.<=) :: FieldDefinition nullability a -> a -> Expr.BooleanExpr
(.<=) = fieldLessThanOrEqualTo
@ -955,7 +955,7 @@ infixl 9 .<=
{- |
Checks that the value in a field matches a like pattern
@since 0.10.0.0
@since 1.0.0.0
-}
fieldLike :: FieldDefinition nullability a -> T.Text -> Expr.BooleanExpr
fieldLike fieldDef likePattern =
@ -966,7 +966,7 @@ fieldLike fieldDef likePattern =
{- |
Checks that the value in a field matches a like pattern case insensitively
@since 0.10.0.0
@since 1.0.0.0
-}
fieldLikeInsensitive :: FieldDefinition nullability a -> T.Text -> Expr.BooleanExpr
fieldLikeInsensitive fieldDef likePattern =
@ -977,7 +977,7 @@ fieldLikeInsensitive fieldDef likePattern =
{- |
Checks that the value in a field is null.
@since 0.10.0.0
@since 1.0.0.0
-}
fieldIsNull :: FieldDefinition Nullable a -> Expr.BooleanExpr
fieldIsNull =
@ -986,7 +986,7 @@ fieldIsNull =
{- |
Checks that the value in a field is not null.
@since 0.10.0.0
@since 1.0.0.0
-}
fieldIsNotNull :: FieldDefinition Nullable a -> Expr.BooleanExpr
fieldIsNotNull =
@ -995,7 +995,7 @@ fieldIsNotNull =
{- |
Checks that a field matches a list of values
@since 0.10.0.0
@since 1.0.0.0
-}
fieldIn :: FieldDefinition nullability a -> NonEmpty a -> Expr.BooleanExpr
fieldIn fieldDef values =
@ -1006,7 +1006,7 @@ fieldIn fieldDef values =
{- |
Operator alias for 'fieldIn'
@since 0.10.0.0
@since 1.0.0.0
-}
(.<-) :: FieldDefinition nullability a -> NonEmpty a -> Expr.BooleanExpr
(.<-) = fieldIn
@ -1016,7 +1016,7 @@ infixl 9 .<-
{- |
Checks that a field does not match a list of values
@since 0.10.0.0
@since 1.0.0.0
-}
fieldNotIn :: FieldDefinition nullability a -> NonEmpty a -> Expr.BooleanExpr
fieldNotIn fieldDef values =
@ -1027,7 +1027,7 @@ fieldNotIn fieldDef values =
{- |
Operator alias for 'fieldNotIn'
@since 0.10.0.0
@since 1.0.0.0
-}
(.</-) :: FieldDefinition nullability a -> NonEmpty a -> Expr.BooleanExpr
(.</-) = fieldNotIn
@ -1037,7 +1037,7 @@ infixl 9 .</-
{- |
Checks that a tuple of two fields is in the list of specified tuplies
@since 0.10.0.0
@since 1.0.0.0
-}
fieldTupleIn ::
FieldDefinition nullabilityA a ->
@ -1052,7 +1052,7 @@ fieldTupleIn fieldDefA fieldDefB values =
{- |
Checks that a tuple of two fields is not in the list of specified tuplies
@since 0.10.0.0
@since 1.0.0.0
-}
fieldTupleNotIn ::
FieldDefinition nullabilityA a ->
@ -1067,7 +1067,7 @@ fieldTupleNotIn fieldDefA fieldDefB values =
{- |
Constructs a SqlValue "tuple" (i.e. NonEmpty list) for two fields
@since 0.10.0.0
@since 1.0.0.0
-}
toSqlValueTuple ::
FieldDefinition nullabilityA a ->
@ -1082,7 +1082,7 @@ toSqlValueTuple fieldDefA fieldDefB (a, b) =
Constructs a field-based 'Expr.BooleanExpr' using a function that
builds a 'Expr.BooleanExpr'
@since 0.10.0.0
@since 1.0.0.0
-}
whereColumnComparison ::
(Expr.ValueExpression -> Expr.ValueExpression -> Expr.BooleanExpr) ->

View File

@ -3,7 +3,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Marshall.MarshallError
( MarshallError (MarshallError, marshallErrorDetailLevel, marshallErrorRowIdentifier, marshallErrorDetails)
@ -31,7 +31,7 @@ import qualified Orville.PostgreSQL.Raw.SqlValue as SqlValue
decoded from the database doesn't meet the expectations of the
'SqlMarshaller' that is decoding it.
@since 0.10.0.0
@since 1.0.0.0
-}
data MarshallError = MarshallError
{ marshallErrorDetailLevel :: ErrorDetailLevel
@ -67,7 +67,7 @@ instance Exception MarshallError
of code that return information more publicly (e.g. a request handler for a
public endpoint).
@since 0.10.0.0
@since 1.0.0.0
-}
renderMarshallError :: ErrorDetailLevel -> MarshallError -> String
renderMarshallError detailLevel marshallError =
@ -90,7 +90,7 @@ renderMarshallError detailLevel marshallError =
function can be used to present either ID values or general values as
required by the context of the caller.
@since 0.10.0.0
@since 1.0.0.0
-}
presentSqlColumnValue ::
ErrorDetailLevel ->
@ -116,7 +116,7 @@ presentSqlColumnValue detailLevel redacter (columnName, sqlValue) =
being decoded from the database doesn't meet the expectations of the
'SqlMarshaller' that is decoding it.
@since 0.10.0.0
@since 1.0.0.0
-}
data MarshallErrorDetails
= -- | Indicates that a one ore more values in a columns could not be decoded,
@ -129,7 +129,7 @@ data MarshallErrorDetails
Renders a 'MarshallErrorDetails' to a 'String' with a specified
'ErrorDetailLevel'.
@since 0.10.0.0
@since 1.0.0.0
-}
renderMarshallErrorDetails :: ErrorDetailLevel -> MarshallErrorDetails -> String
renderMarshallErrorDetails detailLevel err =
@ -141,7 +141,7 @@ renderMarshallErrorDetails detailLevel err =
Details about an error that occurred while decoding values found a SQL
result set.
@since 0.10.0.0
@since 1.0.0.0
-}
data DecodingErrorDetails = DecodingErrorDetails
{ decodingErrorValues :: [(B8.ByteString, SqlValue.SqlValue)]
@ -152,7 +152,7 @@ data DecodingErrorDetails = DecodingErrorDetails
Renders a 'DecodingErrorDetails to a 'String' with a specified
'ErrorDetailLevel'.
@since 0.10.0.0
@since 1.0.0.0
-}
renderDecodingErrorDetails :: ErrorDetailLevel -> DecodingErrorDetails -> String
renderDecodingErrorDetails detailLevel details =
@ -174,7 +174,7 @@ renderDecodingErrorDetails detailLevel details =
Details about an column that was found to be missing in a SQL result set
during decoding.
@since 0.10.0.0
@since 1.0.0.0
-}
data MissingColumnErrorDetails = MissingColumnErrorDetails
{ missingColumnName :: B8.ByteString
@ -185,7 +185,7 @@ data MissingColumnErrorDetails = MissingColumnErrorDetails
Renders a 'MissingColumnErrorDetails' to a 'String' with a specified
'ErrorDetailLevel'.
@since 0.10.0.0
@since 1.0.0.0
-}
renderMissingColumnErrorDetails :: ErrorDetailLevel -> MissingColumnErrorDetails -> String
renderMissingColumnErrorDetails detailLevel details =

View File

@ -14,7 +14,7 @@ most cases you construct a 'SqlMarshaller' as part of building you
other cases you might use a 'SqlMarshaller' with a lower-level Orville
function. For instance, to decode the result set of a custom SQL query.
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Marshall.SqlMarshaller
( SqlMarshaller
@ -80,7 +80,7 @@ import qualified Orville.PostgreSQL.Schema.ConstraintDefinition as ConstraintDef
'SqlMarshaller' yourself so that rows can be identified. See
'annotateSqlMarshaller' and 'annotateSqlMarshallerEmptyAnnotation'.
@since 0.10.0.0
@since 1.0.0.0
-}
data AnnotatedSqlMarshaller writeEntity readEntity = AnnotatedSqlMarshaller
{ rowIdFieldNames :: [FieldName]
@ -93,7 +93,7 @@ data AnnotatedSqlMarshaller writeEntity readEntity = AnnotatedSqlMarshaller
in the list that are not present in the result set will simply be omitted
from the error message.
@since 0.10.0.0
@since 1.0.0.0
-}
annotateSqlMarshaller ::
[FieldName] ->
@ -106,7 +106,7 @@ annotateSqlMarshaller =
Creates an 'AnnotatedSqlMarshaller' that will identify rows in decoding
errors by any columns. This is the equivalent of @annotateSqlMarshaller []@.
@since 0.10.0.0
@since 1.0.0.0
-}
annotateSqlMarshallerEmptyAnnotation ::
SqlMarshaller writeEntity readEntity ->
@ -118,7 +118,7 @@ annotateSqlMarshallerEmptyAnnotation =
Applies the provided function to a 'SqlMarshaller' that has been annotated,
preserving the annotations.
@since 0.10.0.0
@since 1.0.0.0
-}
mapSqlMarshaller ::
(SqlMarshaller readEntityA writeEntityA -> SqlMarshaller readEntityB writeEntityB) ->
@ -134,7 +134,7 @@ mapSqlMarshaller f (AnnotatedSqlMarshaller rowIdFields marshaller) =
and work with them as potentially nested Haskell records. We can then
"marshall" the data as we want to model it in sql and Haskell.
@since 0.10.0.0
@since 1.0.0.0
-}
data SqlMarshaller a b where
-- | Our representation of 'pure' in the 'Applicative' sense
@ -168,7 +168,7 @@ instance Applicative (SqlMarshaller a) where
select statement to select values from the database for the 'SqlMarshaller'
decode.
@since 0.10.0.0
@since 1.0.0.0
-}
marshallerDerivedColumns ::
SqlMarshaller writeEntity readEntity ->
@ -196,7 +196,7 @@ marshallerDerivedColumns marshaller =
Returns the table constraints for all the 'FieldDefinition's used in the
'SqlMarshaller'.
@since 0.10.0.0
@since 1.0.0.0
-}
marshallerTableConstraints ::
SqlMarshaller writeEntity readEntity ->
@ -222,7 +222,7 @@ marshallerTableConstraints marshaller =
'foldMarshallerFields' to provided the entry from the mashaller to the
folding function to be incorporate in the result of the fold.
@since 0.10.0.0
@since 1.0.0.0
-}
data MarshallerField writeEntity where
Natural :: FieldDefinition nullability a -> Maybe (writeEntity -> a) -> MarshallerField writeEntity
@ -237,7 +237,7 @@ data MarshallerField writeEntity where
the marshaller. You should only use 'collectFromField' in situations where
you only care about the actual columns referenced by the marshaller.
@since 0.10.0.0
@since 1.0.0.0
-}
collectFromField ::
ReadOnlyColumnOption ->
@ -261,7 +261,7 @@ collectFromField readOnlyColumnOption fromField entry results =
that will set columns of the field defintions to their corresponding value
found in the Haskell @writeEntity@ value.
@since 0.10.0.0
@since 1.0.0.0
-}
marshallEntityToSetClauses ::
SqlMarshaller writeEntity readEntity ->
@ -277,7 +277,7 @@ marshallEntityToSetClauses marshaller writeEntity =
An internal helper function that collects the 'Expr.SetClause's to
update all the fields contained in a 'SqlMarshaller'
@since 0.10.0.0
@since 1.0.0.0
-}
collectSetClauses ::
entity ->
@ -297,7 +297,7 @@ collectSetClauses entity entry clauses =
Specifies whether read-only fields should be included when using functions
such as 'collectFromField' and 'marshallerColumnNames'.
@since 0.10.0.0
@since 1.0.0.0
-}
data ReadOnlyColumnOption
= IncludeReadOnlyColumns
@ -309,7 +309,7 @@ data ReadOnlyColumnOption
required. This can be used to collect the names of all the fields, encode
them to 'SqlValue', etc.
@since 0.10.0.0
@since 1.0.0.0
-}
foldMarshallerFields ::
SqlMarshaller writeEntity readEntity ->
@ -325,7 +325,7 @@ foldMarshallerFields marshaller =
the overall 'writeEntity' that the 'SqlMarshaller' is build on. 'MarshallNest'
adds more nesting by composing its accessor with the one given here.
@since 0.10.0.0
@since 1.0.0.0
-}
foldMarshallerFieldsPart ::
SqlMarshaller entityPart readEntity ->
@ -364,7 +364,7 @@ foldMarshallerFieldsPart marshaller getPart currentResult addToResult =
Note that this function loads are decoded rows into memory at once, so it
should only be used with result sets that you know will fit into memory.
@since 0.10.0.0
@since 1.0.0.0
-}
marshallResultFromSql ::
ExecutionResult result =>
@ -389,7 +389,7 @@ marshallResultFromSql errorDetailLevel marshallerWithMeta result =
Note that this function loads are decoded rows into memory at once, so it
should only be used with result sets that you know will fit into memory.
@since 0.10.0.0
@since 1.0.0.0
-}
marshallResultFromSqlUsingRowIdExtractor ::
ExecutionResult result =>
@ -434,7 +434,7 @@ traverseSequence f =
database server into a Haskell value. If the decoding fails, a 'MarshallError'
will be returned.
@since 0.10.0.0
@since 1.0.0.0
-}
decodeRow ::
ErrorDetailLevel ->
@ -469,7 +469,7 @@ decodeRow errorDetailLevel (RowSource source) (RowIdentityExtractor getRowId) ro
As such, you can't use 'RowSource' (alone) to achieve any form of streaming
or pagination of rows between the database server and the client.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype RowSource readEntity
= RowSource (Row -> IO (Either MarshallError.MarshallErrorDetails readEntity))
@ -485,7 +485,7 @@ instance Applicative RowSource where
Adds a function to the decoding proocess to transform the value returned
by a 'RowSource'.
@since 0.10.0.0
@since 1.0.0.0
-}
mapRowSource :: (a -> b) -> RowSource a -> RowSource b
mapRowSource f (RowSource decodeA) =
@ -495,7 +495,7 @@ mapRowSource f (RowSource decodeA) =
Creates a 'RowSource' that always returns the value given, rather than
attempting to access the result set and decoding anything.
@since 0.10.0.0
@since 1.0.0.0
-}
constRowSource :: readEntity -> RowSource readEntity
constRowSource =
@ -505,7 +505,7 @@ constRowSource =
Applies a function that will be decoded from the result set to another
value decode from the result set.
@since 0.10.0.0
@since 1.0.0.0
-}
applyRowSource :: RowSource (a -> b) -> RowSource a -> RowSource b
applyRowSource (RowSource decodeAtoB) (RowSource decodeA) =
@ -526,7 +526,7 @@ applyRowSource (RowSource decodeAtoB) (RowSource decodeA) =
For instance, this is used internally when a 'FieldDefinition' references
a column that does not exist in the result set.
@since 0.10.0.0
@since 1.0.0.0
-}
failRowSource :: MarshallError.MarshallErrorDetails -> RowSource a
failRowSource =
@ -539,7 +539,7 @@ failRowSource =
held in memory for potential decoding until the 'RowSource' is garbage
collected.
@since 0.10.0.0
@since 1.0.0.0
-}
mkRowSource ::
ExecutionResult result =>
@ -632,7 +632,7 @@ partialRowSource fieldNames columnMap result (RowSource f) =
Builds a 'RowSource' that will retrieve and decode the name field from
the result.
@since 0.10.0.0
@since 1.0.0.0
-}
mkFieldNameSource ::
ExecutionResult result =>
@ -656,7 +656,7 @@ mkFieldNameSource sourceFieldName fromSqlValue columnMap result =
An internal helper function that finds all the column names in a result set
and associates them with the respective column numbers for easier lookup.
@since 0.10.0.0
@since 1.0.0.0
-}
prepareColumnMap ::
ExecutionResult result =>
@ -687,7 +687,7 @@ prepareColumnMap result = do
A internal helper function for to build a 'RowSource' that retrieves and
decodes a single column value form the result set.
@since 0.10.0.0
@since 1.0.0.0
-}
mkColumnRowSource ::
ExecutionResult result =>
@ -723,7 +723,7 @@ mkColumnRowSource sourceFieldName fromSqlValue result column =
you would like rows to be identified by and then use 'marshallResultFromSql'
instead.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype RowIdentityExtractor
= RowIdentityExtractor (Row -> IO [(B8.ByteString, SqlValue.SqlValue)])
@ -734,7 +734,7 @@ newtype RowIdentityExtractor
named fields that are missing from the result set not be included in the
extracted row identity.
@since 0.10.0.0
@since 1.0.0.0
-}
mkRowIdentityExtractor ::
ExecutionResult result =>
@ -787,7 +787,7 @@ mkRowIdentityExtractor fields result =
@
@since 0.10.0.0
@since 1.0.0.0
-}
marshallField ::
(writeEntity -> fieldValue) ->
@ -822,7 +822,7 @@ marshallField accessor fieldDef =
}
@
@since 0.10.0.0
@since 1.0.0.0
-}
marshallSyntheticField ::
SyntheticField fieldValue ->
@ -863,7 +863,7 @@ marshallSyntheticField =
<*> marshallField lastName lastNameField
@
@since 0.10.0.0
@since 1.0.0.0
-}
marshallNested ::
(parentEntity -> nestedWriteEntity) ->
@ -876,7 +876,7 @@ marshallNested =
Lifts a 'SqlMarshaller' to have both read/write entities be 'Maybe',
and applies a tag to avoid double mapping.
@since 0.10.0.0
@since 1.0.0.0
-}
marshallMaybe :: SqlMarshaller a b -> SqlMarshaller (Maybe a) (Maybe b)
marshallMaybe =
@ -911,7 +911,7 @@ marshallMaybe =
Builds a 'SqlMarshaller' that will raise a decoding error when the value
produced is a 'Left'.
@since 0.10.0.0
@since 1.0.0.0
-}
marshallPartial :: SqlMarshaller a (Either String b) -> SqlMarshaller a b
marshallPartial = MarshallPartial
@ -920,7 +920,7 @@ marshallPartial = MarshallPartial
Adds a prefix, followed by an underscore, to the names of all of the fields
and synthetic fields in a 'SqlMarshaller'.
@since 0.10.0.0
@since 1.0.0.0
-}
prefixMarshaller ::
String ->
@ -948,7 +948,7 @@ prefixMarshaller prefix = go
read any values from the @writeEntity@. You should use this if you have
a group of fields which are populated by database rather than the application.
@since 0.10.0.0
@since 1.0.0.0
-}
marshallReadOnly :: SqlMarshaller a b -> SqlMarshaller c b
marshallReadOnly = MarshallReadOnly
@ -959,7 +959,7 @@ marshallReadOnly = MarshallReadOnly
'FieldDefinition' like @serialField@ where the valuue is populated by the
database.
@since 0.10.0.0
@since 1.0.0.0
-}
marshallReadOnlyField ::
FieldDefinition nullability fieldValue ->

View File

@ -10,7 +10,7 @@ Orville does not provide support for here, you can construct your own 'SqlType'
value and use 'Orville.PostgreSQL.Marshall.fieldOfType' to build the required
'Orville.PostgreSQL.Marshall.FieldDefinition'.
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Marshall.SqlType
( SqlType
@ -69,7 +69,7 @@ import qualified Orville.PostgreSQL.Raw.SqlValue as SqlValue
read from the database as well as the schema information required to create
and migrate columns using the type.
@since 0.10.0.0
@since 1.0.0.0
-}
data SqlType a = SqlType
{ sqlTypeExpr :: Expr.DataType
@ -104,7 +104,7 @@ data SqlType a = SqlType
{- |
'integer' defines a 32-bit integer type. This corresponds to the "INTEGER" type in SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
integer :: SqlType Int32
integer =
@ -122,7 +122,7 @@ integer =
'serial' defines a 32-bit auto-incrementing column type. This corresponds to
the "SERIAL" type in PostgreSQL.
@since 0.10.0.0
@since 1.0.0.0
-}
serial :: SqlType Int32
serial =
@ -140,7 +140,7 @@ serial =
'bigInteger' defines a 64-bit integer type. This corresponds to the "BIGINT"
type in SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
bigInteger :: SqlType Int64
bigInteger =
@ -158,7 +158,7 @@ bigInteger =
'bigSerial' defines a 64-bit auto-incrementing column type. This corresponds to
the "BIGSERIAL" type in PostgresSQL.
@since 0.10.0.0
@since 1.0.0.0
-}
bigSerial :: SqlType Int64
bigSerial =
@ -175,7 +175,7 @@ bigSerial =
{- |
'smallInteger' defines a 16-bit integer type. This corresponds to the "SMALLINT" type in SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
smallInteger :: SqlType Int16
smallInteger =
@ -193,7 +193,7 @@ smallInteger =
'double' defines a floating point numeric type. This corresponds to the "DOUBLE
PRECISION" type in SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
double :: SqlType Double
double =
@ -211,7 +211,7 @@ double =
'boolean' defines a True/False boolean type. This corresponds to the "BOOLEAN"
type in SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
boolean :: SqlType Bool
boolean =
@ -229,7 +229,7 @@ boolean =
'unboundedText' defines a unbounded length text field type. This corresponds to a
"TEXT" type in PostgreSQL.
@since 0.10.0.0
@since 1.0.0.0
-}
unboundedText :: SqlType Text
unboundedText =
@ -247,7 +247,7 @@ unboundedText =
'fixedText' defines a fixed length text field type. This corresponds to a
"CHAR(len)" type in PostgreSQL.
@since 0.10.0.0
@since 1.0.0.0
-}
fixedText :: Int32 -> SqlType Text
fixedText len =
@ -265,7 +265,7 @@ fixedText len =
'boundedText' defines a variable length text field type. This corresponds to a
"VARCHAR(len)" type in PostgreSQL.
@since 0.10.0.0
@since 1.0.0.0
-}
boundedText :: Int32 -> SqlType Text
boundedText len =
@ -283,7 +283,7 @@ boundedText len =
'textSearchVector' defines a type for indexed text searching. It corresponds to the
"TSVECTOR" type in PostgreSQL.
@since 0.10.0.0
@since 1.0.0.0
-}
textSearchVector :: SqlType Text
textSearchVector =
@ -300,7 +300,7 @@ textSearchVector =
{- |
'uuid' defines a UUID type. It corresponds to the "UUID" type in PostgreSQL.
@since 0.10.0.0
@since 1.0.0.0
-}
uuid :: SqlType UUID.UUID
uuid =
@ -324,7 +324,7 @@ uuid =
'date' defines a type representing a calendar date (without time zone). It corresponds
to the "DATE" type in SQL.
@since 0.10.0.0
@since 1.0.0.0
-}
date :: SqlType Time.Day
date =
@ -348,7 +348,7 @@ date =
involving this type, please see Chris Clark's blog post about it:
http://blog.untrod.com/2016/08/actually-understanding-timezones-in-postgresql.html
@since 0.10.0.0
@since 1.0.0.0
-}
timestamp :: SqlType Time.UTCTime
timestamp =
@ -368,7 +368,7 @@ timestamp =
http://blog.untrod.com/2016/08/actually-understanding-timezones-in-postgresql.html
@since 0.10.0.0
@since 1.0.0.0
-}
timestampWithoutZone :: SqlType Time.LocalTime
timestampWithoutZone =
@ -386,7 +386,7 @@ timestampWithoutZone =
'jsonb' represents any type that can be converted To and From JSON. This corresponds
to the "JSONB" type in PostgreSQL.
@since 0.10.0.0
@since 1.0.0.0
-}
jsonb :: SqlType Text
jsonb =
@ -404,7 +404,7 @@ jsonb =
'oid' corresponds to the type used in PostgreSQL for identifying system
objects
@since 0.10.0.0
@since 1.0.0.0
-}
oid :: SqlType LibPQ.Oid
oid =
@ -427,7 +427,7 @@ oid =
special handling required when creating foreign reference types by setting
the 'sqlTypeReferenceExpr' field to an appropriate value.
@since 0.10.0.0
@since 1.0.0.0
-}
foreignRefType :: SqlType a -> SqlType a
foreignRefType sqlType =
@ -443,7 +443,7 @@ foreignRefType sqlType =
an 'a' value from the database, the conversion function should produce 'Left
with an error message if the value cannot be successfully converted to a 'b'
@since 0.10.0.0
@since 1.0.0.0
-}
tryConvertSqlType :: (b -> a) -> (a -> Either String b) -> SqlType a -> SqlType b
tryConvertSqlType bToA aToB sqlType =
@ -458,7 +458,7 @@ tryConvertSqlType bToA aToB sqlType =
'convertSqlType' changes the Haskell type used by a 'SqlType' in the same manner
as 'tryConvertSqlType' in cases where an 'a' can always be converted to a 'b'.
@since 0.10.0.0
@since 1.0.0.0
-}
convertSqlType :: (b -> a) -> (a -> b) -> SqlType a -> SqlType b
convertSqlType bToA aToB =

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Marshall.SyntheticField
( SyntheticField
@ -28,7 +28,7 @@ import qualified Orville.PostgreSQL.Raw.SqlValue as SqlValue
columns of a table when records are selected from the database. Synthetic
fields are inherently read-only.
@since 0.10.0.0
@since 1.0.0.0
-}
data SyntheticField a = SyntheticField
{ _syntheticFieldExpression :: Expr.ValueExpression
@ -40,7 +40,7 @@ data SyntheticField a = SyntheticField
Returns the SQL expression that should be in with select statements to
calculated the sythetic field.
@since 0.10.0.0
@since 1.0.0.0
-}
syntheticFieldExpression :: SyntheticField a -> Expr.ValueExpression
syntheticFieldExpression =
@ -50,7 +50,7 @@ syntheticFieldExpression =
Returns the alias that should be used in select statements to name the
the synthetic field.
@since 0.10.0.0
@since 1.0.0.0
-}
syntheticFieldAlias :: SyntheticField a -> FieldName
syntheticFieldAlias =
@ -60,7 +60,7 @@ syntheticFieldAlias =
Decodes a calculated value selected from the database to its expected
Haskell type. Returns a 'Left' with an error message if the decoding fails.
@since 0.10.0.0
@since 1.0.0.0
-}
syntheticFieldValueFromSqlValue :: SyntheticField a -> SqlValue.SqlValue -> Either String a
syntheticFieldValueFromSqlValue =
@ -70,7 +70,7 @@ syntheticFieldValueFromSqlValue =
Constructs a 'SyntheticField' that will select a SQL expression using
the given alias.
@since 0.10.0.0
@since 1.0.0.0
-}
syntheticField ::
-- | The SQL expression to be selected
@ -90,7 +90,7 @@ syntheticField expression alias fromSqlValue =
{- |
Modifies a 'SyntheticField' to allow it to decode @NULL@ values.
@since 0.10.0.0
@since 1.0.0.0
-}
nullableSyntheticField :: SyntheticField a -> SyntheticField (Maybe a)
nullableSyntheticField synthField =
@ -105,7 +105,7 @@ nullableSyntheticField synthField =
Adds a prefix, followed by an underscore, to the alias used to name the
synthetic field.
@since 0.10.0.0
@since 1.0.0.0
-}
prefixSyntheticField ::
String ->

View File

@ -10,7 +10,7 @@ related to managing Orville context within an application Monad. This includes
a number of lowel-level items not exported by "Orville.PostgreSQL" that give
you more control (and therefore responsibility) over the Monad context.
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Monad
( module Orville.PostgreSQL.Monad.Orville

View File

@ -6,7 +6,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Monad.HasOrvilleState
( HasOrvilleState (askOrvilleState, localOrvilleState)
@ -50,14 +50,14 @@ import Orville.PostgreSQL.OrvilleState (OrvilleState)
An instance for 'ReaderT OrvilleState m' is provided as a convenience in
the case that your application has no extra context to track.
@since 0.10.0.0
@since 1.0.0.0
-}
class HasOrvilleState m where
-- |
-- Fetches the current 'OrvilleState' from the host Monad context. The
-- equivalent of 'ask' for 'ReaderT OrvilleState'
--
-- @since 0.10.0.0
-- @since 1.0.0.0
askOrvilleState :: m OrvilleState
-- |
@ -67,7 +67,7 @@ class HasOrvilleState m where
-- the given 'm a' and not persisted beyond it. The equivalent of 'local'
-- for 'ReaderT OrvilleState'
--
-- @since 0.10.0.0
-- @since 1.0.0.0
localOrvilleState ::
-- | The function to modify the 'OrvilleState'
(OrvilleState -> OrvilleState) ->

View File

@ -6,7 +6,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Monad.MonadOrville
( MonadOrville
@ -49,7 +49,7 @@ import Orville.PostgreSQL.Raw.Connection (Connection)
to your module and then let the compiler tell you what instances you
are missing from the superclasses.
@since 0.10.0.0
@since 1.0.0.0
-}
class
( HasOrvilleState m
@ -75,14 +75,14 @@ class
implementation of the methods below for monads that implement
'MonadUnliftIO'.
@since 0.10.0.0
@since 1.0.0.0
-}
class MonadOrvilleControl m where
-- |
-- Orville will use this function to lift the acquisition of connections
-- from the resource pool into the application monad.
--
-- @since 0.10.0.0
-- @since 1.0.0.0
liftWithConnection ::
(forall a. (Connection -> IO a) -> IO a) -> (Connection -> m b) -> m b
@ -90,7 +90,7 @@ class MonadOrvilleControl m where
-- Orville will use this function to lift exception catches into the
-- application monad.
--
-- @since 0.10.0.0
-- @since 1.0.0.0
liftCatch ::
Exception e =>
(forall a. IO a -> (e -> IO a) -> IO a) ->
@ -103,7 +103,7 @@ class MonadOrvilleControl m where
-- monad to guarantee resource cleanup is executed even when asynchrouns
-- exceptions are thrown.
--
-- @since 0.10.0.0
-- @since 1.0.0.0
liftMask ::
(forall b. ((forall a. IO a -> IO a) -> IO b) -> IO b) ->
((forall a. m a -> m a) -> m c) ->
@ -149,7 +149,7 @@ instance (MonadOrvilleControl m, MonadIO m) => MonadOrville (ReaderT OrvilleStat
exception handling will take effect, generally destroying the connection in
case it was the source of the error.
@since 0.10.0.0
@since 1.0.0.0
-}
withConnection :: MonadOrville m => (Connection -> m a) -> m a
withConnection connectedAction = do
@ -164,7 +164,7 @@ withConnection connectedAction = do
'withTransaction' each database operation may be performed on a different
connection.
@since 0.10.0.0
@since 1.0.0.0
-}
withConnection_ :: MonadOrville m => m a -> m a
withConnection_ =
@ -174,7 +174,7 @@ withConnection_ =
INTERNAL: This in an internal version of 'withConnection' that gives access to
the entire 'ConnectedState' value to allow for transaction management.
@since 0.10.0.0
@since 1.0.0.0
-}
withConnectedState :: MonadOrville m => (ConnectedState -> m a) -> m a
withConnectedState connectedAction = do

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.Monad.Orville
( Orville
@ -33,7 +33,7 @@ import Orville.PostgreSQL.Raw.Connection (Connection)
If you want add Orville capabilities to your own monad, take a look at
'MonadOrville' to learn what needs to be done.
@since 0.10.0.0
@since 1.0.0.0
-}
newtype Orville a = Orville
{ unwrapOrville :: ReaderT OrvilleState.OrvilleState IO a
@ -59,7 +59,7 @@ newtype Orville a = Orville
'OrvilleState.newOrvilleState' to create a state with the desired detail
level and then use 'runOrvilleWithState'.
@since 0.10.0.0
@since 1.0.0.0
-}
runOrville :: Pool Connection -> Orville a -> IO a
runOrville =
@ -79,7 +79,7 @@ runOrville =
On the other hand, if you know that you want to pass the existing connection
state from another monad into the 'Orville' monad, this is how you do it.
@since 0.10.0.0
@since 1.0.0.0
-}
runOrvilleWithState :: OrvilleState.OrvilleState -> Orville a -> IO a
runOrvilleWithState state orville =

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.OrvilleState
( OrvilleState.OrvilleState

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.PgCatalog
( module Export

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.PgCatalog.DatabaseDescription
( DatabaseDescription (..)
@ -47,7 +47,7 @@ import qualified Orville.PostgreSQL.Plan.Operation as Op
'describeDatabaseRelations' can be used to load the descriptions of request
items.
@since 0.10.0.0
@since 1.0.0.0
-}
data DatabaseDescription = DatabaseDescription
{ databaseRelations :: Map.Map (NamespaceName, RelationName) RelationDescription
@ -56,7 +56,7 @@ data DatabaseDescription = DatabaseDescription
{- |
Lookup a relation by its qualified name in the @pg_catalog@ schema.
@since 0.10.0.0
@since 1.0.0.0
-}
lookupRelation ::
(NamespaceName, RelationName) ->
@ -69,7 +69,7 @@ lookupRelation key =
Lookup a relation by its qualified name in the @pg_catalog@ schema. If the
relation is not of the expected kind, 'Nothing' is returned.
@since 0.10.0.0
@since 1.0.0.0
-}
lookupRelationOfKind ::
RelationKind ->
@ -89,7 +89,7 @@ lookupRelationOfKind kind key dbDesc =
A description of a particular relation in the PostgreSQL database, including
the attributes of the relation.
@since 0.10.0.0
@since 1.0.0.0
-}
data RelationDescription = RelationDescription
{ relationRecord :: PgClass
@ -103,7 +103,7 @@ data RelationDescription = RelationDescription
{- |
Find an attribute by name from the 'RelationDescription'
@since 0.10.0.0
@since 1.0.0.0
-}
lookupAttribute ::
AttributeName ->
@ -115,7 +115,7 @@ lookupAttribute key =
{- |
Find an attribute default from the 'RelationDescription'
@since 0.10.0.0
@since 1.0.0.0
-}
lookupAttributeDefault ::
PgAttribute ->
@ -128,7 +128,7 @@ lookupAttributeDefault attr =
A description of a particular constraint in the PostgreSQL database, including
the attributes and relations that it references.
@since 0.10.0.0
@since 1.0.0.0
-}
data ConstraintDescription = ConstraintDescription
{ constraintRecord :: PgConstraint
@ -141,7 +141,7 @@ data ConstraintDescription = ConstraintDescription
A description of a relation in the PostgreSQL database that is referenced by
a foreign key constraint, including the namespace that the relation belongs to.
@since 0.10.0.0
@since 1.0.0.0
-}
data ForeignRelationDescription = ForeignRelationDescription
{ foreignRelationClass :: PgClass
@ -153,7 +153,7 @@ data ForeignRelationDescription = ForeignRelationDescription
the attributes included in the index and the 'PgClass' record of the index
itself (NOT the 'PgClass' of the table that the index is for).
@since 0.10.0.0
@since 1.0.0.0
-}
data IndexDescription = IndexDescription
{ indexRecord :: PgIndex
@ -166,7 +166,7 @@ data IndexDescription = IndexDescription
is a simple attribute, the 'PgAttribute' for that is provided. If it is an
index over an expression, no further description is currently provided.
@since 0.10.0.0
@since 1.0.0.0
-}
data IndexMember
= IndexAttribute PgAttribute
@ -180,7 +180,7 @@ data IndexMember
Each 'RelationDescription' will contain all the attributes that currently
exist for that relation, according to the @pg_catalog@ tables.
@since 0.10.0.0
@since 1.0.0.0
-}
describeDatabaseRelations ::
Orville.MonadOrville m =>

View File

@ -3,7 +3,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.PgCatalog.OidField
( oidField
@ -19,7 +19,7 @@ import qualified Orville.PostgreSQL.Marshall.SqlType as SqlType
{- |
The @oid@ field found on many (but not all!) @pg_catalog@ tables
@since 0.10.0.0
@since 1.0.0.0
-}
oidField :: Orville.FieldDefinition Orville.NotNull LibPQ.Oid
oidField =
@ -29,7 +29,7 @@ oidField =
Builds a 'Orville.FieldDefinition' with the given column name that stores
an @oid@ value.
@since 0.10.0.0
@since 1.0.0.0
-}
oidTypeField :: String -> Orville.FieldDefinition Orville.NotNull LibPQ.Oid
oidTypeField =

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.PgCatalog.PgAttribute
( PgAttribute (..)
@ -46,7 +46,7 @@ import Orville.PostgreSQL.PgCatalog.OidField (oidTypeField)
See also 'Orville.PostgreSQL.PgCatalog.PgClass'.
@since 0.10.0.0
@since 1.0.0.0
-}
data PgAttribute = PgAttribute
{ pgAttributeRelationOid :: LibPQ.Oid
@ -74,7 +74,7 @@ data PgAttribute = PgAttribute
Returns the maximum length for an attribute with a variable length type,
or 'Nothing' if the length if the type is not variable.
@since 0.10.0.0
@since 1.0.0.0
-}
pgAttributeMaxLength :: PgAttribute -> Maybe Int32
pgAttributeMaxLength attr =
@ -111,7 +111,7 @@ pgAttributeMaxLength attr =
the attribute\'s 'AttributeNumber'. Ordinary columns have attribute numbers
starting at 1.
@since 0.10.0.0
@since 1.0.0.0
-}
isOrdinaryColumn :: PgAttribute -> Bool
isOrdinaryColumn attr =
@ -120,7 +120,7 @@ isOrdinaryColumn attr =
{- |
A Haskell type for the name of the attribute represented by a 'PgAttribute'
@since 0.10.0.0
@since 1.0.0.0
-}
newtype AttributeName
= AttributeName T.Text
@ -129,7 +129,7 @@ newtype AttributeName
{- |
Converts an 'AttributeName' to a plain old string
@since 0.10.0.0
@since 1.0.0.0
-}
attributeNameToString :: AttributeName -> String
attributeNameToString (AttributeName txt) =
@ -138,7 +138,7 @@ attributeNameToString (AttributeName txt) =
{- |
A Haskell type for the number of the attribute represented by a 'PgAttribute'
@since 0.10.0.0
@since 1.0.0.0
-}
newtype AttributeNumber
= AttributeNumber Int16
@ -159,7 +159,7 @@ attributeNumberFromInt16 = AttributeNumber
{- |
Attoparsec parser for 'AttributeNumber'
@since 0.10.0.0
@since 1.0.0.0
-}
attributeNumberParser :: AttoText.Parser AttributeNumber
attributeNumberParser =
@ -168,7 +168,7 @@ attributeNumberParser =
{- |
Encodes an 'AttributeNumber' to lazy text as a builder
@since 0.10.0.0
@since 1.0.0.0
-}
attributeNumberTextBuilder :: AttributeNumber -> LTB.Builder
attributeNumberTextBuilder =
@ -178,7 +178,7 @@ attributeNumberTextBuilder =
An Orville 'Orville.TableDefinition' for querying the
@pg_catalog.pg_attribute@ table
@since 0.10.0.0
@since 1.0.0.0
-}
pgAttributeTable :: Orville.TableDefinition Orville.NoKey PgAttribute PgAttribute
pgAttributeTable =
@ -202,7 +202,7 @@ pgAttributeMarshaller =
{- |
The @attrelid@ column of the @pg_catalog.pg_attribute@ table
@since 0.10.0.0
@since 1.0.0.0
-}
attributeRelationOidField :: Orville.FieldDefinition Orville.NotNull LibPQ.Oid
attributeRelationOidField =
@ -211,7 +211,7 @@ attributeRelationOidField =
{- |
The @attname@ column of the @pg_catalog.pg_attribute@ table
@since 0.10.0.0
@since 1.0.0.0
-}
attributeNameField :: Orville.FieldDefinition Orville.NotNull AttributeName
attributeNameField =
@ -221,7 +221,7 @@ attributeNameField =
{- |
The @attnum@ column of the @pg_catalog.pg_attribute@ table
@since 0.10.0.0
@since 1.0.0.0
-}
attributeNumberField :: Orville.FieldDefinition Orville.NotNull AttributeNumber
attributeNumberField =
@ -230,7 +230,7 @@ attributeNumberField =
{- |
Builds a 'Orville.FieldDefinition' for a field with type 'AttributeNumber'
@since 0.10.0.0
@since 1.0.0.0
-}
attributeNumberTypeField :: String -> Orville.FieldDefinition Orville.NotNull AttributeNumber
attributeNumberTypeField =
@ -239,7 +239,7 @@ attributeNumberTypeField =
{- |
The @atttypid@ column of the @pg_catalog.pg_attribute@ table
@since 0.10.0.0
@since 1.0.0.0
-}
attributeTypeOidField :: Orville.FieldDefinition Orville.NotNull LibPQ.Oid
attributeTypeOidField =
@ -248,7 +248,7 @@ attributeTypeOidField =
{- |
The @attlen@ column of the @pg_catalog.pg_attribute@ table
@since 0.10.0.0
@since 1.0.0.0
-}
attributeLengthField :: Orville.FieldDefinition Orville.NotNull Int16
attributeLengthField =
@ -257,7 +257,7 @@ attributeLengthField =
{- |
The @atttypmod@ column of the @pg_catalog.pg_attribute@ table
@since 0.10.0.0
@since 1.0.0.0
-}
attributeTypeModifierField :: Orville.FieldDefinition Orville.NotNull Int32
attributeTypeModifierField =
@ -266,7 +266,7 @@ attributeTypeModifierField =
{- |
The @attisdropped@ column of the @pg_catalog.pg_attribute@ table
@since 0.10.0.0
@since 1.0.0.0
-}
attributeIsDroppedField :: Orville.FieldDefinition Orville.NotNull Bool
attributeIsDroppedField =
@ -275,7 +275,7 @@ attributeIsDroppedField =
{- |
The @attnotnull@ column of the @pg_catalog.pg_attribute@ table
@since 0.10.0.0
@since 1.0.0.0
-}
attributeIsNotNullField :: Orville.FieldDefinition Orville.NotNull Bool
attributeIsNotNullField =

View File

@ -3,7 +3,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.PgCatalog.PgAttributeDefault
( PgAttributeDefault (..)
@ -25,7 +25,7 @@ import qualified Orville.PostgreSQL.Raw.SqlValue as SqlValue
The Haskell representation of data read from the @pg_catalog.pg_attrdef@
table.
@since 0.10.0.0
@since 1.0.0.0
-}
data PgAttributeDefault = PgAttributeDefault
{ pgAttributeDefaultOid :: LibPQ.Oid
@ -45,7 +45,7 @@ data PgAttributeDefault = PgAttributeDefault
An Orville 'Orville.TableDefinition' for querying the
@pg_catalog.pg_attrdef@ table
@since 0.10.0.0
@since 1.0.0.0
-}
pgAttributeDefaultTable :: Orville.TableDefinition Orville.NoKey PgAttributeDefault PgAttributeDefault
pgAttributeDefaultTable =
@ -65,7 +65,7 @@ pgAttributeDefaultMarshaller =
{- |
The @adrelid@ column of the @pg_catalog.pg_attrdef@ table
@since 0.10.0.0
@since 1.0.0.0
-}
attributeDefaultRelationOidField :: Orville.FieldDefinition Orville.NotNull LibPQ.Oid
attributeDefaultRelationOidField =
@ -74,7 +74,7 @@ attributeDefaultRelationOidField =
{- |
The @adnum@ column of the @pg_catalog.pg_attrdef@ table
@since 0.10.0.0
@since 1.0.0.0
-}
attributeDefaultAttributeNumberField :: Orville.FieldDefinition Orville.NotNull AttributeNumber
attributeDefaultAttributeNumberField =
@ -86,7 +86,7 @@ attributeDefaultAttributeNumberField =
in the column is decompiled by selecting the expression
@pg_get_expr(adbin,adrelid)@.
@since 0.10.0.0
@since 1.0.0.0
-}
attributeDefaultExpressionField :: Orville.SyntheticField T.Text
attributeDefaultExpressionField =

View File

@ -5,7 +5,7 @@ Copyright : Flipstone Technology Partners 2023
License : MIT
Stability : Stable
@since 0.10.0.0
@since 1.0.0.0
-}
module Orville.PostgreSQL.PgCatalog.PgClass
( PgClass (..)
@ -31,7 +31,7 @@ import Orville.PostgreSQL.PgCatalog.OidField (oidField, oidTypeField)
table. Rows in this table correspond to tables, indexes, sequences, views,
materialized views, composite types and TOAST tables.
@since 0.10.0.0
@since 1.0.0.0
-}
data PgClass = PgClass
{ pgClassOid :: LibPQ.Oid
@ -48,7 +48,7 @@ data PgClass = PgClass
{- |
A Haskell type for the name of the relation represented by a 'PgClass'
@since 0.10.0.0
@since 1.0.0.0
-}
newtype RelationName
= RelationName T.Text
@ -57,7 +57,7 @@ newtype RelationName
{- |
Convert a 'RelationName' to a plain 'String'
@since 0.10.0.0
@since 1.0.0.0
-}
relationNameToString :: RelationName -> String
relationNameToString (RelationName text) =
@ -67,7 +67,7 @@ relationNameToString (RelationName text) =
The kind of relation represented by a 'PgClass', as described at
https://www.postgresql.org/docs/13/catalog-pg-class.html.
@since 0.10.0.0
@since 1.0.0.0
-}
data RelationKind
= OrdinaryTable
@ -86,7 +86,7 @@ data RelationKind
An Orville 'Orville.TableDefinition' for querying the
@pg_catalog.pg_class@ table
@since 0.10.0.0
@since 1.0.0.0
-}
pgClassTable :: Orville.TableDefinition (Orville.HasKey LibPQ.Oid) PgClass PgClass
pgClassTable =
@ -107,7 +107,7 @@ pgClassMarshaller =
{- |
The @relnamespace@ column of the @pg_catalog.pg_class@ table
@since 0.10.0.0
@since 1.0.0.0
-}
namespaceOidField :: Orville.FieldDefinition Orville.NotNull LibPQ.Oid
namespaceOidField =
@ -116,7 +116,7 @@ namespaceOidField =
{- |
The @relname@ column of the @pg_catalog.pg_class@ table
@since 0.10.0.0
@since 1.0.0.0
-}
relationNameField :: Orville.FieldDefinition Orville.NotNull RelationName
relationNameField =
@ -126,7 +126,7 @@ relationNameField =
{- |
The @relkind@ column of the @pg_catalog.pg_class@ table
@since 0.10.0.0
@since 1.0.0.0
-}
relationKindField :: Orville.FieldDefinition Orville.NotNull RelationKind
relationKindField =
@ -140,7 +140,7 @@ relationKindField =
See also 'pgTextToRelationKind'
@since 0.10.0.0
@since 1.0.0.0
-}
relationKindToPgText :: RelationKind -> T.Text
relationKindToPgText kind =
@ -163,7 +163,7 @@ relationKindToPgText kind =
See also 'relationKindToPgText'
@since 0.10.0.0
@since 1.0.0.0
-}
pgTextToRelationKind :: T.Text -> Either String RelationKind
pgTextToRelationKind text =

Some files were not shown because too many files have changed in this diff Show More