Module

Yoga.Postgres.Om

Package
purescript-yoga-postgres-om
Repository
rowtype-yoga/purescript-yoga-postgres-om

#query Source

query :: forall @a ctx err. ReadForeign a => SQL -> Array PGValue -> Connection -> Om ctx (parseError :: MultipleErrors | err) (Array a)

Query and parse rows using yoga-json's ReadForeign (DEFAULT) Throws parse errors to the Om exception channel

#queryOne Source

queryOne :: forall @a ctx err. ReadForeign a => SQL -> Array PGValue -> Connection -> Om ctx (parseError :: MultipleErrors | err) (Maybe a)

Query one row and parse using yoga-json's ReadForeign (DEFAULT) Throws parse errors to the Om exception channel

#unsafe Source

unsafe :: forall @a ctx err. ReadForeign a => SQL -> Array PGValue -> Connection -> Om ctx (parseError :: MultipleErrors | err) a

Unsafe query (expects exactly one row) and parse using yoga-json (DEFAULT) Throws parse errors to the Om exception channel

#queryUnsafe Source

queryUnsafe :: forall @a ctx err. SQL -> Array PGValue -> Connection -> Om ctx err (Array a)

Query and unsafeCoerce rows to the desired type (bypasses yoga-json parsing) USE WITH CAUTION - no runtime validation!

#queryOneUnsafe Source

queryOneUnsafe :: forall @a ctx err. SQL -> Array PGValue -> Connection -> Om ctx err (Maybe a)

Query one row and unsafeCoerce to the desired type (bypasses yoga-json parsing) USE WITH CAUTION - no runtime validation!

#unsafeUnsafe Source

unsafeUnsafe :: forall @a ctx err. SQL -> Array PGValue -> Connection -> Om ctx err a

Unsafe query (expects exactly one row) and unsafeCoerce to the desired type USE WITH CAUTION - no runtime validation!

#execute Source

execute :: forall ctx err. SQL -> Array PGValue -> Connection -> Om ctx err Int

Om-friendly execute (takes Connection as parameter)

#executeSimple Source

executeSimple :: forall ctx err. SQL -> Connection -> Om ctx err Int

Om-friendly executeSimple (takes Connection as parameter)

#transaction Source

transaction :: forall ctx err a. (Transaction -> Om ctx err a) -> Connection -> Om ctx err a

Om-friendly transaction (takes Connection as parameter)

#txQuery Source

txQuery :: forall @a ctx err. ReadForeign a => SQL -> Array PGValue -> Transaction -> Om ctx (parseError :: MultipleErrors | err) (Array a)

Transaction query and parse rows using yoga-json's ReadForeign (DEFAULT) Throws parse errors to the Om exception channel

#txQuerySimple Source

txQuerySimple :: forall ctx err. SQL -> Transaction -> Om ctx err QueryResult

Om-friendly transaction querySimple (raw Foreign, takes Transaction as parameter)

#txExecute Source

txExecute :: forall ctx err. SQL -> Array PGValue -> Transaction -> Om ctx err Int

Om-friendly transaction execute (takes Transaction as parameter)

Re-exports from Yoga.Postgres

#Transaction Source

#SQL Source

newtype SQL

Instances

#QueryResult Source

type QueryResult = { command :: String, count :: Int, rows :: Array Row }

#PGValue Source

data PGValue

#Connection Source

#toPGValue Source

toPGValue :: forall a. ToPGValue a => a -> PGValue