Skip to content

Commit 4fe2363

Browse files
committed
changed license to bsd3
1 parent a3c2562 commit 4fe2363

10 files changed

Lines changed: 65 additions & 700 deletions

File tree

LICENSE

Lines changed: 30 additions & 674 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
[![License BSD3](https://img.shields.io/badge/license-BSD3-brightgreen.svg)](https://tldrlegal.com/license/bsd-3-clause-license-(revised))
2+
[![Hackage](https://img.shields.io/hackage/v/postgresql-simple-bind.svg?style=flat)](https://hackage.haskell.org/package/postgresql-simple-bind)
3+
[![Build Status](https://travis-ci.org/zohl/postgresql-simple-bind.svg?branch=master)](https://travis-ci.org/zohl/postgresql-simple-bind)
4+
15
# postgresql-simple-bind
26

37
## Description
@@ -9,26 +13,31 @@
913
communicates with a database via API hiding the internal structure
1014
of the latter.
1115

16+
## Status
17+
The library is quite stable.
18+
There are no plans to introduce breaking changes into the current API.
19+
1220
## Example
1321
Suppose we have the following functions in our database:
1422

15-
```
23+
```sql
1624
function add_num(p_x bigint) returns void
1725
function get_all_nums() returns setof bigint
1826
```
1927

2028
In order to use them in a haskell application we write the following code:
2129

22-
```
23-
import Database.PostgreSQL.Simple.Bind (bindFunction, defaultOptions)
30+
```haskell
31+
import Data.Default
32+
import Database.PostgreSQL.Simple.Bind (bindFunction, PostgresBindOptions)
2433
import Database.PostgreSQL.Simple.Bind.Types()
2534

26-
bindFunction defaultOptions "function add_num(p_x bigint) returns void"
27-
bindFunction defaultOptions "function get_all_nums() returns setof bigint"
35+
bindFunction (def::PostgresBindOptions) "function add_num(p_x bigint) returns void"
36+
bindFunction (def::PostgresBindOptions) "function get_all_nums() returns setof bigint"
2837
```
2938

3039
That's it. Now we can stick them wherever we want to:
31-
```
40+
```haskell
3241
add_many_nums :: Connection -> [Int] -> IO ()
3342
add_many_nums conn xs = sequence_ $ map (add_num conn) xs
3443

@@ -42,9 +51,9 @@
4251
then this type family provides us the final type.
4352
For example `add_num` is translated the following way:
4453

45-
```
54+
```haskell
4655
-- original PostgreSQL declaration
47-
function add_num(p_x bigint) returns void
56+
"function add_num(p_x bigint) returns void"
4857

4958
-- first step
5059
add_num :: ( PostgresType "bigint" ~ a, ToField a
@@ -55,7 +64,7 @@
5564
```
5665

5766
where
58-
```
67+
```haskell
5968
type instance PostgresType "bigint" = Int
6069
type instance PostgresType "void" = ()
6170
```
@@ -91,17 +100,17 @@
91100
## Customization
92101
There are not so many ways to change behaviour of `bindFunction` (yet).
93102
In the most cases the only required tweak is renaming stored functions.
94-
This can be done by specifying `nameModifier` and `schemaModifier` options.
103+
This can be done by specifying `pboFunctionName` option.
95104
For example if database and application code adhere snake case and camel case
96105
naming conventions respectively, conversion can be made like this:
97106

98-
```
107+
```haskell
99108
import Text.CaseConversion
100-
import Database.PostgreSQL.Simple.Bind (Options(..), defaultOptions)
109+
import Database.PostgreSQL.Simple.Bind (PostgresBindOptions(..))
101110

102-
bindOptions :: Options
103-
bindOptions = defaultOptions {
104-
nameModifier = convertCase Snake Camel
111+
bindOptions :: PostgresBindOptions
112+
bindOptions = PostgresBindOptions {
113+
pboFunctionName = (\(PGFunction _schema name _args _result) -> convertCase Snake Camel name)
105114
}
106115
```
107116

@@ -112,8 +121,8 @@
112121
preBuild hook: set `build-type` to `Custom` in .cabal-file and define
113122
`main` in Setup.hs like this
114123

115-
```
116-
import Database.PostgreSQL.Simple.Bind.Util (generateBindingsModule)
124+
```haskell
125+
import Database.PostgreSQL.Simple.Bind.Utils (generateBindingsModule)
117126

118127
main :: IO ()
119128
main = defaultMainWithHooks $ simpleUserHooks { preBuild = mkBindings }
@@ -122,7 +131,7 @@
122131
mkBindings args buildFlags = do
123132
conn <- connect connectInfo
124133
(generateBindingsModule conn
125-
"Database.PostgreSQL.Simple.Bind.defaultOptions" "Bindings" [
134+
"Your.Module.customBindOptions" "Bindings" [
126135
"stored_function_1"
127136
, "stored_function_2"
128137
-- ...

default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ mkDerivation {
1515
postgresql-simple text
1616
];
1717
description = "A FFI-like bindings for PostgreSQL stored functions";
18-
license = stdenv.lib.licenses.gpl3;
18+
license = stdenv.lib.licenses.bsd3;
1919
}

postgresql-simple-bind.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: postgresql-simple-bind
22
version: 0.1.0.0
33
synopsis: A FFI-like bindings for PostgreSQL stored functions
44
description: For tutorial see here: https:\/\/github.com\/zohl\/postgresql-simple-bind\/blob\/master\/README.md
5-
license: GPL-3
5+
license: BSD3
66
license-file: LICENSE
77
author: Al Zohali
88
maintainer: Al Zohali <zohl@fmap.me>

src/Database/PostgreSQL/Simple/Bind.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{-|
22
Module: Database.PostgreSQL.Simple.Bind
33
Copyright: (c) 2016 Al Zohali
4-
License: GPL3
4+
License: BSD3
55
Maintainer: Al Zohali <zohl@fmap.me>
66
Stability: experimental
77

src/Database/PostgreSQL/Simple/Bind/Common.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
{-|
1717
Module: Database.PostgreSQL.Simple.Bind.Common
1818
Copyright: (c) 2016 Al Zohali
19-
License: GPL3
19+
License: BSD3
2020
Maintainer: Al Zohali <zohl@fmap.me>
2121
Stability: experimental
2222

src/Database/PostgreSQL/Simple/Bind/Implementation.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
{-|
1818
Module: Database.PostgreSQL.Simple.Bind.Implementation
1919
Copyright: (c) 2016 Al Zohali
20-
License: GPL3
20+
License: BSD3
2121
Maintainer: Al Zohali <zohl@fmap.me>
2222
Stability: experimental
2323

src/Database/PostgreSQL/Simple/Bind/Representation.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
{-|
1717
Module: Database.PostgreSQL.Simple.Bind.Representation
1818
Copyright: (c) 2016 Al Zohali
19-
License: GPL3
19+
License: BSD3
2020
Maintainer: Al Zohali <zohl@fmap.me>
2121
Stability: experimental
2222

src/Database/PostgreSQL/Simple/Bind/Types.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
{-|
1717
Module: Database.PostgreSQL.Simple.Bind.Types
1818
Copyright: (c) 2016 Al Zohali
19-
License: GPL3
19+
License: BSD3
2020
Maintainer: Al Zohali <zohl@fmap.me>
2121
Stability: experimental
2222

src/Database/PostgreSQL/Simple/Bind/Utils.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
{-|
1717
Module: Database.PostgreSQL.Simple.Bind.Utils
1818
Copyright: (c) 2016 Al Zohali
19-
License: GPL3
19+
License: BSD3
2020
Maintainer: Al Zohali <zohl@fmap.me>
2121
Stability: experimental
2222

0 commit comments

Comments
 (0)