Module
Yoga.SQL.Types
- Package
- purescript-yoga-sql-types
- Repository
- rowtype-yoga/purescript-yoga-sql-types
#sqlQueryToString Source
sqlQueryToString :: forall r. SQLQuery r -> String#SQLParameter Source
data SQLParameterOpaque SQL parameter type (database-specific)
Instances
(ToSQLParam n) => Folding TurnIntoSQLParam (Array SQLParameter) n (Array SQLParameter)(ToSQLParam n, IsSymbol sym) => FoldingWithIndex TurnIntoSQLParam (Proxy sym) (Map String SQLParameter) n (Map String SQLParameter)
#ToSQLParam Source
class ToSQLParam a whereMembers
toSQLParam :: a -> SQLParameter
Instances
ToSQLParam IntToSQLParam StringToSQLParam NumberToSQLParam Boolean(ToSQLParam a) => ToSQLParam (Array a)(ToSQLParam a) => ToSQLParam (NonEmptyArray a)(ToSQLParam a) => ToSQLParam (Maybe a)(ToSQLParam b, Newtype a b) => ToSQLParam a(Coercible a b, ToSQLParam b) => ToSQLParam b
#fromSQLValue Source
fromSQLValue :: forall @a. SQLFromForeign a => SQLResult -> Either String a#SQLFromForeign Source
#singleResult Source
singleResult :: forall @a b. SQLFromForeign a => (a -> b) -> Array SQLResult -> Either String b#twoResults Source
twoResults :: forall @a @b c. SQLFromForeign a => SQLFromForeign b => (a -> b -> c) -> Array SQLResult -> Either String c#threeResults Source
threeResults :: forall @a @b @c d. SQLFromForeign a => SQLFromForeign b => SQLFromForeign c => (a -> b -> c -> d) -> Array SQLResult -> Either String d#fourResults Source
fourResults :: forall @a @b @c @d e. SQLFromForeign a => SQLFromForeign b => SQLFromForeign c => SQLFromForeign d => (a -> b -> c -> d -> e) -> Array SQLResult -> Either String e#fiveResults Source
fiveResults :: forall @a @b @c @d @e f. SQLFromForeign a => SQLFromForeign b => SQLFromForeign c => SQLFromForeign d => SQLFromForeign e => (a -> b -> c -> d -> e -> f) -> Array SQLResult -> Either String f#FromResultArray Source
class FromResultArray fn a | fn -> a whereMembers
fromResultArray :: fn -> Array SQLResult -> Either String a
Instances
(SQLFromForeign a, SQLFromForeign b, SQLFromForeign c, SQLFromForeign d, SQLFromForeign e) => FromResultArray (a -> b -> c -> d -> e -> f) f(SQLFromForeign a, SQLFromForeign b, SQLFromForeign c, SQLFromForeign d) => FromResultArray (a -> b -> c -> d -> e) e(SQLFromForeign a, SQLFromForeign b, SQLFromForeign c) => FromResultArray (a -> b -> c -> d) d(SQLFromForeign a, SQLFromForeign b) => FromResultArray (a -> b -> c) c(SQLFromForeign a) => FromResultArray (a -> b) b
#TurnIntoSQLParam Source
data TurnIntoSQLParamConstructors
Instances
(ToSQLParam n) => Folding TurnIntoSQLParam (Array SQLParameter) n (Array SQLParameter)(ToSQLParam n, IsSymbol sym) => FoldingWithIndex TurnIntoSQLParam (Proxy sym) (Map String SQLParameter) n (Map String SQLParameter)
#SQLBuilder Source
newtype SQLBuilder :: Row Type -> Row Type -> Typenewtype SQLBuilder r1 r2
Constructors
SQLBuilder (SQLQuery r1 -> SQLQuery r2)
Instances
ToBuilder (SQLBuilder r1 r2) r1 r2
#ToBuilder Source
class ToBuilder :: Type -> Row Type -> Row Type -> Constraintclass ToBuilder s r1 r2 | r1 -> r2, r2 -> r1 where
Members
toBuilder :: s -> SQLBuilder r1 r2
Instances
ToBuilder (SQLBuilder r1 r2) r1 r2ToBuilder String r r
#combineBuilders Source
combineBuilders :: forall a b r1 r2 r3. ToBuilder a r2 r3 => ToBuilder b r1 r2 => a -> b -> SQLBuilder r1 r3Compose two builders
#sql Source
sql :: forall r. SQLBuilder () r -> SQLQuery rCreate a SQL query from a builder
#arg Source
arg :: forall @a @sym r1 r2. IsSymbol sym => ToSQLParam a => Cons sym a r1 r2 => SQLBuilder r1 r2Add a typed parameter to the query
#int Source
int :: forall @sym r1 r2. IsSymbol sym => Cons sym Int r1 r2 => SQLBuilder r1 r2Add an Int parameter
#str Source
str :: forall @sym r1 r2. IsSymbol sym => Cons sym String r1 r2 => SQLBuilder r1 r2Add a String parameter
#bool Source
bool :: forall @sym r1 r2. IsSymbol sym => Cons sym Boolean r1 r2 => SQLBuilder r1 r2Add a Boolean parameter
#num Source
num :: forall @sym r1 r2. IsSymbol sym => Cons sym Number r1 r2 => SQLBuilder r1 r2Add a Number parameter
#nonArg Source
nonArg :: forall r. String -> SQLBuilder r rAdd a literal SQL string (no parameter)
#argsFor Source
argsFor :: forall @params. HFoldlWithIndex TurnIntoSQLParam (Map String SQLParameter) (Record params) (Map String SQLParameter) => SQLQuery params -> Record params -> Array SQLParameterExtract parameters from a record in the correct order
#renderConstraint Source
renderConstraint :: Constraint -> String#columnNamesOf Source
columnNamesOf :: forall cols colsRL out. RowToList cols colsRL => HFoldlWithIndex (MapRecord SQLColumn ColumnName) (Builder (Record ()) (Record ())) (Record cols) (Builder (Record ()) (Record out)) => Table cols -> Record outExtract column names from table schema
#CreateTableStatement Source
#createTable Source
createTable :: forall cols. Homogeneous cols SQLColumn => Table cols -> CreateTableStatementGenerate CREATE TABLE statement from schema
- Modules
- Yoga.
SQL. PostgresTypes - Yoga.
SQL. Types