refactor: add ResultAggregate type
This commit is contained in:
committed by
Steve Chavez
parent
774d015eb5
commit
905fcb05cc
@@ -14,6 +14,7 @@ module PostgREST.SchemaCache.Routine
|
||||
, funcReturnsVoid
|
||||
, funcTableName
|
||||
, funcReturnsCompositeAlias
|
||||
, ResultAggregate(..)
|
||||
) where
|
||||
|
||||
import Data.Aeson ((.=))
|
||||
@@ -21,7 +22,8 @@ import qualified Data.Aeson as JSON
|
||||
import qualified Data.HashMap.Strict as HM
|
||||
import qualified Hasql.Transaction.Sessions as SQL
|
||||
|
||||
import PostgREST.SchemaCache.Identifiers (QualifiedIdentifier (..),
|
||||
import PostgREST.SchemaCache.Identifiers (FieldName,
|
||||
QualifiedIdentifier (..),
|
||||
Schema, TableName)
|
||||
|
||||
import Protolude
|
||||
@@ -85,6 +87,16 @@ instance Ord Routine where
|
||||
-- | It uses a HashMap for a faster lookup.
|
||||
type RoutineMap = HM.HashMap QualifiedIdentifier [Routine]
|
||||
|
||||
data ResultAggregate
|
||||
= BuiltinAggJson
|
||||
| BuiltinAggSingleJson
|
||||
| BuiltinAggGeoJson
|
||||
| BuiltinAggCsv
|
||||
| BuiltinAggXml (Maybe FieldName)
|
||||
| BuiltinAggBinary (Maybe FieldName)
|
||||
| NoAgg
|
||||
deriving (Eq, Show)
|
||||
|
||||
funcReturnsScalar :: Routine -> Bool
|
||||
funcReturnsScalar proc = case proc of
|
||||
Function{pdReturnType = Single (Scalar{})} -> True
|
||||
|
||||
Reference in New Issue
Block a user