Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data ContentType
- toHeader :: ContentType -> Header
- toMime :: ContentType -> ByteString
- decodeContentType :: ByteString -> ContentType
- type SqlQuery = Text
- type SqlFragment = Text
- data PreferResolution
- data PreferRepresentation
- = Full
- | HeadersOnly
- | None
- data PreferParameters
- data PreferCount
- data DbStructure = DbStructure {
- dbTables :: [Table]
- dbColumns :: [Column]
- dbRelations :: [Relation]
- dbPrimaryKeys :: [PrimaryKey]
- dbProcs :: ProcsMap
- pgVersion :: PgVersion
- tableCols :: DbStructure -> Schema -> TableName -> [Column]
- tablePKCols :: DbStructure -> Schema -> TableName -> [Text]
- data PgArg = PgArg {}
- data PgType
- data RetType
- data ProcVolatility
- data ProcDescription = ProcDescription {
- pdSchema :: Schema
- pdName :: Text
- pdDescription :: Maybe Text
- pdArgs :: [PgArg]
- pdReturnType :: RetType
- pdVolatility :: ProcVolatility
- type ProcsMap = HashMap QualifiedIdentifier [ProcDescription]
- findProc :: QualifiedIdentifier -> Set Text -> Bool -> ProcsMap -> Maybe ProcDescription
- specifiedProcArgs :: Set FieldName -> Maybe ProcDescription -> [PgArg]
- procReturnsScalar :: ProcDescription -> Bool
- procTableName :: ProcDescription -> Maybe TableName
- type Schema = Text
- type TableName = Text
- data Table = Table {}
- tableQi :: Table -> QualifiedIdentifier
- newtype ForeignKey = ForeignKey {}
- data Column = Column {
- colTable :: Table
- colName :: FieldName
- colDescription :: Maybe Text
- colPosition :: Int32
- colNullable :: Bool
- colType :: Text
- colUpdatable :: Bool
- colMaxLen :: Maybe Int32
- colPrecision :: Maybe Int32
- colDefault :: Maybe Text
- colEnum :: [Text]
- colFK :: Maybe ForeignKey
- type SourceColumn = (Column, ViewColumn)
- type ViewColumn = Column
- data PrimaryKey = PrimaryKey {}
- data OrderDirection
- data OrderNulls
- data OrderTerm = OrderTerm {}
- data QualifiedIdentifier = QualifiedIdentifier {}
- data Cardinality
- type ConstraintName = Text
- data Relation = Relation {
- relTable :: Table
- relColumns :: [Column]
- relConstraint :: Maybe ConstraintName
- relFTable :: Table
- relFColumns :: [Column]
- relType :: Cardinality
- relJunction :: Maybe Junction
- data Junction = Junction {}
- isSelfReference :: Relation -> Bool
- data PayloadJSON
- = ProcessedJSON {
- pjRaw :: ByteString
- pjKeys :: Set Text
- | RawJSON {
- pjRaw :: ByteString
- = ProcessedJSON {
- data PJType
- data Proxy = Proxy {}
- type Operator = Text
- operators :: HashMap Operator SqlFragment
- ftsOperators :: HashMap Operator SqlFragment
- data OpExpr = OpExpr Bool Operation
- data Operation
- type Language = Text
- type SingleVal = Text
- type ListVal = [Text]
- data LogicOperator
- data LogicTree
- type FieldName = Text
- type JsonPath = [JsonOperation]
- data JsonOperation
- = JArrow {
- jOp :: JsonOperand
- | J2Arrow {
- jOp :: JsonOperand
- = JArrow {
- data JsonOperand
- type Field = (FieldName, JsonPath)
- type Alias = Text
- type Cast = Text
- type NodeName = Text
- type RpcQParam = (Text, Text)
- newtype GucHeader = GucHeader (CI ByteString, ByteString)
- unwrapGucHeader :: GucHeader -> Header
- addHeadersIfNotIncluded :: [Header] -> [Header] -> [Header]
- type SelectItem = (Field, Maybe Cast, Maybe Alias, Maybe EmbedHint)
- type EmbedHint = Text
- type EmbedPath = [Text]
- data Filter = Filter {}
- data JoinCondition = JoinCondition (QualifiedIdentifier, FieldName) (QualifiedIdentifier, FieldName)
- data ReadQuery = Select {
- select :: [SelectItem]
- from :: QualifiedIdentifier
- fromAlias :: Maybe Alias
- implicitJoins :: [QualifiedIdentifier]
- where_ :: [LogicTree]
- joinConditions :: [JoinCondition]
- order :: [OrderTerm]
- range_ :: NonnegRange
- data MutateQuery
- type ReadRequest = Tree ReadNode
- type MutateRequest = MutateQuery
- type ReadNode = (ReadQuery, (NodeName, Maybe Relation, Maybe Alias, Maybe EmbedHint, Depth))
- type Depth = Integer
- fstFieldNames :: ReadRequest -> [FieldName]
- data PgVersion = PgVersion {}
- minimumPgVersion :: PgVersion
- pgVersion94 :: PgVersion
- pgVersion95 :: PgVersion
- pgVersion96 :: PgVersion
- pgVersion100 :: PgVersion
- pgVersion109 :: PgVersion
- pgVersion110 :: PgVersion
- pgVersion112 :: PgVersion
- pgVersion114 :: PgVersion
- pgVersion121 :: PgVersion
- sourceCTEName :: SqlFragment
- type JSPath = [JSPathExp]
- data JSPathExp
- data ConnectionStatus
Documentation
data ContentType Source #
Enumeration of currently supported response content types
CTApplicationJSON | |
CTSingularJSON | |
CTTextCSV | |
CTTextPlain | |
CTOpenAPI | |
CTOctetStream | |
CTAny | |
CTOther ByteString |
Instances
Eq ContentType Source # | |
Defined in PostgREST.Types (==) :: ContentType -> ContentType -> Bool # (/=) :: ContentType -> ContentType -> Bool # | |
Show ContentType Source # | |
Defined in PostgREST.Types showsPrec :: Int -> ContentType -> ShowS # show :: ContentType -> String # showList :: [ContentType] -> ShowS # |
toHeader :: ContentType -> Header Source #
Convert from ContentType to a full HTTP Header
toMime :: ContentType -> ByteString Source #
Convert from ContentType to a ByteString representing the mime type
decodeContentType :: ByteString -> ContentType Source #
Convert from ByteString to ContentType. Warning: discards MIME parameters
type SqlFragment = Text Source #
A part of a SQL query that cannot be executed independently
data PreferResolution Source #
Instances
Eq PreferResolution Source # | |
Defined in PostgREST.Types (==) :: PreferResolution -> PreferResolution -> Bool # (/=) :: PreferResolution -> PreferResolution -> Bool # | |
Show PreferResolution Source # | |
Defined in PostgREST.Types showsPrec :: Int -> PreferResolution -> ShowS # show :: PreferResolution -> String # showList :: [PreferResolution] -> ShowS # |
data PreferRepresentation Source #
How to return the mutated data. From https://tools.ietf.org/html/rfc7240#section-4.2
Full | Return the body plus the Location header(in case of POST). |
HeadersOnly | Return the Location header(in case of POST). This needs a SELECT privilege on the pk. |
None | Return nothing from the mutated data. |
Instances
Eq PreferRepresentation Source # | |
Defined in PostgREST.Types (==) :: PreferRepresentation -> PreferRepresentation -> Bool # (/=) :: PreferRepresentation -> PreferRepresentation -> Bool # | |
Show PreferRepresentation Source # | |
Defined in PostgREST.Types showsPrec :: Int -> PreferRepresentation -> ShowS # show :: PreferRepresentation -> String # showList :: [PreferRepresentation] -> ShowS # |
data PreferParameters Source #
SingleObject | Pass all parameters as a single json object to a stored procedure |
MultipleObjects | Pass an array of json objects as params to a stored procedure |
Instances
Eq PreferParameters Source # | |
Defined in PostgREST.Types (==) :: PreferParameters -> PreferParameters -> Bool # (/=) :: PreferParameters -> PreferParameters -> Bool # | |
Show PreferParameters Source # | |
Defined in PostgREST.Types showsPrec :: Int -> PreferParameters -> ShowS # show :: PreferParameters -> String # showList :: [PreferParameters] -> ShowS # |
data PreferCount Source #
ExactCount | exact count(slower) |
PlannedCount | PostgreSQL query planner rows count guess. Done by using EXPLAIN {query}. |
EstimatedCount | use the query planner rows if the count is superior to max-rows, otherwise get the exact count. |
Instances
Eq PreferCount Source # | |
Defined in PostgREST.Types (==) :: PreferCount -> PreferCount -> Bool # (/=) :: PreferCount -> PreferCount -> Bool # | |
Show PreferCount Source # | |
Defined in PostgREST.Types showsPrec :: Int -> PreferCount -> ShowS # show :: PreferCount -> String # showList :: [PreferCount] -> ShowS # |
data DbStructure Source #
DbStructure | |
|
Instances
Eq DbStructure Source # | |
Defined in PostgREST.Types (==) :: DbStructure -> DbStructure -> Bool # (/=) :: DbStructure -> DbStructure -> Bool # | |
Show DbStructure Source # | |
Defined in PostgREST.Types showsPrec :: Int -> DbStructure -> ShowS # show :: DbStructure -> String # showList :: [DbStructure] -> ShowS # |
tablePKCols :: DbStructure -> Schema -> TableName -> [Text] Source #
data ProcVolatility Source #
Instances
Eq ProcVolatility Source # | |
Defined in PostgREST.Types (==) :: ProcVolatility -> ProcVolatility -> Bool # (/=) :: ProcVolatility -> ProcVolatility -> Bool # | |
Ord ProcVolatility Source # | |
Defined in PostgREST.Types compare :: ProcVolatility -> ProcVolatility -> Ordering # (<) :: ProcVolatility -> ProcVolatility -> Bool # (<=) :: ProcVolatility -> ProcVolatility -> Bool # (>) :: ProcVolatility -> ProcVolatility -> Bool # (>=) :: ProcVolatility -> ProcVolatility -> Bool # max :: ProcVolatility -> ProcVolatility -> ProcVolatility # min :: ProcVolatility -> ProcVolatility -> ProcVolatility # | |
Show ProcVolatility Source # | |
Defined in PostgREST.Types showsPrec :: Int -> ProcVolatility -> ShowS # show :: ProcVolatility -> String # showList :: [ProcVolatility] -> ShowS # |
data ProcDescription Source #
ProcDescription | |
|
Instances
Eq ProcDescription Source # | |
Defined in PostgREST.Types (==) :: ProcDescription -> ProcDescription -> Bool # (/=) :: ProcDescription -> ProcDescription -> Bool # | |
Ord ProcDescription Source # | |
Defined in PostgREST.Types compare :: ProcDescription -> ProcDescription -> Ordering # (<) :: ProcDescription -> ProcDescription -> Bool # (<=) :: ProcDescription -> ProcDescription -> Bool # (>) :: ProcDescription -> ProcDescription -> Bool # (>=) :: ProcDescription -> ProcDescription -> Bool # max :: ProcDescription -> ProcDescription -> ProcDescription # min :: ProcDescription -> ProcDescription -> ProcDescription # | |
Show ProcDescription Source # | |
Defined in PostgREST.Types showsPrec :: Int -> ProcDescription -> ShowS # show :: ProcDescription -> String # showList :: [ProcDescription] -> ShowS # |
type ProcsMap = HashMap QualifiedIdentifier [ProcDescription] Source #
A map of all procs, all of which can be overloaded(one entry will have more than one ProcDescription). | It uses a HashMap for a faster lookup.
findProc :: QualifiedIdentifier -> Set Text -> Bool -> ProcsMap -> Maybe ProcDescription Source #
Search a pg procedure by its parameters. Since a function can be overloaded, the name is not enough to find it. An overloaded function can have a different volatility or even a different return type. Ideally, handling overloaded functions should be left to pg itself. But we need to know certain proc attributes in advance.
specifiedProcArgs :: Set FieldName -> Maybe ProcDescription -> [PgArg] Source #
Search the procedure parameters by matching them with the specified keys. If the key doesn't match a parameter, a parameter with a default type "text" is assumed.
Table | |
|
tableQi :: Table -> QualifiedIdentifier Source #
newtype ForeignKey Source #
Instances
Eq ForeignKey Source # | |
Defined in PostgREST.Types (==) :: ForeignKey -> ForeignKey -> Bool # (/=) :: ForeignKey -> ForeignKey -> Bool # | |
Ord ForeignKey Source # | |
Defined in PostgREST.Types compare :: ForeignKey -> ForeignKey -> Ordering # (<) :: ForeignKey -> ForeignKey -> Bool # (<=) :: ForeignKey -> ForeignKey -> Bool # (>) :: ForeignKey -> ForeignKey -> Bool # (>=) :: ForeignKey -> ForeignKey -> Bool # max :: ForeignKey -> ForeignKey -> ForeignKey # min :: ForeignKey -> ForeignKey -> ForeignKey # | |
Show ForeignKey Source # | |
Defined in PostgREST.Types showsPrec :: Int -> ForeignKey -> ShowS # show :: ForeignKey -> String # showList :: [ForeignKey] -> ShowS # |
Column | |
|
type SourceColumn = (Column, ViewColumn) Source #
The source table column a view column refers to
type ViewColumn = Column Source #
data PrimaryKey Source #
Instances
Eq PrimaryKey Source # | |
Defined in PostgREST.Types (==) :: PrimaryKey -> PrimaryKey -> Bool # (/=) :: PrimaryKey -> PrimaryKey -> Bool # | |
Show PrimaryKey Source # | |
Defined in PostgREST.Types showsPrec :: Int -> PrimaryKey -> ShowS # show :: PrimaryKey -> String # showList :: [PrimaryKey] -> ShowS # |
data OrderDirection Source #
Instances
Eq OrderDirection Source # | |
Defined in PostgREST.Types (==) :: OrderDirection -> OrderDirection -> Bool # (/=) :: OrderDirection -> OrderDirection -> Bool # | |
Show OrderDirection Source # | |
Defined in PostgREST.Types showsPrec :: Int -> OrderDirection -> ShowS # show :: OrderDirection -> String # showList :: [OrderDirection] -> ShowS # |
data OrderNulls Source #
Instances
Eq OrderNulls Source # | |
Defined in PostgREST.Types (==) :: OrderNulls -> OrderNulls -> Bool # (/=) :: OrderNulls -> OrderNulls -> Bool # | |
Show OrderNulls Source # | |
Defined in PostgREST.Types showsPrec :: Int -> OrderNulls -> ShowS # show :: OrderNulls -> String # showList :: [OrderNulls] -> ShowS # |
data QualifiedIdentifier Source #
Represents a pg identifier with a prepended schema name "schema.table" When qiSchema is "", the schema is defined by the pg search_path
Instances
data Cardinality Source #
The relationship cardinality). | TODO: missing one-to-one
O2M | one-to-many, previously known as Parent |
M2O | many-to-one, previously known as Child |
M2M | many-to-many, previously known as Many |
Instances
Eq Cardinality Source # | |
Defined in PostgREST.Types (==) :: Cardinality -> Cardinality -> Bool # (/=) :: Cardinality -> Cardinality -> Bool # | |
Show Cardinality Source # | |
Defined in PostgREST.Types showsPrec :: Int -> Cardinality -> ShowS # show :: Cardinality -> String # showList :: [Cardinality] -> ShowS # |
type ConstraintName = Text Source #
Relationship between two tables. The order of the relColumns and relFColumns should be maintained to get the join conditions right. TODO merge relColumns and relFColumns to a tuple or Data.Bimap
Relation | |
|
Junction table on an M2M relationship
Junction | |
|
isSelfReference :: Relation -> Bool Source #
data PayloadJSON Source #
ProcessedJSON | Cached attributes of a JSON payload |
| |
RawJSON | |
|
Instances
Eq PayloadJSON Source # | |
Defined in PostgREST.Types (==) :: PayloadJSON -> PayloadJSON -> Bool # (/=) :: PayloadJSON -> PayloadJSON -> Bool # | |
Show PayloadJSON Source # | |
Defined in PostgREST.Types showsPrec :: Int -> PayloadJSON -> ShowS # show :: PayloadJSON -> String # showList :: [PayloadJSON] -> ShowS # |
data LogicOperator Source #
Instances
Eq LogicOperator Source # | |
Defined in PostgREST.Types (==) :: LogicOperator -> LogicOperator -> Bool # (/=) :: LogicOperator -> LogicOperator -> Bool # | |
Show LogicOperator Source # | |
Defined in PostgREST.Types showsPrec :: Int -> LogicOperator -> ShowS # show :: LogicOperator -> String # showList :: [LogicOperator] -> ShowS # |
Boolean logic expression tree e.g. "and(name.eq.N,or(id.eq.1,id.eq.2))" is:
And / name.eq.N Or / id.eq.1 id.eq.2
type JsonPath = [JsonOperation] Source #
Json path operations as specified in https://www.postgresql.org/docs/9.4/static/functions-json.html
data JsonOperation Source #
Represents the single arrow `->` or double arrow ->>
operators
JArrow | |
| |
J2Arrow | |
|
Instances
Eq JsonOperation Source # | |
Defined in PostgREST.Types (==) :: JsonOperation -> JsonOperation -> Bool # (/=) :: JsonOperation -> JsonOperation -> Bool # | |
Show JsonOperation Source # | |
Defined in PostgREST.Types showsPrec :: Int -> JsonOperation -> ShowS # show :: JsonOperation -> String # showList :: [JsonOperation] -> ShowS # |
data JsonOperand Source #
Represents the key(`->'key'`) or index(`->'1`::int`), the index is Text because we reuse our escaping functons and let pg do the casting with '1'::int
Instances
Eq JsonOperand Source # | |
Defined in PostgREST.Types (==) :: JsonOperand -> JsonOperand -> Bool # (/=) :: JsonOperand -> JsonOperand -> Bool # | |
Show JsonOperand Source # | |
Defined in PostgREST.Types showsPrec :: Int -> JsonOperand -> ShowS # show :: JsonOperand -> String # showList :: [JsonOperand] -> ShowS # |
Custom guc header, it's obtained by parsing the json in a: `SET LOCAL "response.headers" = '[{"Set-Cookie": ".."}]'
unwrapGucHeader :: GucHeader -> Header Source #
addHeadersIfNotIncluded :: [Header] -> [Header] -> [Header] Source #
Add headers not already included to allow the user to override them instead of duplicating them
type SelectItem = (Field, Maybe Cast, Maybe Alias, Maybe EmbedHint) Source #
This type will hold information about which particular Relation
between two tables to choose when there are multiple ones.
Specifically, it will contain the name of the foreign key or the join table in many to many relations.
type EmbedHint = Text Source #
Disambiguates an embedding operation when there's multiple relationships between two tables. | Can be the name of a foreign key constraint, column name or the junction in an m2m relationship.
type EmbedPath = [Text] Source #
Path of the embedded levels, e.g "clients.projects.name=eq.." gives Path ["clients", "projects"]
data JoinCondition Source #
Instances
Eq JoinCondition Source # | |
Defined in PostgREST.Types (==) :: JoinCondition -> JoinCondition -> Bool # (/=) :: JoinCondition -> JoinCondition -> Bool # | |
Show JoinCondition Source # | |
Defined in PostgREST.Types showsPrec :: Int -> JoinCondition -> ShowS # show :: JoinCondition -> String # showList :: [JoinCondition] -> ShowS # |
Select | |
|
data MutateQuery Source #
Insert | |
| |
Update | |
Delete | |
Instances
Eq MutateQuery Source # | |
Defined in PostgREST.Types (==) :: MutateQuery -> MutateQuery -> Bool # (/=) :: MutateQuery -> MutateQuery -> Bool # | |
Show MutateQuery Source # | |
Defined in PostgREST.Types showsPrec :: Int -> MutateQuery -> ShowS # show :: MutateQuery -> String # showList :: [MutateQuery] -> ShowS # |
type ReadRequest = Tree ReadNode Source #
type MutateRequest = MutateQuery Source #
type ReadNode = (ReadQuery, (NodeName, Maybe Relation, Maybe Alias, Maybe EmbedHint, Depth)) Source #
fstFieldNames :: ReadRequest -> [FieldName] Source #
minimumPgVersion :: PgVersion Source #
Tells the minimum PostgreSQL version required by this version of PostgREST
jspath expression, e.g. .property, .property[0] or ."property-dash"
data ConnectionStatus Source #
Current database connection status data ConnectionStatus
Instances
Eq ConnectionStatus Source # | |
Defined in PostgREST.Types (==) :: ConnectionStatus -> ConnectionStatus -> Bool # (/=) :: ConnectionStatus -> ConnectionStatus -> Bool # | |
Show ConnectionStatus Source # | |
Defined in PostgREST.Types showsPrec :: Int -> ConnectionStatus -> ShowS # show :: ConnectionStatus -> String # showList :: [ConnectionStatus] -> ShowS # |