Improve style
This commit is contained in:
@@ -1,8 +1,7 @@
|
|||||||
{-# LANGUAGE OverloadedStrings, DeriveGeneric #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
|
||||||
module Main where
|
module Main where
|
||||||
|
|
||||||
import GHC.Generics
|
|
||||||
import Data.ByteString.Lazy
|
import Data.ByteString.Lazy
|
||||||
|
|
||||||
import Data.Text
|
import Data.Text
|
||||||
@@ -31,10 +30,9 @@ instance FromRow Table where
|
|||||||
|
|
||||||
instance JSON.ToJSON Table where
|
instance JSON.ToJSON Table where
|
||||||
toJSON v = JSON.object [
|
toJSON v = JSON.object [
|
||||||
"schema" .= (viewSchema v),
|
"schema" .= viewSchema v
|
||||||
"name" .= (viewName v),
|
, "name" .= viewName v
|
||||||
"insertable" .= (viewInsertable v)
|
, "insertable" .= viewInsertable v ]
|
||||||
]
|
|
||||||
|
|
||||||
toBool :: String -> Bool
|
toBool :: String -> Bool
|
||||||
toBool = (== "YES")
|
toBool = (== "YES")
|
||||||
@@ -59,14 +57,14 @@ instance FromRow Column where
|
|||||||
|
|
||||||
instance JSON.ToJSON Column where
|
instance JSON.ToJSON Column where
|
||||||
toJSON c = JSON.object [
|
toJSON c = JSON.object [
|
||||||
"schema" .= (colSchema c)
|
"schema" .= colSchema c
|
||||||
, "name" .= (colName c)
|
, "name" .= colName c
|
||||||
, "position" .= (colPosition c)
|
, "position" .= colPosition c
|
||||||
, "nullable" .= (colNullable c)
|
, "nullable" .= colNullable c
|
||||||
, "type" .= (colType c)
|
, "type" .= colType c
|
||||||
, "updatable" .= (colUpdatable c)
|
, "updatable" .= colUpdatable c
|
||||||
, "maxLen" .= (colMaxLen c)
|
, "maxLen" .= colMaxLen c
|
||||||
, "precision" .= (colPrecision c) ]
|
, "precision" .= colPrecision c ]
|
||||||
|
|
||||||
tables :: String -> Connection -> IO [Table]
|
tables :: String -> Connection -> IO [Table]
|
||||||
tables s conn = query conn q $ Only s
|
tables s conn = query conn q $ Only s
|
||||||
|
|||||||
Reference in New Issue
Block a user