Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pipeline mode hack #1

Closed
wants to merge 44 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
e2852d4
Bump
nikita-volkov Jun 20, 2022
b64a701
Format with ormolu
nikita-volkov Jun 20, 2022
0dda3e5
Allow vector-0.13
nikita-volkov Jun 20, 2022
0f8a24a
Add a warning
nikita-volkov Jun 30, 2022
d6ed4e6
Bump
nikita-volkov Jun 30, 2022
cf6458f
Format
nikita-volkov Jul 7, 2022
9276d7e
Add error position
nikita-volkov Jul 7, 2022
55a4564
Add handling of empty query response
nikita-volkov Jul 20, 2022
fab38ac
Add handling of EmptyQuery status
nikita-volkov Jul 20, 2022
f4407e1
Bump
nikita-volkov Jul 20, 2022
e7cf3a2
Add error position
nikita-volkov Jul 20, 2022
8138130
Bump and update the changelog
nikita-volkov Jul 20, 2022
dfd8fe2
Update the changelog
nikita-volkov Jul 20, 2022
dbbcc7d
Bump
nikita-volkov Jul 20, 2022
67e2034
Remove the stack files
nikita-volkov Sep 7, 2022
3220655
Add lazy variations of bytestring json encoders
nikita-volkov Sep 7, 2022
ef5bb2f
Fix the build
nikita-volkov Sep 8, 2022
fcadfbe
Move to explicit references to data-types
nikita-volkov Sep 17, 2022
554f097
Bump
nikita-volkov Sep 17, 2022
bb2a7d1
Move to postgresql-binary without the Data module
nikita-volkov Sep 17, 2022
9e57753
Update summary and status
nikita-volkov Sep 20, 2022
75ffa3f
Format
nikita-volkov Sep 25, 2022
a5d4b70
Implement composite encoder
nikita-volkov Sep 25, 2022
5fb8cf2
Relax lower bound on hashtables
jkachmar Sep 27, 2022
c90f331
Merge pull request #151 from jkachmar/patch-1
nikita-volkov Sep 28, 2022
ad65254
Bump
nikita-volkov Sep 28, 2022
05ced1a
Add a failing test on array of composites
nikita-volkov Oct 15, 2022
e3dd430
Fix the binary encoder to specify binary format
nikita-volkov Oct 17, 2022
78a0be8
Fix the tests and add name and oid types
nikita-volkov Oct 17, 2022
c1b5f00
Reorder things
nikita-volkov Oct 18, 2022
fa707dd
Bump and update changelog
nikita-volkov Oct 18, 2022
31c553b
Add unkown enum
nikita-volkov Nov 21, 2022
cbb1089
Update the docs
nikita-volkov Nov 21, 2022
3d85276
Add unknownEnum
nikita-volkov Nov 21, 2022
bd5cc3d
Prepare a release
nikita-volkov Nov 21, 2022
986ae15
Add `hasql-interpolate` to ecosystem section of readme
mitchellwrosen Jan 11, 2023
f41cc75
Merge pull request #154 from mitchellwrosen/patch-1
nikita-volkov Jan 11, 2023
a40ef17
Add `hasql-listen-notify` to ecosystem in readme
mitchellwrosen Jan 30, 2023
07b4a35
Merge pull request #155 from mitchellwrosen/patch-2
nikita-volkov Jan 30, 2023
d0c2713
queuePipelineStatement approach
robx Mar 6, 2023
145ea21
fix for rob local postgres
robx Mar 8, 2023
9a128b2
pipeline test
robx Mar 8, 2023
00be12f
pipeline aware connection
robx Mar 8, 2023
43e380a
fixes
robx Mar 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
# 1.6.3

- Added `unknownEnum` encoder

# 1.6.2

- Added composite encoder
- Added `oid` and `name` encoders

# 1.6.1

- Added `jsonLazyBytes` and `jsonbLazyBytes`

# 1.6

- Added position to `ServerError` (breaking change).
- Disabled failure on empty query.

# 1.5

- Added column number to `RowError` (breaking change).
Expand Down
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
# What Hasql is
# Summary

