-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Connection layer between beam and postgres -- -- Beam driver for PostgreSQL, an advanced open-source RDBMS @package beam-postgres @version 0.5.2.1 -- | Data types for Postgres syntax. Access is given mainly for extension -- modules. The types and definitions here are likely to change. module Database.Beam.Postgres.Syntax data PgSyntaxF f [EmitByteString] :: ByteString -> f -> PgSyntaxF f [EmitBuilder] :: Builder -> f -> PgSyntaxF f [EscapeString] :: ByteString -> f -> PgSyntaxF f [EscapeBytea] :: ByteString -> f -> PgSyntaxF f [EscapeIdentifier] :: ByteString -> f -> PgSyntaxF f type PgSyntaxM = F PgSyntaxF -- | A piece of Postgres SQL syntax, which may contain embedded escaped -- byte and text sequences. PgSyntax composes monoidally, and may -- be created with emit, emitBuilder, escapeString, -- escapBytea, and escapeIdentifier. newtype PgSyntax PgSyntax :: PgSyntaxM () -> PgSyntax [buildPgSyntax] :: PgSyntax -> PgSyntaxM () emit :: ByteString -> PgSyntax emitBuilder :: Builder -> PgSyntax escapeString :: ByteString -> PgSyntax escapeBytea :: ByteString -> PgSyntax escapeIdentifier :: ByteString -> PgSyntax pgParens :: PgSyntax -> PgSyntax nextSyntaxStep :: PgSyntaxF f -> f -- | Representation of an arbitrary Postgres command. This is the -- combination of the command syntax (repesented by PgSyntax), as -- well as the type of command (represented by PgCommandType). The -- command type is necessary for us to know how to retrieve results from -- the database. data PgCommandSyntax PgCommandSyntax :: PgCommandType -> PgSyntax -> PgCommandSyntax [pgCommandType] :: PgCommandSyntax -> PgCommandType [fromPgCommand] :: PgCommandSyntax -> PgSyntax data PgCommandType PgCommandTypeQuery :: PgCommandType PgCommandTypeDdl :: PgCommandType PgCommandTypeDataUpdate :: PgCommandType PgCommandTypeDataUpdateReturning :: PgCommandType -- | IsSql92SelectSyntax for Postgres newtype PgSelectSyntax PgSelectSyntax :: PgSyntax -> PgSelectSyntax [fromPgSelect] :: PgSelectSyntax -> PgSyntax newtype PgSelectSetQuantifierSyntax PgSelectSetQuantifierSyntax :: PgSyntax -> PgSelectSetQuantifierSyntax [fromPgSelectSetQuantifier] :: PgSelectSetQuantifierSyntax -> PgSyntax -- | IsSql92InsertSyntax for Postgres newtype PgInsertSyntax PgInsertSyntax :: PgSyntax -> PgInsertSyntax [fromPgInsert] :: PgInsertSyntax -> PgSyntax -- | IsSql92DeleteSyntax for Postgres newtype PgDeleteSyntax PgDeleteSyntax :: PgSyntax -> PgDeleteSyntax [fromPgDelete] :: PgDeleteSyntax -> PgSyntax -- | IsSql92UpdateSyntax for Postgres newtype PgUpdateSyntax PgUpdateSyntax :: PgSyntax -> PgUpdateSyntax [fromPgUpdate] :: PgUpdateSyntax -> PgSyntax newtype PgExpressionSyntax PgExpressionSyntax :: PgSyntax -> PgExpressionSyntax [fromPgExpression] :: PgExpressionSyntax -> PgSyntax newtype PgFromSyntax PgFromSyntax :: PgSyntax -> PgFromSyntax [fromPgFrom] :: PgFromSyntax -> PgSyntax newtype PgTableNameSyntax PgTableNameSyntax :: PgSyntax -> PgTableNameSyntax [fromPgTableName] :: PgTableNameSyntax -> PgSyntax newtype PgComparisonQuantifierSyntax PgComparisonQuantifierSyntax :: PgSyntax -> PgComparisonQuantifierSyntax [fromPgComparisonQuantifier] :: PgComparisonQuantifierSyntax -> PgSyntax newtype PgExtractFieldSyntax PgExtractFieldSyntax :: PgSyntax -> PgExtractFieldSyntax [fromPgExtractField] :: PgExtractFieldSyntax -> PgSyntax newtype PgProjectionSyntax PgProjectionSyntax :: PgSyntax -> PgProjectionSyntax [fromPgProjection] :: PgProjectionSyntax -> PgSyntax newtype PgGroupingSyntax PgGroupingSyntax :: PgSyntax -> PgGroupingSyntax [fromPgGrouping] :: PgGroupingSyntax -> PgSyntax data PgOrderingSyntax PgOrderingSyntax :: PgSyntax -> Maybe PgNullOrdering -> PgOrderingSyntax [pgOrderingSyntax] :: PgOrderingSyntax -> PgSyntax [pgOrderingNullOrdering] :: PgOrderingSyntax -> Maybe PgNullOrdering newtype PgValueSyntax PgValueSyntax :: PgSyntax -> PgValueSyntax [fromPgValue] :: PgValueSyntax -> PgSyntax newtype PgTableSourceSyntax PgTableSourceSyntax :: PgSyntax -> PgTableSourceSyntax [fromPgTableSource] :: PgTableSourceSyntax -> PgSyntax newtype PgFieldNameSyntax PgFieldNameSyntax :: PgSyntax -> PgFieldNameSyntax [fromPgFieldName] :: PgFieldNameSyntax -> PgSyntax newtype PgAggregationSetQuantifierSyntax PgAggregationSetQuantifierSyntax :: PgSyntax -> PgAggregationSetQuantifierSyntax [fromPgAggregationSetQuantifier] :: PgAggregationSetQuantifierSyntax -> PgSyntax newtype PgInsertValuesSyntax PgInsertValuesSyntax :: PgSyntax -> PgInsertValuesSyntax [fromPgInsertValues] :: PgInsertValuesSyntax -> PgSyntax newtype PgInsertOnConflictSyntax PgInsertOnConflictSyntax :: PgSyntax -> PgInsertOnConflictSyntax [fromPgInsertOnConflict] :: PgInsertOnConflictSyntax -> PgSyntax newtype PgInsertOnConflictTargetSyntax PgInsertOnConflictTargetSyntax :: PgSyntax -> PgInsertOnConflictTargetSyntax [fromPgInsertOnConflictTarget] :: PgInsertOnConflictTargetSyntax -> PgSyntax newtype PgConflictActionSyntax PgConflictActionSyntax :: PgSyntax -> PgConflictActionSyntax [fromPgConflictAction] :: PgConflictActionSyntax -> PgSyntax newtype PgCreateTableSyntax PgCreateTableSyntax :: PgSyntax -> PgCreateTableSyntax [fromPgCreateTable] :: PgCreateTableSyntax -> PgSyntax data PgTableOptionsSyntax PgTableOptionsSyntax :: PgSyntax -> PgSyntax -> PgTableOptionsSyntax newtype PgColumnSchemaSyntax PgColumnSchemaSyntax :: PgSyntax -> PgColumnSchemaSyntax [fromPgColumnSchema] :: PgColumnSchemaSyntax -> PgSyntax data PgDataTypeSyntax PgDataTypeSyntax :: PgDataTypeDescr -> PgSyntax -> BeamSerializedDataType -> PgDataTypeSyntax [pgDataTypeDescr] :: PgDataTypeSyntax -> PgDataTypeDescr [fromPgDataType] :: PgDataTypeSyntax -> PgSyntax [pgDataTypeSerialized] :: PgDataTypeSyntax -> BeamSerializedDataType data PgColumnConstraintDefinitionSyntax PgColumnConstraintDefinitionSyntax :: PgSyntax -> BeamSerializedConstraintDefinition -> PgColumnConstraintDefinitionSyntax [fromPgColumnConstraintDefinition] :: PgColumnConstraintDefinitionSyntax -> PgSyntax [pgColumnConstraintDefinitionSerialized] :: PgColumnConstraintDefinitionSyntax -> BeamSerializedConstraintDefinition data PgColumnConstraintSyntax PgColumnConstraintSyntax :: PgSyntax -> BeamSerializedConstraint -> PgColumnConstraintSyntax [fromPgColumnConstraint] :: PgColumnConstraintSyntax -> PgSyntax [pgColumnConstraintSerialized] :: PgColumnConstraintSyntax -> BeamSerializedConstraint newtype PgTableConstraintSyntax PgTableConstraintSyntax :: PgSyntax -> PgTableConstraintSyntax [fromPgTableConstraint] :: PgTableConstraintSyntax -> PgSyntax data PgMatchTypeSyntax PgMatchTypeSyntax :: PgSyntax -> BeamSerializedMatchType -> PgMatchTypeSyntax [fromPgMatchType] :: PgMatchTypeSyntax -> PgSyntax [pgMatchTypeSerialized] :: PgMatchTypeSyntax -> BeamSerializedMatchType data PgReferentialActionSyntax PgReferentialActionSyntax :: PgSyntax -> BeamSerializedReferentialAction -> PgReferentialActionSyntax [fromPgReferentialAction] :: PgReferentialActionSyntax -> PgSyntax [pgReferentialActionSerialized] :: PgReferentialActionSyntax -> BeamSerializedReferentialAction newtype PgAlterTableSyntax PgAlterTableSyntax :: PgSyntax -> PgAlterTableSyntax [fromPgAlterTable] :: PgAlterTableSyntax -> PgSyntax newtype PgAlterTableActionSyntax PgAlterTableActionSyntax :: PgSyntax -> PgAlterTableActionSyntax [fromPgAlterTableAction] :: PgAlterTableActionSyntax -> PgSyntax newtype PgAlterColumnActionSyntax PgAlterColumnActionSyntax :: PgSyntax -> PgAlterColumnActionSyntax [fromPgAlterColumnAction] :: PgAlterColumnActionSyntax -> PgSyntax newtype PgWindowFrameSyntax PgWindowFrameSyntax :: PgSyntax -> PgWindowFrameSyntax [fromPgWindowFrame] :: PgWindowFrameSyntax -> PgSyntax newtype PgWindowFrameBoundsSyntax PgWindowFrameBoundsSyntax :: PgSyntax -> PgWindowFrameBoundsSyntax [fromPgWindowFrameBounds] :: PgWindowFrameBoundsSyntax -> PgSyntax newtype PgWindowFrameBoundSyntax PgWindowFrameBoundSyntax :: (ByteString -> PgSyntax) -> PgWindowFrameBoundSyntax [fromPgWindowFrameBound] :: PgWindowFrameBoundSyntax -> ByteString -> PgSyntax data PgSelectLockingClauseSyntax PgSelectLockingClauseSyntax :: PgSelectLockingStrength -> [Text] -> Maybe PgSelectLockingOptions -> PgSelectLockingClauseSyntax [pgSelectLockingClauseStrength] :: PgSelectLockingClauseSyntax -> PgSelectLockingStrength [pgSelectLockingTables] :: PgSelectLockingClauseSyntax -> [Text] [pgSelectLockingClauseOptions] :: PgSelectLockingClauseSyntax -> Maybe PgSelectLockingOptions -- | Specifies the level of lock that will be taken against a row. See -- the manual section for more information. data PgSelectLockingStrength -- |
--   UPDATE
--   
PgSelectLockingStrengthUpdate :: PgSelectLockingStrength -- |
--   NO KEY UPDATE
--   
PgSelectLockingStrengthNoKeyUpdate :: PgSelectLockingStrength -- |
--   SHARE
--   
PgSelectLockingStrengthShare :: PgSelectLockingStrength -- |
--   KEY SHARE
--   
PgSelectLockingStrengthKeyShare :: PgSelectLockingStrength -- | Specifies how we should handle lock conflicts. -- -- See the manual section for more information data PgSelectLockingOptions -- | NOWAIT. Report an error rather than waiting for the lock PgSelectLockingOptionsNoWait :: PgSelectLockingOptions -- | SKIP LOCKED. Rather than wait for a lock, skip the row -- instead PgSelectLockingOptionsSkipLocked :: PgSelectLockingOptions fromPgSelectLockingClause :: PgSelectLockingClauseSyntax -> PgSyntax pgSelectStmt :: PgSelectTableSyntax -> [PgOrderingSyntax] -> Maybe Integer -> Maybe Integer -> Maybe PgSelectLockingClauseSyntax -> PgSelectSyntax defaultPgValueSyntax :: ToField a => a -> PgValueSyntax data PgDataTypeDescr PgDataTypeDescrOid :: Oid -> Maybe Int32 -> PgDataTypeDescr PgDataTypeDescrDomain :: Text -> PgDataTypeDescr data PgHasEnum PgHasEnum :: Text -> [Text] -> PgHasEnum pgCreateExtensionSyntax :: Text -> PgCommandSyntax pgDropExtensionSyntax :: Text -> PgCommandSyntax pgCreateEnumSyntax :: Text -> [PgValueSyntax] -> PgCommandSyntax pgDropTypeSyntax :: Text -> PgCommandSyntax pgSimpleMatchSyntax :: PgMatchTypeSyntax pgSelectSetQuantifierDistinctOn :: [PgExpressionSyntax] -> PgSelectSetQuantifierSyntax pgDataTypeJSON :: Value -> BeamSerializedDataType pgTsQueryType :: PgDataTypeSyntax pgTsVectorType :: PgDataTypeSyntax pgJsonType :: PgDataTypeSyntax pgJsonbType :: PgDataTypeSyntax pgUuidType :: PgDataTypeSyntax pgMoneyType :: PgDataTypeSyntax pgTsQueryTypeInfo :: TypeInfo -- | Postgres TypeInfo for tsvector TODO Is the Oid stable from postgres -- instance to postgres instance? pgTsVectorTypeInfo :: TypeInfo pgByteaType :: PgDataTypeSyntax pgTextType :: PgDataTypeSyntax pgUnboundedArrayType :: PgDataTypeSyntax -> PgDataTypeSyntax pgSerialType :: PgDataTypeSyntax pgSmallSerialType :: PgDataTypeSyntax pgBigSerialType :: PgDataTypeSyntax pgPointType :: PgDataTypeSyntax pgLineType :: PgDataTypeSyntax pgLineSegmentType :: PgDataTypeSyntax pgBoxType :: PgDataTypeSyntax pgQuotedIdentifier :: Text -> PgSyntax pgSepBy :: PgSyntax -> [PgSyntax] -> PgSyntax pgDebugRenderSyntax :: PgSyntax -> IO () pgRenderSyntaxScript :: PgSyntax -> ByteString pgBuildAction :: [Action] -> PgSyntax pgBinOp :: ByteString -> PgExpressionSyntax -> PgExpressionSyntax -> PgExpressionSyntax pgCompOp :: ByteString -> Maybe PgComparisonQuantifierSyntax -> PgExpressionSyntax -> PgExpressionSyntax -> PgExpressionSyntax pgUnOp :: ByteString -> PgExpressionSyntax -> PgExpressionSyntax pgPostFix :: ByteString -> PgExpressionSyntax -> PgExpressionSyntax pgTestSyntax :: PgSyntax -> [PgSyntaxPrim] data PostgresInaccessible instance GHC.Show.Show Database.Beam.Postgres.Syntax.PgCommandType instance GHC.Classes.Eq Database.Beam.Postgres.Syntax.PgExpressionSyntax instance GHC.Base.Monoid (Database.Beam.Query.CustomSQL.CustomSqlSyntax Database.Beam.Postgres.Syntax.PgExpressionSyntax) instance GHC.Generics.Generic Database.Beam.Postgres.Syntax.PgNullOrdering instance GHC.Classes.Eq Database.Beam.Postgres.Syntax.PgNullOrdering instance GHC.Show.Show Database.Beam.Postgres.Syntax.PgNullOrdering instance GHC.Generics.Generic Database.Beam.Postgres.Syntax.PgSelectLockingStrength instance GHC.Classes.Eq Database.Beam.Postgres.Syntax.PgSelectLockingStrength instance GHC.Show.Show Database.Beam.Postgres.Syntax.PgSelectLockingStrength instance GHC.Generics.Generic Database.Beam.Postgres.Syntax.PgSelectLockingOptions instance GHC.Classes.Eq Database.Beam.Postgres.Syntax.PgSelectLockingOptions instance GHC.Show.Show Database.Beam.Postgres.Syntax.PgSelectLockingOptions instance GHC.Generics.Generic Database.Beam.Postgres.Syntax.PgDataTypeDescr instance GHC.Classes.Eq Database.Beam.Postgres.Syntax.PgDataTypeDescr instance GHC.Show.Show Database.Beam.Postgres.Syntax.PgDataTypeDescr instance GHC.Classes.Eq Database.Beam.Postgres.Syntax.PgColumnSchemaSyntax instance GHC.Show.Show Database.Beam.Postgres.Syntax.PgColumnSchemaSyntax instance GHC.Show.Show Database.Beam.Postgres.Syntax.PgDataTypeSyntax instance GHC.Show.Show Database.Beam.Postgres.Syntax.PgColumnConstraintDefinitionSyntax instance GHC.Generics.Generic Database.Beam.Postgres.Syntax.PgHasEnum instance GHC.Classes.Eq Database.Beam.Postgres.Syntax.PgHasEnum instance GHC.Show.Show Database.Beam.Postgres.Syntax.PgHasEnum instance GHC.Enum.Bounded Database.Beam.Postgres.Syntax.PgEscapeType instance GHC.Enum.Enum Database.Beam.Postgres.Syntax.PgEscapeType instance GHC.Classes.Ord Database.Beam.Postgres.Syntax.PgEscapeType instance GHC.Classes.Eq Database.Beam.Postgres.Syntax.PgEscapeType instance GHC.Show.Show Database.Beam.Postgres.Syntax.PgEscapeType instance GHC.Show.Show Database.Beam.Postgres.Syntax.PgSyntaxPrim instance GHC.Base.Functor Database.Beam.Postgres.Syntax.PgSyntaxF instance Data.String.IsString Database.Beam.Postgres.Syntax.PgSyntaxPrim instance Database.Beam.Migrate.Checks.HasDataTypeCreatedCheck Database.Beam.Postgres.Syntax.PgDataTypeSyntax instance Data.Hashable.Class.Hashable Database.Beam.Postgres.Syntax.PgHasEnum instance Database.Beam.Migrate.Types.Predicates.DatabasePredicate Database.Beam.Postgres.Syntax.PgHasEnum instance Database.Beam.Backend.SQL.SQL2003.IsSql2003WindowFrameBoundsSyntax Database.Beam.Postgres.Syntax.PgWindowFrameBoundsSyntax instance Database.Beam.Backend.SQL.SQL2003.IsSql2003WindowFrameBoundSyntax Database.Beam.Postgres.Syntax.PgWindowFrameBoundSyntax instance Database.Beam.Backend.SQL.SQL2003.IsSql2003WindowFrameSyntax Database.Beam.Postgres.Syntax.PgWindowFrameSyntax instance Database.Beam.Backend.SQL.SQL2003.IsSql2003ExpressionSyntax Database.Beam.Postgres.Syntax.PgExpressionSyntax instance Database.Beam.Migrate.SQL.SQL92.IsSql92AlterTableActionSyntax Database.Beam.Postgres.Syntax.PgAlterTableActionSyntax instance Database.Beam.Migrate.SQL.SQL92.IsSql92AlterColumnActionSyntax Database.Beam.Postgres.Syntax.PgAlterColumnActionSyntax instance Database.Beam.Migrate.SQL.SQL92.IsSql92AlterTableSyntax Database.Beam.Postgres.Syntax.PgAlterTableSyntax instance Database.Beam.Migrate.SQL.SQL92.IsSql92DdlCommandSyntax Database.Beam.Postgres.Syntax.PgCommandSyntax instance Database.Beam.Migrate.SQL.SQL92.IsSql92DropTableSyntax Database.Beam.Postgres.Syntax.PgDropTableSyntax instance Database.Beam.Migrate.SQL.SQL92.IsSql92ReferentialActionSyntax Database.Beam.Postgres.Syntax.PgReferentialActionSyntax instance Database.Beam.Migrate.SQL.SQL92.IsSql92ColumnConstraintSyntax Database.Beam.Postgres.Syntax.PgColumnConstraintSyntax instance Database.Beam.Migrate.SQL.SQL92.IsSql92MatchTypeSyntax Database.Beam.Postgres.Syntax.PgMatchTypeSyntax instance Database.Beam.Migrate.SQL.SQL92.IsSql92CreateTableSyntax Database.Beam.Postgres.Syntax.PgCreateTableSyntax instance Database.Beam.Migrate.SQL.SQL92.IsSql92TableConstraintSyntax Database.Beam.Postgres.Syntax.PgTableConstraintSyntax instance Database.Beam.Migrate.SQL.SQL92.IsSql92ColumnConstraintDefinitionSyntax Database.Beam.Postgres.Syntax.PgColumnConstraintDefinitionSyntax instance Database.Beam.Backend.SQL.SQL92.Sql92DisplaySyntax Database.Beam.Postgres.Syntax.PgColumnConstraintDefinitionSyntax instance GHC.Classes.Eq Database.Beam.Postgres.Syntax.PgColumnConstraintDefinitionSyntax instance Database.Beam.Migrate.SQL.SQL92.IsSql92ColumnSchemaSyntax Database.Beam.Postgres.Syntax.PgColumnSchemaSyntax instance Data.Hashable.Class.Hashable Database.Beam.Postgres.Syntax.PgColumnConstraintDefinitionSyntax instance Database.Beam.Migrate.SQL.SQL92.Sql92SerializableConstraintDefinitionSyntax Database.Beam.Postgres.Syntax.PgColumnConstraintDefinitionSyntax instance Database.Beam.Backend.SQL.SQL92.Sql92DisplaySyntax Database.Beam.Postgres.Syntax.PgDataTypeSyntax instance Data.Hashable.Class.Hashable Database.Beam.Postgres.Syntax.PgDataTypeSyntax instance GHC.Classes.Eq Database.Beam.Postgres.Syntax.PgDataTypeSyntax instance Database.Beam.Backend.SQL.SQL92.IsSql92DataTypeSyntax Database.Beam.Postgres.Syntax.PgDataTypeSyntax instance Database.Beam.Backend.SQL.SQL99.IsSql99DataTypeSyntax Database.Beam.Postgres.Syntax.PgDataTypeSyntax instance Database.Beam.Backend.SQL.SQL2003.IsSql2008BigIntDataTypeSyntax Database.Beam.Postgres.Syntax.PgDataTypeSyntax instance Database.Beam.Migrate.SQL.SQL92.Sql92SerializableDataTypeSyntax Database.Beam.Postgres.Syntax.PgDataTypeSyntax instance Database.Beam.Backend.SQL.SQL92.IsSql92ExpressionSyntax Database.Beam.Postgres.Syntax.PgExpressionSyntax instance Database.Beam.Backend.SQL.SQL92.Sql92DisplaySyntax Database.Beam.Postgres.Syntax.PgColumnSchemaSyntax instance Data.Hashable.Class.Hashable Database.Beam.Postgres.Syntax.PgColumnSchemaSyntax instance Data.Hashable.Class.Hashable Database.Beam.Postgres.Syntax.PgDataTypeDescr instance Database.Beam.Backend.SQL.SQL92.IsSql92SelectSyntax Database.Beam.Postgres.Syntax.PgSelectSyntax instance Database.Beam.Backend.SQL.SQL92.IsSql92OrderingSyntax Database.Beam.Postgres.Syntax.PgOrderingSyntax instance Database.Beam.Backend.SQL.SQL2003.IsSql2003OrderingElementaryOLAPOperationsSyntax Database.Beam.Postgres.Syntax.PgOrderingSyntax instance Database.Beam.Backend.SQL.SQL99.IsSql99CommonTableExpressionSelectSyntax Database.Beam.Postgres.Syntax.PgSelectSyntax instance Database.Beam.Backend.SQL.SQL99.IsSql99RecursiveCommonTableExpressionSelectSyntax Database.Beam.Postgres.Syntax.PgSelectSyntax instance Database.Beam.Backend.SQL.SQL99.IsSql99CommonTableExpressionSyntax Database.Beam.Postgres.Syntax.PgCommonTableExpressionSyntax instance Database.Beam.Backend.SQL.SQL92.IsSql92InsertSyntax Database.Beam.Postgres.Syntax.PgInsertSyntax instance Database.Beam.Backend.SQL.SQL92.IsSql92InsertValuesSyntax Database.Beam.Postgres.Syntax.PgInsertValuesSyntax instance Database.Beam.Backend.SQL.SQL92.IsSql92UpdateSyntax Database.Beam.Postgres.Syntax.PgUpdateSyntax instance Database.Beam.Backend.SQL.SQL92.IsSql92FieldNameSyntax Database.Beam.Postgres.Syntax.PgFieldNameSyntax instance Database.Beam.Backend.SQL.SQL92.IsSql92FromSyntax Database.Beam.Postgres.Syntax.PgFromSyntax instance Database.Beam.Backend.SQL.SQL92.IsSql92TableSourceSyntax Database.Beam.Postgres.Syntax.PgTableSourceSyntax instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax GHC.Types.Bool instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax GHC.Types.Double instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax GHC.Types.Float instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax GHC.Int.Int8 instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax GHC.Int.Int16 instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax GHC.Int.Int32 instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax GHC.Int.Int64 instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax GHC.Integer.Type.Integer instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax GHC.Word.Word8 instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax GHC.Word.Word16 instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax GHC.Word.Word32 instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax GHC.Word.Word64 instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax Data.Text.Internal.Text instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax Data.Text.Internal.Lazy.Text instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax Data.Aeson.Types.Internal.Value instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax Database.PostgreSQL.LibPQ.Oid instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax Data.Time.LocalTime.Internal.LocalTime.LocalTime instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax Data.Time.Clock.Internal.UTCTime.UTCTime instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax Data.Time.LocalTime.Internal.TimeOfDay.TimeOfDay instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax Data.Time.Clock.Internal.NominalDiffTime.NominalDiffTime instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax Data.Time.Calendar.Days.Day instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax [GHC.Types.Char] instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax Database.PostgreSQL.Simple.HStore.Implementation.HStoreMap instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax Database.PostgreSQL.Simple.HStore.Implementation.HStoreList instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax Database.PostgreSQL.Simple.HStore.Implementation.HStoreBuilder instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax Database.PostgreSQL.Simple.Time.Implementation.Date instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax Database.PostgreSQL.Simple.Time.Implementation.LocalTimestamp instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax Database.PostgreSQL.Simple.Time.Implementation.UTCTimestamp instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax Data.Scientific.Scientific instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax (Data.CaseInsensitive.Internal.CI Data.Text.Internal.Text) instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax (Data.CaseInsensitive.Internal.CI Data.Text.Internal.Lazy.Text) instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax Database.Beam.Backend.SQL.Types.SqlNull instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax x => Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax (GHC.Maybe.Maybe x) instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax Data.ByteString.Internal.ByteString instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax Data.ByteString.Lazy.Internal.ByteString instance Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax Data.UUID.Types.Internal.UUID instance Database.PostgreSQL.Simple.ToField.ToField a => Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax (Data.Vector.Vector a) instance (TypeError ...) => Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax GHC.Types.Int instance (TypeError ...) => Database.Beam.Backend.SQL.SQL92.HasSqlValueSyntax Database.Beam.Postgres.Syntax.PgValueSyntax GHC.Types.Word instance Database.Beam.Backend.SQL.SQL92.IsSql92SelectTableSyntax Database.Beam.Postgres.Syntax.PgSelectTableSyntax instance Database.Beam.Backend.SQL.SQL92.IsSql92GroupingSyntax Database.Beam.Postgres.Syntax.PgGroupingSyntax instance Database.Beam.Backend.SQL.SQL92.IsSql92ProjectionSyntax Database.Beam.Postgres.Syntax.PgProjectionSyntax instance Database.Beam.Backend.SQL.SQL92.IsSql92ExtractFieldSyntax Database.Beam.Postgres.Syntax.PgExtractFieldSyntax instance Database.Beam.Backend.SQL.SQL92.IsSql92QuantifierSyntax Database.Beam.Postgres.Syntax.PgComparisonQuantifierSyntax instance Database.Beam.Backend.SQL.SQL92.IsSql92TableNameSyntax Database.Beam.Postgres.Syntax.PgTableNameSyntax instance Database.Beam.Backend.SQL.SQL92.IsSql92DeleteSyntax Database.Beam.Postgres.Syntax.PgDeleteSyntax instance Database.Beam.Backend.SQL.SQL92.IsSql92FromOuterJoinSyntax Database.Beam.Postgres.Syntax.PgFromSyntax instance Database.Beam.Backend.SQL.SQL92.IsSql92AggregationSetQuantifierSyntax Database.Beam.Postgres.Syntax.PgSelectSetQuantifierSyntax instance Database.Beam.Backend.SQL.SQL92.IsSql92AggregationExpressionSyntax Database.Beam.Postgres.Syntax.PgExpressionSyntax instance Database.Beam.Backend.SQL.SQL92.IsSql92AggregationSetQuantifierSyntax Database.Beam.Postgres.Syntax.PgAggregationSetQuantifierSyntax instance Database.Beam.Query.CustomSQL.IsCustomSqlSyntax Database.Beam.Postgres.Syntax.PgExpressionSyntax instance GHC.Base.Semigroup (Database.Beam.Query.CustomSQL.CustomSqlSyntax Database.Beam.Postgres.Syntax.PgExpressionSyntax) instance Data.String.IsString (Database.Beam.Query.CustomSQL.CustomSqlSyntax Database.Beam.Postgres.Syntax.PgExpressionSyntax) instance Database.Beam.Backend.SQL.SQL99.IsSql99FunctionExpressionSyntax Database.Beam.Postgres.Syntax.PgExpressionSyntax instance Database.Beam.Backend.SQL.SQL99.IsSql99ExpressionSyntax Database.Beam.Postgres.Syntax.PgExpressionSyntax instance Database.Beam.Backend.SQL.SQL99.IsSql99ConcatExpressionSyntax Database.Beam.Postgres.Syntax.PgExpressionSyntax instance Database.Beam.Backend.SQL.SQL2003.IsSql2003EnhancedNumericFunctionsExpressionSyntax Database.Beam.Postgres.Syntax.PgExpressionSyntax instance Database.Beam.Backend.SQL.SQL2003.IsSql2003ExpressionAdvancedOLAPOperationsSyntax Database.Beam.Postgres.Syntax.PgExpressionSyntax instance Database.Beam.Backend.SQL.SQL2003.IsSql2003ExpressionElementaryOLAPOperationsSyntax Database.Beam.Postgres.Syntax.PgExpressionSyntax instance Database.Beam.Backend.SQL.SQL2003.IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax Database.Beam.Postgres.Syntax.PgExpressionSyntax instance Database.Beam.Backend.SQL.SQL2003.IsSql2003NtileExpressionSyntax Database.Beam.Postgres.Syntax.PgExpressionSyntax instance Database.Beam.Backend.SQL.SQL2003.IsSql2003LeadAndLagExpressionSyntax Database.Beam.Postgres.Syntax.PgExpressionSyntax instance Database.Beam.Backend.SQL.SQL2003.IsSql2003FirstValueAndLastValueExpressionSyntax Database.Beam.Postgres.Syntax.PgExpressionSyntax instance Database.Beam.Backend.SQL.SQL2003.IsSql2003NthValueExpressionSyntax Database.Beam.Postgres.Syntax.PgExpressionSyntax instance Database.Beam.Backend.SQL.SQL99.IsSql99AggregationExpressionSyntax Database.Beam.Postgres.Syntax.PgExpressionSyntax instance Database.Beam.Backend.SQL.SQL92.IsSql92Syntax Database.Beam.Postgres.Syntax.PgCommandSyntax instance Data.Hashable.Class.Hashable Database.Beam.Postgres.Syntax.PgSyntax instance Database.Beam.Backend.SQL.SQL92.Sql92DisplaySyntax Database.Beam.Postgres.Syntax.PgSyntax instance GHC.Base.Semigroup Database.Beam.Postgres.Syntax.PgSyntax instance GHC.Base.Monoid Database.Beam.Postgres.Syntax.PgSyntax instance GHC.Classes.Eq Database.Beam.Postgres.Syntax.PgSyntax instance GHC.Show.Show Database.Beam.Postgres.Syntax.PgSyntax instance Data.Functor.Classes.Eq1 Database.Beam.Postgres.Syntax.PgSyntaxF instance GHC.Classes.Eq f => GHC.Classes.Eq (Database.Beam.Postgres.Syntax.PgSyntaxF f) -- | Module providing (almost) full support for Postgres query and data -- manipulation statements. These functions shadow the functions in -- Database.Beam.Query and provide a strict superset of -- functionality. They map 1-to-1 with the underlying Postgres support. module Database.Beam.Postgres.Full -- | Combines the result of a query along with a set of locked tables. Used -- as a return value for the lockingFor_ function. data PgWithLocking s a -- | An explicit lock against some tables. You can create a value of this -- type using the locked_ function. You can combine these values -- monoidally to combine multiple locks for use with the -- withLocks_ function. data PgLockedTables s -- | Specifies the level of lock that will be taken against a row. See -- the manual section for more information. data PgSelectLockingStrength -- |
--   UPDATE
--   
PgSelectLockingStrengthUpdate :: PgSelectLockingStrength -- |
--   NO KEY UPDATE
--   
PgSelectLockingStrengthNoKeyUpdate :: PgSelectLockingStrength -- |
--   SHARE
--   
PgSelectLockingStrengthShare :: PgSelectLockingStrength -- |
--   KEY SHARE
--   
PgSelectLockingStrengthKeyShare :: PgSelectLockingStrength -- | Specifies how we should handle lock conflicts. -- -- See the manual section for more information data PgSelectLockingOptions -- | NOWAIT. Report an error rather than waiting for the lock PgSelectLockingOptionsNoWait :: PgSelectLockingOptions -- | SKIP LOCKED. Rather than wait for a lock, skip the row -- instead PgSelectLockingOptionsSkipLocked :: PgSelectLockingOptions -- | Like lockingFor_, but does not require an explicit set of -- locked tables. This produces an empty FOR .. OF clause. lockingAllTablesFor_ :: (Database Postgres db, Projectible Postgres a, ThreadRewritable (QNested s) a) => PgSelectLockingStrength -> Maybe PgSelectLockingOptions -> Q Postgres db (QNested s) a -> Q Postgres db s (WithRewrittenThread (QNested s) s a) -- | Lock some tables during the execution of a query. This is rather -- complicated, and there are several usage examples in the user -- guide -- -- The Postgres locking clause is rather complex, and beam currently does -- not check several pre-conditions. It is assumed you kinda know what -- you're doing. -- -- Things which postgres doesn't like, but beam will do -- -- -- -- See here for more details. -- -- This function accepts a locking strength (UPDATE, -- SHARE, KEY SHARE, etc), an optional locking option -- (NOWAIT or SKIP LOCKED), and a query whose rows to -- lock. The query should return its result wrapped in -- PgWithLocking, via the withLocks_ or lockAll_ -- function. -- -- If you want to use the most common behavior (lock all rows in every -- table mentioned), the lockingAllTablesFor_ function may be what -- you're after. lockingFor_ :: forall a db s. (Database Postgres db, Projectible Postgres a, ThreadRewritable (QNested s) a) => PgSelectLockingStrength -> Maybe PgSelectLockingOptions -> Q Postgres db (QNested s) (PgWithLocking (QNested s) a) -> Q Postgres db s (WithRewrittenThread (QNested s) s a) -- | Join with a table while locking it explicitly. Provides a -- PgLockedTables value that can be used with withLocks_ to -- explicitly lock a table during a SELECT statement locked_ :: (Beamable tbl, Database Postgres db) => DatabaseEntity Postgres db (TableEntity tbl) -> Q Postgres db s (PgLockedTables s, tbl (QExpr Postgres s)) -- | Use with lockingFor_ to lock all tables mentioned in the query lockAll_ :: a -> PgWithLocking s a -- | Return and lock the given tables. Typically used as an infix operator. -- See the the user guide for usage examples withLocks_ :: a -> PgLockedTables s -> PgWithLocking s a -- | Postgres LATERAL JOIN support -- -- Allows the use of variables introduced on the left side of a -- JOIN to be used on the right hand side. -- -- Because of the default scoping rules, we can't use the typical monadic -- bind (>>=) operator to create this join. -- -- Instead, lateral_ takes two arguments. The first is the left -- hand side of the JOIN. The second is a function that takes -- the result of the first join and uses those variables to create the -- right hand side. -- -- For example, to join table A with a subquery that returns the first -- three rows in B which matches a column in A, ordered by another column -- in B: -- --
--   lateral_ (_tableA database) $ \tblA ->
--     limit_ 3 $
--     ordering_ (\(_, b) -> asc_ (_bField2 b)) $ do
--       b <- _tableB database
--       guard_ (_bField1 b ==. _aField1 a)
--       pure (a, b0
--   
lateral_ :: forall s a b db. (ThreadRewritable s a, ThreadRewritable (QNested s) b, Projectible Postgres b) => a -> (WithRewrittenThread s (QNested s) a -> Q Postgres db (QNested s) b) -> Q Postgres db s (WithRewrittenThread (QNested s) s b) -- | A beam-postgres-specific version of insert, which -- provides fuller support for the much richer Postgres INSERT -- syntax. This allows you to specify ON CONFLICT actions. For -- even more complete support, see insertReturning. insert :: DatabaseEntity Postgres db (TableEntity table) -> SqlInsertValues Postgres (table (QExpr Postgres s)) -> PgInsertOnConflict table -> SqlInsert Postgres table -- | The full Postgres INSERT syntax, supporting conflict actions -- and the RETURNING CLAUSE. See PgInsertOnConflict for -- how to specify a conflict action or provide onConflictDefault -- to preserve the behavior without any ON CONFLICT clause. The -- last argument takes a newly inserted row and returns the expression to -- be returned as part of the RETURNING clause. For a -- backend-agnostic version of this functionality see -- MonadBeamInsertReturning. Use runInsertReturning to -- get the results. insertReturning :: Projectible Postgres a => DatabaseEntity Postgres be (TableEntity table) -> SqlInsertValues Postgres (table (QExpr Postgres s)) -> PgInsertOnConflict table -> Maybe (table (QExpr Postgres PostgresInaccessible) -> a) -> PgInsertReturning (QExprToIdentity a) -- | The Postgres DEFAULT VALUES clause for the INSERT -- command. insertDefaults :: SqlInsertValues Postgres tbl runPgInsertReturningList :: (MonadBeam be m, BeamSqlBackendSyntax be ~ PgCommandSyntax, FromBackendRow be a) => PgInsertReturning a -> m [a] -- | The most general kind of INSERT that postgres can perform data PgInsertReturning a PgInsertReturning :: PgSyntax -> PgInsertReturning a PgInsertReturningEmpty :: PgInsertReturning a -- | What to do when an INSERT statement inserts a row into the -- table tbl that violates a constraint. newtype PgInsertOnConflict (tbl :: (* -> *) -> *) PgInsertOnConflict :: (tbl (QField QInternal) -> PgInsertOnConflictSyntax) -> PgInsertOnConflict (tbl :: (* -> *) -> *) -- | By default, Postgres will throw an error when a conflict is detected. -- This preserves that functionality. onConflictDefault :: PgInsertOnConflict tbl -- | Tells postgres what to do on an INSERT conflict. The first -- argument is the type of conflict to provide an action for. For -- example, to only provide an action for certain fields, use -- conflictingFields. Or to only provide an action over certain -- fields where a particular condition is met, use -- conflictingFields. If you have a particular constraint -- violation in mind, use conflictingConstraint. To perform an -- action on any conflict, use anyConflict. -- -- See the Postgres documentation. onConflict :: Beamable tbl => SqlConflictTarget Postgres tbl -> SqlConflictAction Postgres tbl -> PgInsertOnConflict tbl -- | Perform the action only if the given named constraint is violated conflictingConstraint :: Text -> SqlConflictTarget Postgres tbl class BeamSqlBackend be => BeamHasInsertOnConflict be where { -- | Specifies the kind of constraint that must be violated for the action -- to occur data family SqlConflictTarget be (table :: Type -> Type -> Type); -- | What to do when an INSERT statement inserts a row into the -- table tbl that violates a constraint. data family SqlConflictAction be (table :: Type -> Type -> Type); } insertOnConflict :: forall table (db :: (Type -> Type) -> Type) s. (BeamHasInsertOnConflict be, Beamable table) => DatabaseEntity be db (TableEntity table) -> SqlInsertValues be (table (QExpr be s)) -> SqlConflictTarget be table -> SqlConflictAction be table -> SqlInsert be table anyConflict :: forall (table :: (Type -> Type) -> Type). BeamHasInsertOnConflict be => SqlConflictTarget be table conflictingFields :: (BeamHasInsertOnConflict be, Projectible be proj) => (table (QExpr be QInternal) -> proj) -> SqlConflictTarget be table conflictingFieldsWhere :: (BeamHasInsertOnConflict be, Projectible be proj) => (table (QExpr be QInternal) -> proj) -> (forall s. () => table (QExpr be s) -> QExpr be s Bool) -> SqlConflictTarget be table onConflictDoNothing :: forall (table :: (Type -> Type) -> Type). BeamHasInsertOnConflict be => SqlConflictAction be table onConflictUpdateSet :: (BeamHasInsertOnConflict be, Beamable table) => (forall s. () => table (QField s) -> table (QExpr be s) -> QAssignment be s) -> SqlConflictAction be table onConflictUpdateSetWhere :: (BeamHasInsertOnConflict be, Beamable table) => (forall s. () => table (QField s) -> table (QExpr be s) -> QAssignment be s) -> (forall s. () => table (QField s) -> table (QExpr be s) -> QExpr be s Bool) -> SqlConflictAction be table onConflictUpdateAll :: forall be (table :: (Type -> Type) -> Type). (BeamHasInsertOnConflict be, Beamable table) => SqlConflictAction be table onConflictUpdateInstead :: (BeamHasInsertOnConflict be, Beamable table, ProjectibleWithPredicate AnyType () (InaccessibleQAssignment be) proj) => (table (Const (InaccessibleQAssignment be) :: Type -> Type) -> proj) -> SqlConflictAction be table -- | The most general kind of UPDATE that postgres can perform -- -- You can build this from a SqlUpdate by using returning -- --
--   update tbl where `returning` projection
--   
-- -- Run the result with runPgUpdateReturningList data PgUpdateReturning a PgUpdateReturning :: PgSyntax -> PgUpdateReturning a PgUpdateReturningEmpty :: PgUpdateReturning a runPgUpdateReturningList :: (MonadBeam be m, BeamSqlBackendSyntax be ~ PgCommandSyntax, FromBackendRow be a) => PgUpdateReturning a -> m [a] -- | Postgres UPDATE ... RETURNING statement support. The last -- argument takes the newly inserted row and returns the values to be -- returned. Use runUpdateReturning to get the results. updateReturning :: Projectible Postgres a => DatabaseEntity Postgres be (TableEntity table) -> (forall s. table (QField s) -> QAssignment Postgres s) -> (forall s. table (QExpr Postgres s) -> QExpr Postgres s Bool) -> (table (QExpr Postgres PostgresInaccessible) -> a) -> PgUpdateReturning (QExprToIdentity a) -- | The most general kind of DELETE that postgres can perform -- -- You can build this from a SqlDelete by using returning -- --
--   delete tbl where `returning` projection
--   
-- -- Run the result with runPgDeleteReturningList newtype PgDeleteReturning a PgDeleteReturning :: PgSyntax -> PgDeleteReturning a runPgDeleteReturningList :: (MonadBeam be m, BeamSqlBackendSyntax be ~ PgCommandSyntax, FromBackendRow be a) => PgDeleteReturning a -> m [a] -- | Postgres DELETE ... RETURNING statement support. The last -- argument takes the newly inserted row and returns the values to be -- returned. Use runDeleteReturning to get the results. deleteReturning :: Projectible Postgres a => DatabaseEntity Postgres be (TableEntity table) -> (forall s. table (QExpr Postgres s) -> QExpr Postgres s Bool) -> (table (QExpr Postgres PostgresInaccessible) -> a) -> PgDeleteReturning (QExprToIdentity a) class PgReturning cmd where { type family PgReturningType cmd :: * -> *; } returning :: (PgReturning cmd, Beamable tbl, Projectible Postgres a) => cmd Postgres tbl -> (tbl (QExpr Postgres PostgresInaccessible) -> a) -> PgReturningType cmd (QExprToIdentity a) instance GHC.Base.Monoid (Database.Beam.Postgres.Full.PgLockedTables s) instance GHC.Base.Semigroup (Database.Beam.Postgres.Full.PgLockedTables s) instance Database.Beam.Postgres.Full.PgReturning Database.Beam.Query.SqlInsert instance Database.Beam.Postgres.Full.PgReturning Database.Beam.Query.SqlUpdate instance Database.Beam.Postgres.Full.PgReturning Database.Beam.Query.SqlDelete instance Database.Beam.Query.Internal.ProjectibleWithPredicate c be res a => Database.Beam.Query.Internal.ProjectibleWithPredicate c be res (Database.Beam.Postgres.Full.PgWithLocking s a) instance Database.Beam.Backend.SQL.BeamExtensions.BeamHasInsertOnConflict Database.Beam.Postgres.Types.Postgres module Database.Beam.Postgres.CustomTypes data PgType a newtype PgTypeCheck PgTypeCheck :: (Text -> SomeDatabasePredicate) -> PgTypeCheck data PgDataTypeSchema a class IsPgCustomDataType a pgDataTypeName :: IsPgCustomDataType a => Proxy a -> Text pgDataTypeDescription :: IsPgCustomDataType a => PgDataTypeSchema a data PgHasEnum PgHasEnum :: Text -> [Text] -> PgHasEnum class HasSqlValueSyntax expr ty class BeamBackend be => FromBackendRow be a pgCustomEnumSchema :: HasSqlValueSyntax PgValueSyntax a => [a] -> PgDataTypeSchema a pgBoundedEnumSchema :: (Enum a, Bounded a, HasSqlValueSyntax PgValueSyntax a) => PgDataTypeSchema a pgCustomEnumActionProvider :: ActionProvider Postgres pgCreateEnumActionProvider :: ActionProvider Postgres pgDropEnumActionProvider :: ActionProvider Postgres pgChecksForTypeSchema :: PgDataTypeSchema a -> [PgTypeCheck] pgEnumValueSyntax :: (a -> String) -> a -> PgValueSyntax pgParseEnum :: (Enum a, Bounded a) => (a -> String) -> FromBackendRowM Postgres a createEnum :: forall a db. (HasSqlValueSyntax PgValueSyntax a, Enum a, Bounded a) => Text -> Migration Postgres (CheckedDatabaseEntity Postgres db (PgType a)) beamTypeForCustomPg :: CheckedDatabaseEntity Postgres db (PgType a) -> DataType Postgres a instance Database.Beam.Backend.SQL.Row.FromBackendRow Database.Beam.Postgres.Types.Postgres Database.Beam.Postgres.CustomTypes.PgRawString instance Database.PostgreSQL.Simple.FromField.FromField Database.Beam.Postgres.CustomTypes.PgRawString instance Database.Beam.Schema.Tables.IsDatabaseEntity Database.Beam.Postgres.Types.Postgres (Database.Beam.Postgres.CustomTypes.PgType a) instance Database.Beam.Migrate.Types.CheckedEntities.IsCheckedDatabaseEntity Database.Beam.Postgres.Types.Postgres (Database.Beam.Postgres.CustomTypes.PgType a) instance Database.Beam.Schema.Tables.RenamableWithRule (Database.Beam.Schema.Tables.FieldRenamer (Database.Beam.Schema.Tables.DatabaseEntityDescriptor Database.Beam.Postgres.Types.Postgres (Database.Beam.Postgres.CustomTypes.PgType a))) -- | Migrations support for beam-postgres. See Database.Beam.Migrate -- for more information on beam migrations. module Database.Beam.Postgres.Migrate -- | Representation of an arbitrary Postgres command. This is the -- combination of the command syntax (repesented by PgSyntax), as -- well as the type of command (represented by PgCommandType). The -- command type is necessary for us to know how to retrieve results from -- the database. data PgCommandSyntax -- | Top-level migration backend for use by beam-migrate tools migrationBackend :: BeamMigrationBackend Postgres Pg -- | BeamDeserializers for postgres-specific types: -- -- postgresDataTypeDeserializers :: BeamDeserializers Postgres -- | Converts postgres DatabasePredicates to -- DatabasePredicates in the Haskell syntax. Allows automatic -- generation of Haskell schemas from postgres constraints. pgPredConverter :: HaskellPredicateConverter getDbConstraints :: Connection -> IO [SomeDatabasePredicate] getDbConstraintsForSchemas :: Maybe [String] -> Connection -> IO [SomeDatabasePredicate] -- | Turn a PgDataTypeSyntax into the corresponding -- HsDataType. This is a best effort guess, and may fail on more -- exotic types. Feel free to send PRs to make this function more robust! pgTypeToHs :: PgDataTypeSyntax -> Maybe HsDataType -- | Turn a series of MigrationSteps into a line-by-line array of -- ByteStrings suitable for writing to a script. migrateScript :: MigrationSteps Postgres () a' -> [ByteString] -- | Write the migration given by the MigrationSteps to a file. writeMigrationScript :: FilePath -> MigrationSteps Postgres () a -> IO () pgDataTypeFromAtt :: ByteString -> Oid -> Maybe Int32 -> Maybe PgDataTypeSyntax -- | DataType for tsquery. See TsQuery for more -- information tsquery :: DataType Postgres TsQuery -- | DataType for tsvector. See TsVector for more -- information tsvector :: DataType Postgres TsVector -- | DataType for Postgres TEXT. -- characterLargeObject is also mapped to this data type text :: DataType Postgres Text -- | DataType for Postgres BYTEA. -- binaryLargeObject is also mapped to this data type bytea :: DataType Postgres ByteString -- | DataType for a Postgres array without any bounds. -- -- Note that array support in beam-migrate is still incomplete. unboundedArray :: forall a. Typeable a => DataType Postgres a -> DataType Postgres (Vector a) -- | DataType for UUID columns. The -- pgCryptoGenRandomUUID function in the PgCrypto -- extension can be used to generate UUIDs at random. uuid :: DataType Postgres UUID -- | DataType for MONEY columns. money :: DataType Postgres PgMoney -- | DataType for JSON. See PgJSON for more -- information json :: (ToJSON a, FromJSON a) => DataType Postgres (PgJSON a) -- | DataType for JSONB. See PgJSON for more -- information jsonb :: (ToJSON a, FromJSON a) => DataType Postgres (PgJSONB a) -- | Postgres SERIAL data types. Automatically generates an -- appropriate DEFAULT clause and sequence smallserial :: Integral a => DataType Postgres (SqlSerial a) -- | Postgres SERIAL data types. Automatically generates an -- appropriate DEFAULT clause and sequence serial :: Integral a => DataType Postgres (SqlSerial a) -- | Postgres SERIAL data types. Automatically generates an -- appropriate DEFAULT clause and sequence bigserial :: Integral a => DataType Postgres (SqlSerial a) point :: DataType Postgres PgPoint line :: DataType Postgres PgLine lineSegment :: DataType Postgres PgLineSegment box :: DataType Postgres PgBox instance Database.Beam.Migrate.SQL.Tables.FieldReturnType 'GHC.Types.True 'GHC.Types.False Database.Beam.Postgres.Types.Postgres resTy a => Database.Beam.Migrate.SQL.Tables.FieldReturnType 'GHC.Types.False 'GHC.Types.False Database.Beam.Postgres.Types.Postgres resTy (Database.Beam.Postgres.Migrate.PgHasDefault -> a) instance Database.Beam.Migrate.SQL.BeamExtensions.BeamSqlBackendHasSerial Database.Beam.Postgres.Types.Postgres -- | More efficient query execution functions for beam-postgres. -- These functions use the conduit package, to execute -- beam-postgres statements in an arbitrary MonadIO. -- These functions may be more efficient for streaming operations than -- MonadBeam. module Database.Beam.Postgres.Conduit -- | Run a PostgreSQL SELECT statement in any -- MonadResource. streamingRunSelect :: (MonadResource m, MonadFail m, FromBackendRow Postgres a) => Connection -> SqlSelect Postgres a -> ConduitT () a m () -- | Run a PostgreSQL INSERT statement in any MonadIO. -- Returns the number of rows affected. runInsert :: MonadIO m => Connection -> SqlInsert Postgres tbl -> m Int64 -- | Run a PostgreSQL INSERT ... RETURNING ... statement in any -- MonadResource and get a Source of the newly inserted -- rows. streamingRunInsertReturning :: (MonadResource m, MonadFail m, FromBackendRow Postgres a) => Connection -> PgInsertReturning a -> ConduitT () a m () -- | Run a PostgreSQL UPDATE statement in any MonadIO. -- Returns the number of rows affected. runUpdate :: MonadIO m => Connection -> SqlUpdate Postgres tbl -> m Int64 -- | Run a PostgreSQL UPDATE ... RETURNING ... statement in any -- MonadResource and get a Source of the newly updated -- rows. streamingRunUpdateReturning :: (MonadResource m, MonadFail m, FromBackendRow Postgres a) => Connection -> PgUpdateReturning a -> ConduitT () a m () -- | Run a PostgreSQL DELETE statement in any MonadIO. -- Returns the number of rows affected. runDelete :: MonadIO m => Connection -> SqlDelete Postgres tbl -> m Int64 -- | Run a PostgreSQl DELETE ... RETURNING ... statement in any -- MonadResource and get a Source of the deleted rows. streamingRunDeleteReturning :: (MonadResource m, MonadFail m, FromBackendRow Postgres a) => Connection -> PgDeleteReturning a -> ConduitT () a m () -- | Run any DML statement. Return the number of rows affected executeStatement :: MonadIO m => Connection -> PgSyntax -> m Int64 -- | Runs any query that returns a set of values streamingRunQueryReturning :: (MonadResource m, MonadFail m, FromBackendRow Postgres r) => Connection -> PgSyntax -> ConduitT () r m () -- | Run a PostgreSQL SELECT statement in any MonadIO. -- | Deprecated: Use streamingRunSelect runSelect :: (MonadIO m, MonadFail m, MonadBaseControl IO m, FromBackendRow Postgres a) => Connection -> SqlSelect Postgres a -> (ConduitT () a m () -> m b) -> m b -- | Run a PostgreSQL INSERT ... RETURNING ... statement in any -- MonadIO and get a Source of the newly inserted rows. -- | Deprecated: Use streamingRunInsertReturning runInsertReturning :: (MonadIO m, MonadFail m, MonadBaseControl IO m, FromBackendRow Postgres a) => Connection -> PgInsertReturning a -> (ConduitT () a m () -> m b) -> m b -- | Run a PostgreSQL UPDATE ... RETURNING ... statement in any -- MonadIO and get a Source of the newly updated rows. -- | Deprecated: Use streamingRunUpdateReturning runUpdateReturning :: (MonadIO m, MonadFail m, MonadBaseControl IO m, FromBackendRow Postgres a) => Connection -> PgUpdateReturning a -> (ConduitT () a m () -> m b) -> m b -- | Run a PostgreSQl DELETE ... RETURNING ... statement in any -- MonadIO and get a Source of the deleted rows. -- | Deprecated: Use streamingRunDeleteReturning runDeleteReturning :: (MonadIO m, MonadFail m, MonadBaseControl IO m, FromBackendRow Postgres a) => Connection -> PgDeleteReturning a -> (ConduitT () a m () -> m b) -> m b -- | Runs any query that returns a set of values -- | Deprecated: Use streamingRunQueryReturning runQueryReturning :: (MonadIO m, MonadFail m, MonadBaseControl IO m, Functor m, FromBackendRow Postgres r) => Connection -> PgSyntax -> (ConduitT () r m () -> m b) -> m b -- | Postgres is a popular, open-source RDBMS. It is fairly standards -- compliant and supports many advanced features and data types. -- -- The beam-postgres module is built atop of -- postgresql-simple, which is used for connection management, -- transaction support, serialization, and deserialization. -- -- beam-postgres supports most beam features as well as many -- postgres-specific features. For example, beam-postgres -- provides support for full-text search, DISTINCT ON, JSON -- handling, postgres ARRAYs, RANGEs, and the -- MONEY type. -- -- The documentation for beam-postgres functionality below -- indicates which postgres function each function or type wraps. -- Postgres maintains its own in-depth documentation. Please refer to -- that for more detailed information on behavior. -- -- For examples on how to use beam-postgres usage, see its -- manual. module Database.Beam.Postgres -- | The Postgres backend type, used to parameterize MonadBeam. See -- the definitions there for more information. The corresponding query -- monad is Pg. See documentation for MonadBeam and the -- user guide for more information on using this backend. data Postgres Postgres :: Postgres -- | MonadBeam in which we can run Postgres commands. See the -- documentation for MonadBeam on examples of how to use. -- -- beam-postgres also provides functions that let you run -- queries without MonadBeam. These functions may be more -- efficient and offer a conduit API. See -- Database.Beam.Postgres.Conduit for more information. data Pg a liftIOWithHandle :: (Connection -> IO a) -> Pg a -- | Representation of an arbitrary Postgres command. This is the -- combination of the command syntax (repesented by PgSyntax), as -- well as the type of command (represented by PgCommandType). The -- command type is necessary for us to know how to retrieve results from -- the database. data PgCommandSyntax -- | A piece of Postgres SQL syntax, which may contain embedded escaped -- byte and text sequences. PgSyntax composes monoidally, and may -- be created with emit, emitBuilder, escapeString, -- escapBytea, and escapeIdentifier. data PgSyntax -- | IsSql92SelectSyntax for Postgres data PgSelectSyntax -- | IsSql92InsertSyntax for Postgres data PgInsertSyntax -- | IsSql92UpdateSyntax for Postgres data PgUpdateSyntax -- | IsSql92DeleteSyntax for Postgres data PgDeleteSyntax -- | BeamURIOpeners for the standard postgresql: URI -- scheme. See the postgres documentation for more details on the -- formatting. See documentation for BeamURIOpeners for more -- information on how to use this with beam postgresUriSyntax :: c Postgres Connection Pg -> BeamURIOpeners c -- | DataType for JSON. See PgJSON for more -- information json :: (ToJSON a, FromJSON a) => DataType Postgres (PgJSON a) -- | DataType for JSONB. See PgJSON for more -- information jsonb :: (ToJSON a, FromJSON a) => DataType Postgres (PgJSONB a) -- | DataType for UUID columns. The -- pgCryptoGenRandomUUID function in the PgCrypto -- extension can be used to generate UUIDs at random. uuid :: DataType Postgres UUID -- | DataType for MONEY columns. money :: DataType Postgres PgMoney -- | DataType for tsquery. See TsQuery for more -- information tsquery :: DataType Postgres TsQuery -- | DataType for tsvector. See TsVector for more -- information tsvector :: DataType Postgres TsVector -- | DataType for Postgres TEXT. -- characterLargeObject is also mapped to this data type text :: DataType Postgres Text -- | DataType for Postgres BYTEA. -- binaryLargeObject is also mapped to this data type bytea :: DataType Postgres ByteString -- | DataType for a Postgres array without any bounds. -- -- Note that array support in beam-migrate is still incomplete. unboundedArray :: forall a. Typeable a => DataType Postgres a -> DataType Postgres (Vector a) -- | Postgres SERIAL data types. Automatically generates an -- appropriate DEFAULT clause and sequence smallserial :: Integral a => DataType Postgres (SqlSerial a) -- | Postgres SERIAL data types. Automatically generates an -- appropriate DEFAULT clause and sequence serial :: Integral a => DataType Postgres (SqlSerial a) -- | Postgres SERIAL data types. Automatically generates an -- appropriate DEFAULT clause and sequence bigserial :: Integral a => DataType Postgres (SqlSerial a) -- | The identifier of a Postgres text search configuration. -- -- Use the IsString instance to construct new values of this type data TsVectorConfig -- | The type of a document preprocessed for full-text search. The -- contained ByteString is the Postgres representation of the -- TSVECTOR type. Use toTsVector to construct these -- on-the-fly from strings. -- -- When this field is embedded in a beam table, -- defaultMigratableDbSettings will give the column the postgres -- TSVECTOR type. newtype TsVector TsVector :: ByteString -> TsVector -- | The Postgres to_tsvector function. Given a configuration and -- string, return the TSVECTOR that represents the contents of -- the string. toTsVector :: BeamSqlBackendIsString Postgres str => Maybe TsVectorConfig -> QGenExpr context Postgres s str -> QGenExpr context Postgres s TsVector -- | A full-text search configuration with sensible defaults for english english :: TsVectorConfig -- | A query that can be run against a document contained in a -- TsVector. -- -- When this field is embedded in a beam table, -- defaultMigratableDbSettings will give the column the postgres -- TSVECTOR type newtype TsQuery TsQuery :: ByteString -> TsQuery -- | Determine if the given TSQUERY matches the document -- represented by the TSVECTOR. Behaves exactly like the -- similarly-named operator in postgres. (@@) :: QGenExpr context Postgres s TsVector -> QGenExpr context Postgres s TsQuery -> QGenExpr context Postgres s Bool -- | The Postgres to_tsquery function. Given a configuration and -- string, return the TSQUERY that represents the contents of -- the string. toTsQuery :: BeamSqlBackendIsString Postgres str => Maybe TsVectorConfig -> QGenExpr context Postgres s str -> QGenExpr context Postgres s TsQuery -- | The Postgres JSON type, which stores textual values that -- represent JSON objects. The type parameter indicates the Haskell type -- which the JSON encodes. This type must be a member of FromJSON -- and ToJSON in order for deserialization and serialization to -- work as expected. -- -- The defaultMigratableDbSettings function automatically -- assigns the postgres JSON type to fields with this type. newtype PgJSON a PgJSON :: a -> PgJSON a -- | The Postgres JSONB type, which stores JSON-encoded data in a -- postgres-specific binary format. Like PgJSON, the type -- parameter indicates the Haskell type which the JSON encodes. -- -- Fields with this type are automatically given the Postgres -- JSONB type newtype PgJSONB a PgJSONB :: a -> PgJSONB a -- | Postgres provides separate json_ and jsonb_ -- functions. However, we know what we're dealing with based on the type -- of data, so we can be less obtuse. -- -- For more information on how these functions behave, see the Postgres -- manual section on JSON. class IsPgJSON (json :: * -> *) -- | The json_each or jsonb_each function. Values -- returned as json or jsonb respectively. Use -- pgUnnest to join against the result pgJsonEach :: IsPgJSON json => QGenExpr ctxt Postgres s (json a) -> QGenExpr ctxt Postgres s (PgSetOf (PgJSONEach (json Value))) -- | Like pgJsonEach, but returning text values instead pgJsonEachText :: IsPgJSON json => QGenExpr ctxt Postgres s (json a) -> QGenExpr ctxt Postgres s (PgSetOf (PgJSONEach Text)) -- | The json_object_keys and jsonb_object_keys function. -- Use pgUnnest to join against the result. pgJsonKeys :: IsPgJSON json => QGenExpr ctxt Postgres s (json a) -> QGenExpr ctxt Postgres s (PgSetOf PgJSONKey) -- | The json_array_elements and jsonb_array_elements -- function. Use pgUnnest to join against the result pgJsonArrayElements :: IsPgJSON json => QGenExpr ctxt Postgres s (json a) -> QGenExpr ctxt Postgres s (PgSetOf (PgJSONElement (json Value))) -- | Like pgJsonArrayElements, but returning the values as -- Text pgJsonArrayElementsText :: IsPgJSON json => QGenExpr ctxt Postgres s (json a) -> QGenExpr ctxt Postgres s (PgSetOf (PgJSONElement Text)) -- | The json_typeof or jsonb_typeof function pgJsonTypeOf :: IsPgJSON json => QGenExpr ctxt Postgres s (json a) -> QGenExpr ctxt Postgres s Text -- | The json_strip_nulls or jsonb_strip_nulls function. pgJsonStripNulls :: IsPgJSON json => QGenExpr ctxt Postgres s (json a) -> QGenExpr ctxt Postgres s (json b) -- | The json_agg or jsonb_agg aggregate. pgJsonAgg :: IsPgJSON json => QExpr Postgres s a -> QAgg Postgres s (json a) -- | The json_object_agg or jsonb_object_agg. The first -- argument gives the key source and the second the corresponding values. pgJsonObjectAgg :: IsPgJSON json => QExpr Postgres s key -> QExpr Postgres s value -> QAgg Postgres s (json a) -- | Key-value pair, used as output of pgJsonEachText and -- pgJsonEach data PgJSONEach valType f PgJSONEach :: C f Text -> C f valType -> PgJSONEach valType f [pgJsonEachKey] :: PgJSONEach valType f -> C f Text [pgJsonEachValue] :: PgJSONEach valType f -> C f valType -- | Output row of pgJsonKeys data PgJSONKey f PgJSONKey :: C f Text -> PgJSONKey f [pgJsonKey] :: PgJSONKey f -> C f Text -- | Output row of pgJsonArrayElements and -- pgJsonArrayElementsText data PgJSONElement a f PgJSONElement :: C f a -> PgJSONElement a f [pgJsonElement] :: PgJSONElement a f -> C f a -- | Postgres @> and <@ operators for JSON. Return -- true if the json object pointed to by the arrow is completely -- contained in the other. See the Postgres documentation for more in -- formation on what this means. (@>) :: QGenExpr ctxt Postgres s (PgJSONB a) -> QGenExpr ctxt Postgres s (PgJSONB b) -> QGenExpr ctxt Postgres s Bool -- | Postgres @> and <@ operators for JSON. Return -- true if the json object pointed to by the arrow is completely -- contained in the other. See the Postgres documentation for more in -- formation on what this means. (<@) :: QGenExpr ctxt Postgres s (PgJSONB a) -> QGenExpr ctxt Postgres s (PgJSONB b) -> QGenExpr ctxt Postgres s Bool -- | Access a JSON array by index. Corresponds to the Postgres -- -> operator. See (->$) for the corresponding -- operator for object access. (->#) :: IsPgJSON json => QGenExpr ctxt Postgres s (json a) -> QGenExpr ctxt Postgres s Int32 -> QGenExpr ctxt Postgres s (json b) -- | Acces a JSON object by key. Corresponds to the Postgres -> -- operator. See (->#) for the corresponding operator for -- arrays. (->$) :: IsPgJSON json => QGenExpr ctxt Postgres s (json a) -> QGenExpr ctxt Postgres s Text -> QGenExpr ctxt Postgres s (json b) -- | Access a JSON array by index, returning the embedded object as a -- string. Corresponds to the Postgres ->> operator. See -- (->>$) for the corresponding operator on objects. (->>#) :: IsPgJSON json => QGenExpr ctxt Postgres s (json a) -> QGenExpr ctxt Postgres s Int32 -> QGenExpr ctxt Postgres s Text -- | Access a JSON object by key, returning the embedded object as a -- string. Corresponds to the Postgres ->> operator. See -- (->>#) for the corresponding operator on arrays. (->>$) :: IsPgJSON json => QGenExpr ctxt Postgres s (json a) -> QGenExpr ctxt Postgres s Text -> QGenExpr ctxt Postgres s Text -- | Access a deeply nested JSON object. The first argument is the JSON -- object to look within, the second is the path of keys from the first -- argument to the target. Returns the result as a new json value. Note -- that the postgres function allows etiher string keys or integer -- indices, but this function only allows string keys. PRs to improve -- this functionality are welcome. (#>) :: IsPgJSON json => QGenExpr ctxt Postgres s (json a) -> QGenExpr ctxt Postgres s (Vector Text) -> QGenExpr ctxt Postgres s (json b) -- | Like (#>) but returns the result as a string. (#>>) :: IsPgJSON json => QGenExpr ctxt Postgres s (json a) -> QGenExpr ctxt Postgres s (Vector Text) -> QGenExpr ctxt Postgres s Text -- | Postgres ? operator. Checks if the given string exists as -- top-level key of the json object. (?) :: QGenExpr ctxt Postgres s (PgJSONB a) -> QGenExpr ctxt Postgres s Text -> QGenExpr ctxt Postgres s Bool -- | Postgres ?| and ?& operators. Check if any or -- all of the given strings exist as top-level keys of the json object -- respectively. (?|) :: QGenExpr ctxt Postgres s (PgJSONB a) -> QGenExpr ctxt Postgres s (Vector Text) -> QGenExpr ctxt Postgres s Bool -- | Postgres ?| and ?& operators. Check if any or -- all of the given strings exist as top-level keys of the json object -- respectively. (?&) :: QGenExpr ctxt Postgres s (PgJSONB a) -> QGenExpr ctxt Postgres s (Vector Text) -> QGenExpr ctxt Postgres s Bool -- | Postgres - operator on json objects. Returns the supplied -- json object with the supplied key deleted. See withoutIdx for -- the corresponding operator on arrays. withoutKey :: QGenExpr ctxt Postgres s (PgJSONB a) -> QGenExpr ctxt Postgres s Text -> QGenExpr ctxt Postgres s (PgJSONB b) -- | Postgres - operator on json arrays. See withoutKey for -- the corresponding operator on objects. withoutIdx :: QGenExpr ctxt Postgres s (PgJSONB a) -> QGenExpr ctxt Postgres s Int32 -> QGenExpr ctxt Postgres s (PgJSONB b) -- | Postgres #- operator. Removes all the keys specificied from -- the JSON object and returns the result. withoutKeys :: QGenExpr ctxt Postgres s (PgJSONB a) -> QGenExpr ctxt Postgres s (Vector Text) -> QGenExpr ctxt Postgres s (PgJSONB b) -- | Postgres json_array_length function. The supplied json object -- should be an array, but this isn't checked at compile-time. pgJsonArrayLength :: IsPgJSON json => QGenExpr ctxt Postgres s (json a) -> QGenExpr ctxt Postgres s Int32 -- | Postgres array_to_json function. pgArrayToJson :: QGenExpr ctxt Postgres s (Vector e) -> QGenExpr ctxt Postgres s (PgJSON a) -- | The postgres jsonb_set function. pgJsonUpdate -- expects the value specified by the path in the second argument to -- exist. If it does not, the first argument is not modified. -- pgJsonbSet will create any intermediate objects necessary. This -- corresponds to the create_missing argument of -- jsonb_set being set to false or true respectively. pgJsonbUpdate :: QGenExpr ctxt Postgres s (PgJSONB a) -> QGenExpr ctxt Postgres s (Vector Text) -> QGenExpr ctxt Postgres s (PgJSONB b) -> QGenExpr ctxt Postgres s (PgJSONB a) -- | The postgres jsonb_set function. pgJsonUpdate -- expects the value specified by the path in the second argument to -- exist. If it does not, the first argument is not modified. -- pgJsonbSet will create any intermediate objects necessary. This -- corresponds to the create_missing argument of -- jsonb_set being set to false or true respectively. pgJsonbSet :: QGenExpr ctxt Postgres s (PgJSONB a) -> QGenExpr ctxt Postgres s (Vector Text) -> QGenExpr ctxt Postgres s (PgJSONB b) -> QGenExpr ctxt Postgres s (PgJSONB a) -- | Postgres jsonb_pretty function pgJsonbPretty :: QGenExpr ctxt Postgres s (PgJSONB a) -> QGenExpr ctxt Postgres s Text -- | Postgres MONEY data type. A simple wrapper over -- ByteString, because Postgres money format is locale-dependent, -- and we don't handle currency symbol placement, digit grouping, or -- decimal separation. -- -- The pgMoney function can be used to convert a number to -- PgMoney. newtype PgMoney PgMoney :: ByteString -> PgMoney [fromPgMoney] :: PgMoney -> ByteString -- | Attempt to pack a floating point value as a PgMoney value, -- paying no attention to the locale-dependent currency symbol, digit -- grouping, or decimal point. This will use the . symbol as the -- decimal separator. pgMoney :: Real a => a -> PgMoney -- | Multiply a MONEY value by a numeric value. Corresponds to the -- Postgres * operator. pgScaleMoney_ :: Num a => QGenExpr context Postgres s a -> QGenExpr context Postgres s PgMoney -> QGenExpr context Postgres s PgMoney -- | Divide a MONEY value by a numeric value. Corresponds to -- Postgres / where the numerator has type MONEY and -- the denominator is a number. If you would like to divide two -- MONEY values and have their units cancel out, use -- pgDivideMoneys_. pgDivideMoney_ :: Num a => QGenExpr context Postgres s PgMoney -> QGenExpr context Postgres s a -> QGenExpr context Postgres s PgMoney -- | Dividing two MONEY value results in a number. Corresponds to -- Postgres / on two MONEY values. If you would like to -- divide MONEY by a scalar, use pgDivideMoney_ pgDivideMoneys_ :: Num a => QGenExpr context Postgres s PgMoney -> QGenExpr context Postgres s PgMoney -> QGenExpr context Postgres s a -- | Postgres + and - operators on money. pgAddMoney_ :: QGenExpr context Postgres s PgMoney -> QGenExpr context Postgres s PgMoney -> QGenExpr context Postgres s PgMoney -- | Postgres + and - operators on money. pgSubtractMoney_ :: QGenExpr context Postgres s PgMoney -> QGenExpr context Postgres s PgMoney -> QGenExpr context Postgres s PgMoney -- | The Postgres MONEY type can be summed or averaged in an -- aggregation. These functions provide the quantified aggregations. See -- pgSumMoney_ and pgAvgMoney_ for the unquantified -- versions. pgSumMoneyOver_ :: Maybe PgAggregationSetQuantifierSyntax -> QExpr Postgres s PgMoney -> QExpr Postgres s PgMoney -- | The Postgres MONEY type can be summed or averaged in an -- aggregation. These functions provide the quantified aggregations. See -- pgSumMoney_ and pgAvgMoney_ for the unquantified -- versions. pgAvgMoneyOver_ :: Maybe PgAggregationSetQuantifierSyntax -> QExpr Postgres s PgMoney -> QExpr Postgres s PgMoney -- | The Postgres MONEY type can be summed or averaged in an -- aggregation. To provide an explicit quantification, see -- pgSumMoneyOver_ and pgAvgMoneyOver_. pgSumMoney_ :: QExpr Postgres s PgMoney -> QExpr Postgres s PgMoney -- | The Postgres MONEY type can be summed or averaged in an -- aggregation. To provide an explicit quantification, see -- pgSumMoneyOver_ and pgAvgMoneyOver_. pgAvgMoney_ :: QExpr Postgres s PgMoney -> QExpr Postgres s PgMoney data PgPoint PgPoint :: {-# UNPACK #-} !Double -> {-# UNPACK #-} !Double -> PgPoint data PgLine PgLine :: {-# UNPACK #-} !Double -> {-# UNPACK #-} !Double -> {-# UNPACK #-} !Double -> PgLine data PgLineSegment PgLineSegment :: {-# UNPACK #-} !PgPoint -> {-# UNPACK #-} !PgPoint -> PgLineSegment data PgBox PgBox :: {-# UNPACK #-} !PgPoint -> {-# UNPACK #-} !PgPoint -> PgBox data PgPath PgPathOpen :: NonEmpty PgPoint -> PgPath PgPathClosed :: NonEmpty PgPoint -> PgPath data PgPolygon PgPolygon :: NonEmpty PgPoint -> PgPolygon data PgCircle PgCircle :: {-# UNPACK #-} !PgPoint -> {-# UNPACK #-} !Double -> PgCircle -- | The type of Postgres regular expressions. Only a -- HasSqlValueSyntax instance is supplied, because you won't need -- to be reading these back from the database. -- -- If you're generating regexes dynamically, then use pgRegex_ to -- convert a string expression into a regex one. newtype PgRegex PgRegex :: Text -> PgRegex -- | Convert a string valued expression (which could be generated -- dynamically) into a PgRegex-typed one. pgRegex_ :: BeamSqlBackendIsString Postgres text => QGenExpr ctxt Postgres s text -> QGenExpr ctxt Postgres s PgRegex -- | Match regular expression, case-sensitive (~.) :: BeamSqlBackendIsString Postgres text => QGenExpr ctxt Postgres s text -> QGenExpr ctxt Postgres s PgRegex -> QGenExpr ctxt Postgres s Bool -- | Match regular expression, case-insensitive (~*.) :: BeamSqlBackendIsString Postgres text => QGenExpr ctxt Postgres s text -> QGenExpr ctxt Postgres s PgRegex -> QGenExpr ctxt Postgres s Bool -- | Does not match regular expression, case-sensitive (!~.) :: BeamSqlBackendIsString Postgres text => QGenExpr ctxt Postgres s text -> QGenExpr ctxt Postgres s PgRegex -> QGenExpr ctxt Postgres s Bool -- | Does not match regular expression, case-insensitive (!~*.) :: BeamSqlBackendIsString Postgres text => QGenExpr ctxt Postgres s text -> QGenExpr ctxt Postgres s PgRegex -> QGenExpr ctxt Postgres s Bool -- | Postgres regexp_replace. Replaces all instances of the regex -- in the first argument with the third argument. The fourth argument is -- the postgres regex options to provide. pgRegexpReplace_ :: BeamSqlBackendIsString Postgres text => QGenExpr ctxt Postgres s text -> QGenExpr ctxt Postgres s PgRegex -> QGenExpr ctxt Postgres s text -> QGenExpr ctxt Postgres s Text -> QGenExpr ctxt Postgres s txt -- | Postgres regexp_match. Matches the regular expression against -- the string given and returns an array where each element corresponds -- to a match in the string, or NULL if nothing was found pgRegexpMatch_ :: BeamSqlBackendIsString Postgres text => QGenExpr ctxt Postgres s text -> QGenExpr ctxt Postgres s PgRegex -> QGenExpr ctxt Postgres s (Maybe (Vector text)) -- | Postgres regexp_split_to_table. Splits the given string by -- the given regex and return a result set that can be joined against. pgRegexpSplitToTable :: BeamSqlBackendIsString Postgres text => QGenExpr ctxt Postgres s text -> QGenExpr ctxt Postgres s PgRegex -> Q Postgres db s (QExpr Postgres s Text) -- | Postgres regexp_split_to_array. Splits the given string by -- the given regex and returns the result as an array. pgRegexpSplitToArray :: BeamSqlBackendIsString Postgres text => QGenExpr ctxt Postgres s text -> QGenExpr ctxt Postgres s PgRegex -> QGenExpr ctxt Postgres s (Vector text) data PgSetOf (tbl :: (* -> *) -> *) -- | Join the results of the given set-valued function to the query pgUnnest :: forall tbl db s. Beamable tbl => QExpr Postgres s (PgSetOf tbl) -> Q Postgres db s (QExprTable Postgres s tbl) -- | Introduce each element of the array as a row pgUnnestArray :: QExpr Postgres s (Vector a) -> Q Postgres db s (QExpr Postgres s a) -- | Introduce each element of the array as a row, along with the element's -- index pgUnnestArrayWithOrdinality :: QExpr Postgres s (Vector a) -> Q Postgres db s (QExpr Postgres s Int64, QExpr Postgres s a) -- | An expression context that determines which types of expressions can -- be put inside an array element. Any scalar, aggregate, or window -- expression can be placed within an array. data PgArrayValueContext -- | If you are extending beam-postgres and provide another expression -- context that can be represented in an array, provide an empty instance -- of this class. class PgIsArrayContext ctxt -- | Build a 1-dimensional postgres array from an arbitrary Foldable -- containing expressions. array_ :: forall context f s a. (PgIsArrayContext context, Foldable f) => f (QGenExpr context Postgres s a) -> QGenExpr context Postgres s (Vector a) -- | Build a 1-dimensional postgres array from a subquery arrayOf_ :: Q Postgres db s (QExpr Postgres s a) -> QGenExpr context Postgres s (Vector a) -- | Postgres || operator. Concatenates two vectors and returns -- their result. (++.) :: QGenExpr ctxt Postgres s (Vector a) -> QGenExpr ctxt Postgres s (Vector a) -> QGenExpr ctxt Postgres s (Vector a) -- | An aggregate that adds each value to the resulting array. See -- pgArrayOver if you want to specify a quantifier. Corresponds -- to the Postgres ARRAY_AGG function. pgArrayAgg :: QExpr Postgres s a -> QAgg Postgres s (Vector a) -- | Postgres ARRAY_AGG with an explicit quantifier. Includes each -- row that meets the quantification criteria in the result. pgArrayAggOver :: Maybe PgAggregationSetQuantifierSyntax -> QExpr Postgres s a -> QAgg Postgres s (Vector a) -- | Index into the given array. This translates to the -- array[index] syntax in postgres. The beam -- operator name has been chosen to match the 'Data.Vector.(!)' operator. (!.) :: Integral ix => QGenExpr context Postgres s (Vector a) -> QGenExpr context Postgres s ix -> QGenExpr context Postgres s a -- | Postgres array_dims() function. Returns a textual -- representation of the dimensions of the array. arrayDims_ :: BeamSqlBackendIsString Postgres text => QGenExpr context Postgres s (Vector a) -> QGenExpr context Postgres s text -- | Return the upper or lower bound of the given array at the given -- dimension (statically supplied as a type application on a Nat). -- Note that beam will attempt to statically determine if the dimension -- is in range. GHC errors will be thrown if this cannot be proved. -- -- For example, to get the upper bound of the 2nd-dimension of an array: -- --
--   arrayUpper_ @2 vectorValuedExpression
--   
arrayUpper_ :: forall (dim :: Nat) context num v s. (KnownNat dim, WithinBounds dim (Vector v), Integral num) => QGenExpr context Postgres s (Vector v) -> QGenExpr context Postgres s num -- | Return the upper or lower bound of the given array at the given -- dimension (statically supplied as a type application on a Nat). -- Note that beam will attempt to statically determine if the dimension -- is in range. GHC errors will be thrown if this cannot be proved. -- -- For example, to get the upper bound of the 2nd-dimension of an array: -- --
--   arrayUpper_ @2 vectorValuedExpression
--   
arrayLower_ :: forall (dim :: Nat) context num v s. (KnownNat dim, WithinBounds dim (Vector v), Integral num) => QGenExpr context Postgres s (Vector v) -> QGenExpr context Postgres s num -- | These functions can be used to find the lower and upper bounds of an -- array where the dimension number is not known until run-time. They are -- marked unsafe because they may cause query processing to fail at -- runtime, even if they typecheck successfully. arrayUpperUnsafe_ :: (Integral dim, Integral length) => QGenExpr context Postgres s (Vector v) -> QGenExpr context Postgres s dim -> QGenExpr context Postgres s (Maybe length) -- | These functions can be used to find the lower and upper bounds of an -- array where the dimension number is not known until run-time. They are -- marked unsafe because they may cause query processing to fail at -- runtime, even if they typecheck successfully. arrayLowerUnsafe_ :: (Integral dim, Integral length) => QGenExpr context Postgres s (Vector v) -> QGenExpr context Postgres s dim -> QGenExpr context Postgres s (Maybe length) -- | Get the size of the array at the given (statically known) dimension, -- provided as a type-level Nat. Like the arrayUpper_ and -- arrayLower_ functions,throws a compile-time error if the -- dimension is out of bounds. arrayLength_ :: forall (dim :: Nat) ctxt num v s. (KnownNat dim, WithinBounds dim (Vector v), Integral num) => QGenExpr ctxt Postgres s (Vector v) -> QGenExpr ctxt Postgres s num -- | Get the size of an array at a dimension not known until run-time. -- Marked unsafe as this may cause runtime errors even if it type checks. arrayLengthUnsafe_ :: (Integral dim, Integral num) => QGenExpr ctxt Postgres s (Vector v) -> QGenExpr ctxt Postgres s dim -> QGenExpr ctxt Postgres s (Maybe num) -- | The Postgres @> operator. Returns true if every member of -- the second array is present in the first. isSupersetOf_ :: QGenExpr ctxt Postgres s (Vector a) -> QGenExpr ctxt Postgres s (Vector a) -> QGenExpr ctxt Postgres s Bool -- | The Postgres <@ operator. Returns true if every member of -- the first array is present in the second. isSubsetOf_ :: QGenExpr ctxt Postgres s (Vector a) -> QGenExpr ctxt Postgres s (Vector a) -> QGenExpr ctxt Postgres s Bool -- | A range of a given Haskell type (represented by a) stored as -- a given Postgres Range Type (represented by n). -- -- A reasonable example might be Range PgInt8Range Int64. This -- represents a range of Haskell Int64 values stored as a range -- of bigint in Postgres. data PgRange (n :: *) a PgEmptyRange :: PgRange (n :: *) a PgRange :: PgRangeBound a -> PgRangeBound a -> PgRange (n :: *) a -- | Represents a single bound on a Range. A bound always has a type, but -- may not have a value (the absense of a value represents unbounded). data PgRangeBound a PgRangeBound :: PgBoundType -> Maybe a -> PgRangeBound a -- | Represents the types of bounds a range can have. A range can and often -- does have mis-matched bound types. data PgBoundType Inclusive :: PgBoundType Exclusive :: PgBoundType -- | A class representing Postgres Range types and how to refer to them -- when speaking to the database. -- -- For custom Range types, create an uninhabited type, and make it an -- instance of this class. class PgIsRange n -- | The range type name in the database. rangeName :: PgIsRange n => ByteString data PgInt4Range data PgInt8Range data PgNumRange data PgTsRange data PgTsTzRange data PgDateRange range_ :: forall n a context s. PgIsRange n => PgBoundType -> PgBoundType -> QGenExpr context Postgres s (Maybe a) -> QGenExpr context Postgres s (Maybe a) -> QGenExpr context Postgres s (PgRange n a) inclusive :: a -> PgRangeBound a exclusive :: a -> PgRangeBound a unbounded :: PgRangeBound a (-@>-) :: QGenExpr context Postgres s (PgRange n a) -> QGenExpr context Postgres s (PgRange n a) -> QGenExpr context Postgres s Bool (-@>) :: QGenExpr context Postgres s (PgRange n a) -> QGenExpr context Postgres s a -> QGenExpr context Postgres s Bool (-<@-) :: QGenExpr context Postgres s (PgRange n a) -> QGenExpr context Postgres s (PgRange n a) -> QGenExpr context Postgres s Bool (<@-) :: QGenExpr context Postgres s a -> QGenExpr context Postgres s (PgRange n a) -> QGenExpr context Postgres s Bool (-&&-) :: QGenExpr context Postgres s (PgRange n a) -> QGenExpr context Postgres s (PgRange n a) -> QGenExpr context Postgres s Bool (-<<-) :: QGenExpr context Postgres s (PgRange n a) -> QGenExpr context Postgres s (PgRange n a) -> QGenExpr context Postgres s Bool (->>-) :: QGenExpr context Postgres s (PgRange n a) -> QGenExpr context Postgres s (PgRange n a) -> QGenExpr context Postgres s Bool (-&<-) :: QGenExpr context Postgres s (PgRange n a) -> QGenExpr context Postgres s (PgRange n a) -> QGenExpr context Postgres s Bool (-&>-) :: QGenExpr context Postgres s (PgRange n a) -> QGenExpr context Postgres s (PgRange n a) -> QGenExpr context Postgres s Bool (--|--) :: QGenExpr context Postgres s (PgRange n a) -> QGenExpr context Postgres s (PgRange n a) -> QGenExpr context Postgres s Bool (-+-) :: QGenExpr context Postgres s (PgRange n a) -> QGenExpr context Postgres s (PgRange n a) -> QGenExpr context Postgres s (PgRange n a) (-*-) :: QGenExpr context Postgres s (PgRange n a) -> QGenExpr context Postgres s (PgRange n a) -> QGenExpr context Postgres s (PgRange n a) -- | The postgres range operator - . (-.-) :: QGenExpr context Postgres s (PgRange n a) -> QGenExpr context Postgres s (PgRange n a) -> QGenExpr context Postgres s (PgRange n a) rLower_ :: QGenExpr context Postgres s (PgRange n a) -> QGenExpr context Postgres s (Maybe a) rUpper_ :: QGenExpr context Postgres s (PgRange n a) -> QGenExpr context Postgres s (Maybe a) isEmpty_ :: QGenExpr context Postgres s (PgRange n a) -> QGenExpr context Postgres s Bool lowerInc_ :: QGenExpr context Postgres s (PgRange n a) -> QGenExpr context Postgres s Bool upperInc_ :: QGenExpr context Postgres s (PgRange n a) -> QGenExpr context Postgres s Bool lowerInf_ :: QGenExpr context Postgres s (PgRange n a) -> QGenExpr context Postgres s Bool upperInf_ :: QGenExpr context Postgres s (PgRange n a) -> QGenExpr context Postgres s Bool rangeMerge_ :: QGenExpr context Postgres s (PgRange n a) -> QGenExpr context Postgres s (PgRange n a) -> QGenExpr context Postgres s (PgRange n a) century_ :: HasSqlDate tgt => ExtractField Postgres tgt Int32 decade_ :: HasSqlDate tgt => ExtractField Postgres tgt Int32 dow_ :: HasSqlDate tgt => ExtractField Postgres tgt Int32 doy_ :: HasSqlDate tgt => ExtractField Postgres tgt Int32 epoch_ :: HasSqlTime tgt => ExtractField Postgres tgt NominalDiffTime isodow_ :: HasSqlDate tgt => ExtractField Postgres tgt Int32 isoyear_ :: HasSqlDate tgt => ExtractField Postgres tgt Int32 microseconds_ :: HasSqlTime tgt => ExtractField Postgres tgt Int32 milliseconds_ :: HasSqlTime tgt => ExtractField Postgres tgt Int32 millennium_ :: HasSqlDate tgt => ExtractField Postgres tgt Int32 quarter_ :: HasSqlDate tgt => ExtractField Postgres tgt Int32 week_ :: HasSqlDate tgt => ExtractField Postgres tgt Int32 -- | Postgres bool_or aggregate. Returns true if any of the rows -- are true. pgBoolOr :: QExpr Postgres s a -> QAgg Postgres s (Maybe Bool) -- | Postgres bool_and aggregate. Returns false unless every row -- is true. pgBoolAnd :: QExpr Postgres s a -> QAgg Postgres s (Maybe Bool) -- | Joins the string value in each row of the first argument, using the -- second argument as a delimiter. See pgStringAggOver if you want -- to provide explicit quantification. pgStringAgg :: BeamSqlBackendIsString Postgres str => QExpr Postgres s str -> QExpr Postgres s str -> QAgg Postgres s (Maybe str) -- | The Postgres string_agg function, with an explicit -- quantifier. Joins the values of the second argument using the -- delimiter given by the third. pgStringAggOver :: BeamSqlBackendIsString Postgres str => Maybe PgAggregationSetQuantifierSyntax -> QExpr Postgres s str -> QExpr Postgres s str -> QAgg Postgres s (Maybe str) -- | Modify a query to only return rows where the supplied key function -- returns a unique value. This corresponds to the Postgres DISTINCT -- ON support. pgNubBy_ :: (Projectible Postgres key, Projectible Postgres r) => (r -> key) -> Q Postgres db s r -> Q Postgres db s r -- | Postgres NOW() function. Returns the server's timestamp now_ :: QExpr Postgres s LocalTime -- | Postgres ILIKE operator. A case-insensitive version of -- like_. ilike_ :: BeamSqlBackendIsString Postgres text => QExpr Postgres s text -> QExpr Postgres s text -> QExpr Postgres s Bool -- | Postgres ILIKE operator. A case-insensitive version of -- like_'. ilike_' :: (BeamSqlBackendIsString Postgres left, BeamSqlBackendIsString Postgres right) => QExpr Postgres s left -> QExpr Postgres s right -> QExpr Postgres s Bool runBeamPostgres :: Connection -> Pg a -> IO a runBeamPostgresDebug :: (String -> IO ()) -> Connection -> Pg a -> IO a -- | Represents an extension in a database. -- -- For example, to include the Database.Beam.Postgres.PgCrypto -- extension in a database, -- --
--   import Database.Beam.Postgres.PgCrypto
--   
--   data MyDatabase entity
--       = MyDatabase
--       { _table1 :: entity (TableEntity Table1)
--       , _cryptoExtension :: entity (PgExtensionEntity PgCrypto)
--       }
--   
--   migratableDbSettings :: CheckedDatabaseSettings Postgres MyDatabase
--   migratableDbSettings = defaultMigratableDbSettings
--   
--   dbSettings :: DatabaseSettings Postgres MyDatabase
--   dbSettings = unCheckDatabase migratableDbSettings
--   
-- -- Note that our database now only works in the Postgres backend. -- -- Extensions are implemented as records of functions and values that -- expose extension functionality. For example, the pgcrypto -- extension (implemented by PgCrypto) provides cryptographic -- functions. Thus, PgCrypto is a record of functions over -- QGenExpr which wrap the underlying postgres functionality. -- -- You get access to these functions by retrieving them from the entity -- in the database. -- -- For example, to use the pgcrypto extension in the database -- above: -- --
--   let PgCrypto { pgCryptoDigestText = digestText
--                , pgCryptoCrypt = crypt } = getPgExtension (_cryptoExtension dbSettings)
--   in fmap_ (tbl -> (tbl, crypt (_field1 tbl) (_salt tbl))) (all_ (table1 dbSettings))
--   
-- -- To implement your own extension, create a record type, and implement -- the IsPgExtension type class. data PgExtensionEntity extension -- | Type class implemented by any Postgresql extension class IsPgExtension extension -- | Return the name of this extension. This should be the string that is -- passed to CREATE EXTENSION. For example, PgCrypto -- returns "pgcrypto". pgExtensionName :: IsPgExtension extension => Proxy extension -> Text -- | Return a value of this extension type. This should fill in all fields -- in the record. For example, PgCrypto builds a record where -- each function wraps the underlying Postgres one. pgExtensionBuild :: IsPgExtension extension => extension -- | Migration representing the Postgres CREATE EXTENSION -- command. Because the extension name is statically known by the -- extension type and IsPgExtension type class, this simply -- produces the checked extension entity. -- -- If you need to use the extension in subsequent migration steps, use -- getPgExtension and unCheck to get access to the -- underlying DatabaseEntity. pgCreateExtension :: forall extension db. IsPgExtension extension => Migration Postgres (CheckedDatabaseEntity Postgres db (PgExtensionEntity extension)) -- | Migration representing the Postgres DROP EXTENSION. -- After this executes, you should expect any further uses of the -- extension to fail. Unfortunately, without linear types, we cannot -- check this. pgDropExtension :: forall extension. CheckedDatabaseEntityDescriptor Postgres (PgExtensionEntity extension) -> Migration Postgres () -- | Get the extension record from a database entity. See the documentation -- for PgExtensionEntity. getPgExtension :: DatabaseEntity Postgres db (PgExtensionEntity extension) -> extension -- | Deserialize integral fields, possibly downcasting from a larger -- integral type, but only if we won't lose data fromPgIntegral :: forall a. (FromField a, Integral a, Typeable a) => FromBackendRowM Postgres a -- | Deserialize integral fields, possibly downcasting from a larger -- numeric type via Scientific if we won't lose data, and then -- falling back to any integral type via Integer fromPgScientificOrIntegral :: (Bounded a, Integral a) => FromBackendRowM Postgres a -- | Type class for Sql* types that can be turned into Postgres -- syntax, for use in the following debugging functions -- -- These include -- -- class PgDebugStmt statement pgTraceStmtIO :: PgDebugStmt statement => Connection -> statement -> IO () pgTraceStmtIO' :: PgDebugStmt statement => Connection -> statement -> IO ByteString pgTraceStmt :: PgDebugStmt statement => statement -> Pg () -- | Exception thrown if conversion from a SQL value to a Haskell value -- fails. data ResultError -- | The SQL and Haskell types are not compatible. Incompatible :: String -> Maybe Oid -> String -> String -> String -> ResultError [errSQLType] :: ResultError -> String [errSQLTableOid] :: ResultError -> Maybe Oid [errSQLField] :: ResultError -> String [errHaskellType] :: ResultError -> String [errMessage] :: ResultError -> String -- | A SQL NULL was encountered when the Haskell type did not -- permit it. UnexpectedNull :: String -> Maybe Oid -> String -> String -> String -> ResultError [errSQLType] :: ResultError -> String [errSQLTableOid] :: ResultError -> Maybe Oid [errSQLField] :: ResultError -> String [errHaskellType] :: ResultError -> String [errMessage] :: ResultError -> String -- | The SQL value could not be parsed, or could not be represented as a -- valid Haskell value, or an unexpected low-level error occurred (e.g. -- mismatch between metadata and actual data in a row). ConversionFailed :: String -> Maybe Oid -> String -> String -> String -> ResultError [errSQLType] :: ResultError -> String [errSQLTableOid] :: ResultError -> Maybe Oid [errSQLField] :: ResultError -> String [errHaskellType] :: ResultError -> String [errMessage] :: ResultError -> String data SqlError SqlError :: ByteString -> ExecStatus -> ByteString -> ByteString -> ByteString -> SqlError [sqlState] :: SqlError -> ByteString [sqlExecStatus] :: SqlError -> ExecStatus [sqlErrorMsg] :: SqlError -> ByteString [sqlErrorDetail] :: SqlError -> ByteString [sqlErrorHint] :: SqlError -> ByteString data Connection data ConnectInfo ConnectInfo :: String -> Word16 -> String -> String -> String -> ConnectInfo [connectHost] :: ConnectInfo -> String [connectPort] :: ConnectInfo -> Word16 [connectUser] :: ConnectInfo -> String [connectPassword] :: ConnectInfo -> String [connectDatabase] :: ConnectInfo -> String -- | Default information for setting up a connection. -- -- Defaults are as follows: -- -- -- -- Use as in the following example: -- --
--   connect defaultConnectInfo { connectHost = "db.example.com" }
--   
defaultConnectInfo :: ConnectInfo -- | Attempt to make a connection based on a libpq connection string. See -- https://www.postgresql.org/docs/9.5/static/libpq-connect.html#LIBPQ-CONNSTRING -- for more information. Also note that environment variables also affect -- parameters not provided, parameters provided as the empty string, and -- a few other things; see -- https://www.postgresql.org/docs/9.5/static/libpq-envars.html -- for details. Here is an example with some of the most commonly used -- parameters: -- --
--   host='db.somedomain.com' port=5432 ...
--   
-- -- This attempts to connect to db.somedomain.com:5432. Omitting -- the port will normally default to 5432. -- -- On systems that provide unix domain sockets, omitting the host -- parameter will cause libpq to attempt to connect via unix domain -- sockets. The default filesystem path to the socket is constructed from -- the port number and the DEFAULT_PGSOCKET_DIR constant defined -- in the pg_config_manual.h header file. Connecting via unix -- sockets tends to use the peer authentication method, which is -- very secure and does not require a password. -- -- On Windows and other systems without unix domain sockets, omitting the -- host will default to localhost. -- --
--   ... dbname='postgres' user='postgres' password='secret \' \\ pw'
--   
-- -- This attempts to connect to a database named postgres with -- user postgres and password secret ' \ pw. Backslash -- characters will have to be double-quoted in literal Haskell strings, -- of course. Omitting dbname and user will both -- default to the system username that the client process is running as. -- -- Omitting password will default to an appropriate password -- found in the pgpass file, or no password at all if a matching -- line is not found. The path of the pgpass file may be -- specified by setting the PGPASSFILE environment variable. See -- https://www.postgresql.org/docs/9.5/static/libpq-pgpass.html -- for more information regarding this file. -- -- As all parameters are optional and the defaults are sensible, the -- empty connection string can be useful for development and exploratory -- use, assuming your system is set up appropriately. -- -- On Unix, such a setup would typically consist of a local postgresql -- server listening on port 5432, as well as a system user, database -- user, and database sharing a common name, with permissions granted to -- the user on the database. -- -- On Windows, in addition you will either need pg_hba.conf to -- specify the use of the trust authentication method for the -- connection, which may not be appropriate for multiuser or production -- machines, or you will need to use a pgpass file with the -- password or md5 authentication methods. -- -- See -- https://www.postgresql.org/docs/9.5/static/client-authentication.html -- for more information regarding the authentication process. -- -- SSL/TLS will typically "just work" if your postgresql server supports -- or requires it. However, note that libpq is trivially vulnerable to a -- MITM attack without setting additional SSL connection parameters. In -- particular, sslmode needs to be set to require, -- verify-ca, or verify-full in order to perform -- certificate validation. When sslmode is require, -- then you will also need to specify a sslrootcert file, -- otherwise no validation of the server's identity will be performed. -- Client authentication via certificates is also possible via the -- sslcert and sslkey parameters. See -- https://www.postgresql.org/docs/9.5/static/libpq-ssl.html for -- detailed information regarding libpq and SSL. connectPostgreSQL :: ByteString -> IO Connection -- | Connect with the given username to the given database. Will throw an -- exception if it cannot connect. connect :: ConnectInfo -> IO Connection close :: Connection -> IO () -- | The pgcrypto extension provides several cryptographic -- functions to Postgres. This module provides a beam-postgres -- extension to access this functionality. For an example of usage, see -- the documentation for PgExtensionEntity. module Database.Beam.Postgres.PgCrypto -- | Data type representing definitions contained in the pgcrypto -- extension -- -- Each field maps closely to the underlying pgcrypto function, -- which are described in further detail in the pgcrypto manual. data PgCrypto PgCrypto :: (forall ctxt s. LiftPg ctxt s (Text -> Text -> ByteString)) -> (forall ctxt s. LiftPg ctxt s (ByteString -> Text -> ByteString)) -> (forall ctxt s. LiftPg ctxt s (Text -> Text -> Text -> ByteString)) -> (forall ctxt s. LiftPg ctxt s (ByteString -> Text -> Text -> ByteString)) -> (forall ctxt s. LiftPg ctxt s (Text -> Text -> Text)) -> (forall ctxt s. LiftPg ctxt s (Text -> Maybe Int32 -> Text)) -> (forall ctxt s. LiftPg ctxt s (Text -> Text -> Maybe Text -> ByteString)) -> (forall ctxt s. LiftPg ctxt s (ByteString -> Text -> Maybe Text -> ByteString)) -> (forall ctxt s. LiftPg ctxt s (ByteString -> Text -> Maybe Text -> Text)) -> (forall ctxt s. LiftPg ctxt s (ByteString -> Text -> Maybe Text -> ByteString)) -> (forall ctxt s. LiftPg ctxt s (Text -> ByteString -> Maybe Text -> ByteString)) -> (forall ctxt s. LiftPg ctxt s (ByteString -> ByteString -> Maybe Text -> ByteString)) -> (forall ctxt s. LiftPg ctxt s (ByteString -> ByteString -> Maybe Text -> Maybe Text -> Text)) -> (forall ctxt s. LiftPg ctxt s (ByteString -> ByteString -> Maybe Text -> Maybe Text -> ByteString)) -> (forall ctxt s. LiftPg ctxt s (ByteString -> Text)) -> (forall ctxt s. PgExpr ctxt s ByteString -> Maybe (PgExpr ctxt s (Vector Text), PgExpr ctxt s (Vector Text)) -> PgExpr ctxt s Text) -> (forall ctxt s. LiftPg ctxt s (Text -> ByteString)) -> (forall ctxt s i. Integral i => PgExpr ctxt s i -> PgExpr ctxt s ByteString) -> (forall ctxt s. PgExpr ctxt s UUID) -> PgCrypto [pgCryptoDigestText] :: PgCrypto -> forall ctxt s. LiftPg ctxt s (Text -> Text -> ByteString) [pgCryptoDigestBytes] :: PgCrypto -> forall ctxt s. LiftPg ctxt s (ByteString -> Text -> ByteString) [pgCryptoHmacText] :: PgCrypto -> forall ctxt s. LiftPg ctxt s (Text -> Text -> Text -> ByteString) [pgCryptoHmacBytes] :: PgCrypto -> forall ctxt s. LiftPg ctxt s (ByteString -> Text -> Text -> ByteString) [pgCryptoCrypt] :: PgCrypto -> forall ctxt s. LiftPg ctxt s (Text -> Text -> Text) [pgCryptoGenSalt] :: PgCrypto -> forall ctxt s. LiftPg ctxt s (Text -> Maybe Int32 -> Text) [pgCryptoPgpSymEncrypt] :: PgCrypto -> forall ctxt s. LiftPg ctxt s (Text -> Text -> Maybe Text -> ByteString) [pgCryptoPgpSymEncryptBytea] :: PgCrypto -> forall ctxt s. LiftPg ctxt s (ByteString -> Text -> Maybe Text -> ByteString) [pgCryptoPgpSymDecrypt] :: PgCrypto -> forall ctxt s. LiftPg ctxt s (ByteString -> Text -> Maybe Text -> Text) [pgCryptoPgpSymDecryptBytea] :: PgCrypto -> forall ctxt s. LiftPg ctxt s (ByteString -> Text -> Maybe Text -> ByteString) [pgCryptoPgpPubEncrypt] :: PgCrypto -> forall ctxt s. LiftPg ctxt s (Text -> ByteString -> Maybe Text -> ByteString) [pgCryptoPgpPubEncryptBytea] :: PgCrypto -> forall ctxt s. LiftPg ctxt s (ByteString -> ByteString -> Maybe Text -> ByteString) [pgCryptoPgpPubDecrypt] :: PgCrypto -> forall ctxt s. LiftPg ctxt s (ByteString -> ByteString -> Maybe Text -> Maybe Text -> Text) [pgCryptoPgpPubDecryptBytea] :: PgCrypto -> forall ctxt s. LiftPg ctxt s (ByteString -> ByteString -> Maybe Text -> Maybe Text -> ByteString) [pgCryptoPgpKeyId] :: PgCrypto -> forall ctxt s. LiftPg ctxt s (ByteString -> Text) [pgCryptoArmor] :: PgCrypto -> forall ctxt s. PgExpr ctxt s ByteString -> Maybe (PgExpr ctxt s (Vector Text), PgExpr ctxt s (Vector Text)) -> PgExpr ctxt s Text [pgCryptoDearmor] :: PgCrypto -> forall ctxt s. LiftPg ctxt s (Text -> ByteString) [pgCryptoGenRandomBytes] :: PgCrypto -> forall ctxt s i. Integral i => PgExpr ctxt s i -> PgExpr ctxt s ByteString [pgCryptoGenRandomUUID] :: PgCrypto -> forall ctxt s. PgExpr ctxt s UUID instance Database.Beam.Postgres.Extensions.IsPgExtension Database.Beam.Postgres.PgCrypto.PgCrypto -- | The uuid-ossp extension provides functions for constructing -- UUIDs. -- -- For an example of usage, see the documentation for -- PgExtensionEntity. module Database.Beam.Postgres.Extensions.UuidOssp -- | Data type representing definitions contained in the uuid-ossp -- extension data UuidOssp UuidOssp :: (forall ctxt s. LiftPg ctxt s UUID) -> (forall ctxt s. LiftPg ctxt s UUID) -> (forall ctxt s. LiftPg ctxt s UUID) -> (forall ctxt s. LiftPg ctxt s UUID) -> (forall ctxt s. LiftPg ctxt s UUID) -> (forall ctxt s. LiftPg ctxt s UUID) -> (forall ctxt s. LiftPg ctxt s UUID) -> (forall ctxt s. LiftPg ctxt s (UUID -> Text -> UUID)) -> (forall ctxt s. LiftPg ctxt s UUID) -> (forall ctxt s. LiftPg ctxt s (UUID -> Text -> UUID)) -> UuidOssp [pgUuidNil] :: UuidOssp -> forall ctxt s. LiftPg ctxt s UUID [pgUuidNsDns] :: UuidOssp -> forall ctxt s. LiftPg ctxt s UUID [pgUuidNsUrl] :: UuidOssp -> forall ctxt s. LiftPg ctxt s UUID [pgUuidNsOid] :: UuidOssp -> forall ctxt s. LiftPg ctxt s UUID [pgUuidNsX500] :: UuidOssp -> forall ctxt s. LiftPg ctxt s UUID [pgUuidGenerateV1] :: UuidOssp -> forall ctxt s. LiftPg ctxt s UUID [pgUuidGenerateV1Mc] :: UuidOssp -> forall ctxt s. LiftPg ctxt s UUID [pgUuidGenerateV3] :: UuidOssp -> forall ctxt s. LiftPg ctxt s (UUID -> Text -> UUID) [pgUuidGenerateV4] :: UuidOssp -> forall ctxt s. LiftPg ctxt s UUID [pgUuidGenerateV5] :: UuidOssp -> forall ctxt s. LiftPg ctxt s (UUID -> Text -> UUID) instance Database.Beam.Postgres.Extensions.IsPgExtension Database.Beam.Postgres.Extensions.UuidOssp.UuidOssp