@@ -3,8 +3,11 @@ module SqlSquared
3
3
, SqlQuery
4
4
, SqlModule
5
5
, print
6
+ , printPretty
6
7
, printQuery
8
+ , printQueryPretty
7
9
, printModule
10
+ , printModulePretty
8
11
, genSql
9
12
, genSqlQuery
10
13
, genSqlModule
@@ -25,7 +28,7 @@ import Matryoshka (cata, anaM)
25
28
import SqlSquared.Constructors (array , as , as' , binop , bool , buildSelect , groupBy , having , hugeNum , ident , ident' , int , invokeFunction , invokeFunction' , let' , let_ , map_ , match , match' , null , num , parens , projection , select , select' , set , splice , string , switch , switch' , then_ , unop , var , when ) as Constructors
26
29
import SqlSquared.Lenses (_ArrayLiteral , _Binop , _BoolLiteral , _Case , _DecimalLiteral , _ExprRelation , _GroupBy , _Identifier , _IntLiteral , _InvokeFunction , _JoinRelation , _Let , _Literal , _MapLiteral , _Match , _NullLiteral , _OrderBy , _Parens , _Projection , _Select , _SetLiteral , _Splice , _StringLiteral , _Switch , _TableRelation , _Unop , _Var , _VarRelation , _alias , _aliasName , _args , _bindTo , _cases , _clause , _cond , _else , _expr , _filter , _groupBy , _having , _ident , _in , _isDistinct , _joinType , _keys , _left , _lhs , _name , _op , _orderBy , _projections , _relations , _rhs , _right , _tablePath ) as Lenses
27
30
import SqlSquared.Parser (Literal (..), PositionedToken , parse , parseModule , parseQuery , prettyParse ) as Parser
28
- import SqlSquared.Signature (type (×), BinaryOperator (..), BinopR , Case (..), ExprRelR , FunctionDeclR , GroupBy (..), Ident (..), InvokeFunctionR , JoinRelR , JoinType (..), LetR , MatchR , OrderBy (..), OrderType (..), Projection (..), Relation (..), SelectR , SqlDeclF (..), SqlF (..), SqlModuleF (..), SqlQueryF (..), SwitchR , TableRelR , UnaryOperator (..), UnopR , VarRelR , binopFromString , binopToString , genBinaryOperator , genCase , genGroupBy , genJoinType , genOrderBy , genOrderType , genProjection , genRelation , genSqlDeclF , genSqlF , genSqlModuleF , genSqlQueryF , genUnaryOperator , joinTypeFromString , orderTypeFromString , printBinaryOperator , printCase , printGroupBy , printIdent , printJoinType , printOrderBy , printOrderType , printProjection , printRelation , printSqlDeclF , printSqlF , printSqlModuleF , printSqlQueryF , printUnaryOperator , unopFromString , unopToString , (×), (∘), (⋙)) as Sig
31
+ import SqlSquared.Signature (type (×), BinaryOperator (..), BinopR , Case (..), ExprRelR , FunctionDeclR , GroupBy (..), Ident (..), InvokeFunctionR , JoinRelR , JoinType (..), LetR , MatchR , OrderBy (..), OrderType (..), Projection (..), Relation (..), SelectR , SqlDeclF (..), SqlF (..), SqlModuleF (..), SqlQueryF (..), SwitchR , TableRelR , UnaryOperator (..), UnopR , VarRelR , binopFromString , binopToString , genBinaryOperator , genCase , genGroupBy , genJoinType , genOrderBy , genOrderType , genProjection , genRelation , genSqlDeclF , genSqlF , genSqlModuleF , genSqlQueryF , genUnaryOperator , joinTypeFromString , orderTypeFromString , printBinaryOperator , printCase , printGroupBy , printIdent , printJoinType , printOrderBy , printOrderType , printProjection , printRelation , printSqlDeclF , printSqlF , printSqlFPretty , printSqlModuleF , printSqlQueryF , printUnaryOperator , unopFromString , unopToString , (×), (∘), (⋙)) as Sig
29
32
30
33
type Sql = Mu (Sig.SqlF EJ.EJsonF )
31
34
@@ -42,6 +45,15 @@ printQuery = Sig.printSqlQueryF <<< map print
42
45
printModule ∷ SqlModule → String
43
46
printModule = Sig .printSqlModuleF <<< map print
44
47
48
+ printPretty ∷ Sql → String
49
+ printPretty = cata $ Sig .printSqlFPretty EJ .renderEJsonF
50
+
51
+ printQueryPretty ∷ SqlQuery → String
52
+ printQueryPretty = Sig .printSqlQueryF <<< map printPretty
53
+
54
+ printModulePretty ∷ SqlModule → String
55
+ printModulePretty = Sig .printSqlModuleF <<< map printPretty
56
+
45
57
genSql ∷ ∀ m . Gen.MonadGen m ⇒ MonadRec m ⇒ m Sql
46
58
genSql = Gen .sized $ anaM (Sig .genSqlF EJ .arbitraryEJsonF)
47
59
0 commit comments