Hasql is a highly efficient PostgreSQL driver for Haskell with a typesafe yet flexible mapping API. It targets both the users, who need maximum control, and the users who face the typical tasks of DB-powered applications, providing them with higher-level APIs. Currently it is known to be [the fastest driver](https://nikita-volkov.github.io/hasql-benchmarks/) in the Haskell ecosystem.

Hasql also is one of the supported targets of the [pGenie](https://pgenie.io) code generator, which empowers it with schema and query validation, and relieves you from boilerplate.

# Status

[![Build Status](https://travis-ci.org/nikita-volkov/hasql.svg?branch=master)](https://travis-ci.org/nikita-volkov/hasql)
[![Hackage](https://img.shields.io/hackage/v/hasql.svg)](https://hackage.haskell.org/package/hasql)

Hasql is a highly efficient PostgreSQL driver and a mapping API. It targets both the users, who need a low level of abstraction, and the users, who face the typical tasks of DB-powered applications, providing them with higher-level APIs.
Hasql is production-ready, actively maintained and the API is pretty stable. It's used by many companies and most notably by the [Postgrest](https://postgrest.org/) project.


## Ecosystem
# Ecosystem

Hasql is not just a single library, it is a granular ecosystem of composable libraries, each isolated to perform its own task and stay simple.

Expand All @@ -25,12 +30,14 @@ Hasql is not just a single library, it is a granular ecosystem of composable lib

* ["hasql-migration"](https://github.com/tvh/hasql-migration) - A port of postgresql-simple-migration for use with hasql.

* ["hasql-notifications"](https://github.com/diogob/hasql-notifications) - Support for PostgreSQL asynchronous notifications.
* ["hasql-listen-notify"](https://github.com/awkward-squad/hasql-listen-notify) / ["hasql-notifications"](https://github.com/diogob/hasql-notifications) - Support for PostgreSQL asynchronous notifications.

* ["hasql-optparse-applicative"](https://github.com/sannsyn/hasql-optparse-applicative) - "optparse-applicative" parsers for Hasql.

* ["hasql-implicits"](https://github.com/nikita-volkov/hasql-implicits) - implicit definitions, such as default codecs for standard types.

* ["hasql-interpolate"](https://github.com/awkward-squad/hasql-interpolate) - a QuasiQuoter that supports interpolating Haskell expressions into Hasql queries.

### Benefits of being an ecosystem

* **Simplicity.** Each library in isolation provides a simple API, which is hopefully easier to comprehend.
Expand Down
27 changes: 9 additions & 18 deletions benchmarks/Main.hs
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
module Main where

import Prelude
import qualified Data.Vector as F
import Gauge
import Gauge.Main
import qualified Hasql.Connection as A
import qualified Hasql.Session as B
import qualified Hasql.Statement as C
import qualified Hasql.Decoders as D
import qualified Hasql.Encoders as E
import qualified Data.Vector as F

import qualified Hasql.Session as B
import qualified Hasql.Statement as C
import Prelude

main =
do
Expand All @@ -20,23 +19,17 @@ main =
A.acquire ""
useConnection connection =
defaultMain
[
sessionBench "largeResultInVector" sessionWithSingleLargeResultInVector
,
sessionBench "largeResultInList" sessionWithSingleLargeResultInList
,
sessionBench "manyLargeResults" sessionWithManyLargeResults
,
sessionBench "manySmallResults" sessionWithManySmallResults
]
[ sessionBench "largeResultInVector" sessionWithSingleLargeResultInVector,
sessionBench "largeResultInList" sessionWithSingleLargeResultInList,
sessionBench "manyLargeResults" sessionWithManyLargeResults,
sessionBench "manySmallResults" sessionWithManySmallResults
]
where
sessionBench :: NFData a => String -> B.Session a -> Benchmark
sessionBench name session =
bench name (nfIO (fmap (either (error "") id) (B.run session connection)))


-- * Sessions
-------------------------

sessionWithManySmallParameters :: Vector (Int64, Int64) -> B.Session ()
sessionWithManySmallParameters =
Expand All @@ -58,9 +51,7 @@ sessionWithManySmallResults :: B.Session [(Int64, Int64)]
sessionWithManySmallResults =
replicateM 1000 (B.statement () statementWithSingleRow)


-- * Statements
-------------------------

statementWithManyParameters :: C.Statement (Vector (Int64, Int64)) ()
statementWithManyParameters =
Expand Down
13 changes: 9 additions & 4 deletions hasql.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: hasql
version: 1.5.0.3
version: 1.6.3
category: Hasql, Database, PostgreSQL
synopsis: An efficient PostgreSQL driver with a flexible mapping API
description:
Expand Down Expand Up @@ -57,6 +57,7 @@ library
Hasql.Private.Encoders.Value
Hasql.Private.Encoders.Params
build-depends:
aeson >=2 && <3,
attoparsec >=0.10 && <0.15,
base >=4.12 && <5,
bytestring >=0.10 && <0.12,
Expand All @@ -66,13 +67,17 @@ library
hashable >=1.2 && <2,
hashtables >=1.1 && <2,
mtl >=2 && <3,
postgresql-binary >=0.12.4 && <0.13,
network-ip >=0.3.0.3 && <0.4,
postgresql-binary >=0.13.1 && <0.14,
postgresql-libpq ==0.9.*,
profunctors >=5.1 && <6,
scientific >=0.3 && <0.4,
text >=1 && <3,
text-builder >=0.6.1.2 && <0.7,
text-builder >=0.6.7 && <0.7,
time >=1.9 && <2,
transformers >=0.3 && <0.7,
vector >=0.10 && <0.13
uuid >=1.3 && <2,
vector >=0.10 && <0.14

test-suite tasty
type: exitcode-stdio-1.0
Expand Down
17 changes: 8 additions & 9 deletions library/Hasql/Connection.hs
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
-- |
-- This module provides a low-level effectful API dealing with the connections to the database.
module Hasql.Connection
(
Connection,
ConnectionError(..),
acquire,
release,
Settings,
settings,
withLibPQConnection
)
( Connection,
ConnectionError (..),
acquire,
release,
Settings,
settings,
withLibPQConnection,
)
where

import Hasql.Private.Connection
Expand Down
131 changes: 68 additions & 63 deletions library/Hasql/Decoders.hs
Original file line number Diff line number Diff line change
@@ -1,67 +1,72 @@
{-|
A DSL for declaration of result decoders.
-}
-- |
-- A DSL for declaration of result decoders.
module Hasql.Decoders
(
-- * Result
Result,
noResult,
rowsAffected,
singleRow,
-- ** Specialized multi-row results
rowMaybe,
rowVector,
rowList,
-- ** Multi-row traversers
foldlRows,
foldrRows,
-- * Row
Row,
column,
-- * Nullability
NullableOrNot,
nonNullable,
nullable,
-- * Value
Value,
bool,
int2,
int4,
int8,
float4,
float8,
numeric,
char,
text,
bytea,
date,
timestamp,
timestamptz,
time,
timetz,
interval,
uuid,
inet,
json,
jsonBytes,
jsonb,
jsonbBytes,
array,
listArray,
vectorArray,
composite,
hstore,
enum,
custom,
refine,
-- * Array
Array,
dimension,
element,
-- * Composite
Composite,
field,
)
( -- * Result
Result,
noResult,
rowsAffected,
singleRow,

-- ** Specialized multi-row results
rowMaybe,
rowVector,
rowList,

-- ** Multi-row traversers
foldlRows,
foldrRows,

-- * Row
Row,
column,

-- * Nullability
NullableOrNot,
nonNullable,
nullable,

-- * Value
Value,
bool,
int2,
int4,
int8,
float4,
float8,
numeric,
char,
text,
bytea,
date,
timestamp,
timestamptz,
time,
timetz,
interval,
uuid,
inet,
json,
jsonBytes,
jsonb,
jsonbBytes,
array,
listArray,
vectorArray,
composite,
hstore,
enum,
custom,
refine,

-- * Array
Array,
dimension,
element,

-- * Composite
Composite,
field,
)
where

import Hasql.Private.Decoders
Loading