diff options
author | Alexander Foremny <aforemny@posteo.de> | 2024-02-12 10:05:02 +0100 |
---|---|---|
committer | Alexander Foremny <aforemny@posteo.de> | 2024-02-12 10:25:37 +0100 |
commit | 68566ca5a376f8508fdd1c5eff3155cde7929850 (patch) | |
tree | 3573f5b5fe392d6b46f08ef259a2be65baf77308 /app/Query/Type.hs | |
parent | 33faca6f99dc207e81497297c205a1ff29ae2f33 (diff) |
refactor `Query`
Diffstat (limited to 'app/Query/Type.hs')
-rw-r--r-- | app/Query/Type.hs | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/app/Query/Type.hs b/app/Query/Type.hs new file mode 100644 index 0000000..d27106f --- /dev/null +++ b/app/Query/Type.hs @@ -0,0 +1,62 @@ +module Query.Type + ( module Query.Field, + module Query.Record, + Collection, + Comparison (..), + EmbedClause (..), + EmbedClauses, + FieldSelector (..), + JoinClause (..), + JoinClauses, + JoinType (..), + Query (..), + WhereClause (..), + ) +where + +import Data.List.NonEmpty qualified as N +import Query.Field +import Query.Record + +data Query + = Select + FieldSelector + Collection + (JoinClauses FilePath) + (EmbedClauses FilePath) + (Maybe WhereClause) + +data FieldSelector + = All + | Only (N.NonEmpty Field) + deriving (Show) + +type Collection = FilePath + +type JoinClauses a = [JoinClause a] + +data JoinClause a + = JoinClause JoinType a (Maybe WhereClause) + deriving (Show) + +data JoinType + = JoinLeft + | JoinRight + | JoinFull + deriving (Show) + +type EmbedClauses a = [EmbedClause a] + +data EmbedClause a + = EmbedClause a (Maybe WhereClause) + deriving (Show) + +data WhereClause + = And [WhereClause] + | Or [WhereClause] + | Where Comparison + deriving (Show) + +data Comparison + = Eq Field Field + deriving (Show) |