Purescript-nonbili-postgres: another binding to pg

bindings
postgres
#1

Why another pg binding?

Because it’s painful to work with data Foreign, and I found by using encodeJson/decodeJson when passing values through FFI, I don’t need to deal with Foreign at all.

With purescript-nonbili-postgres, query result rows are decoded as record, which is the easiest to work with.

I’m not a heavy user of pg, in case I get something wrong, please tell me. Thanks

#2

Hi,

I want to ask if you have looked at rightfold/purescript-postgresql-client?

It does not use json classes for decoding but custom typeclasses for this purpose. We are trying to cover there as much of pg types as possible. If you have found any standard pg types which are not handled or if you don’t like decoding strategy for a given type which we have chosen we are really open for discussion.

@Kamirus is also working hard on purescript-selda and he is also responsive and open for suggestions. Selda is currently supporting pg backend by default. On the development branch there is ongoing work on sqlite support too.

1 Like
#3

Yes, I have used rightfold/purescript-postgresql-client a few times. As I understand, it uses rowMode: 'array'. So when I select * from table, I may need to write something like

Row7 f1 f2 f3 f4 f5 f6 f7 <- query "select * from table" ...

Mostly likely, I would still want to construct a record from those fields, and use the record somewhere else. That’s why I think it’s nice to get a record directly from query.

Also, with purescript-nonbili-postgres, I don’t need to worry about field orders. I can ignore fields I’m not interested in, and still using select *.

As for purescript-selda, I’ve heard about it but haven’t used it. Seems it’s higher level, so user don’t need to write SQL directly.

#4

Mostly likely, I would still want to construct a record from those fields, and use the record somewhere else. That’s why I think it’s nice to get a record directly from query.

Also, with purescript-nonbili-postgres, I don’t need to worry about field orders. I can ignore fields I’m not interested in, and still using select *.

That is really interesting. It is nowhere stated that postgresql-client doesn’t want to support such kind of API too. Like I said it is just a question of starting the discussion on a given topic.
To be honest I’m a bit afraid about our small ecosystem and its maintenance abilities. This is third postgresql binding library to the same JS lib. On the other hand it is good for sure to have choice and diversity of different libraries with different approaches :wink:

Anyway, good luck with development and maintenance of your new lib!

#5

It’s probably OK since people are creating Elm like UI libraries in PureScript every month if not every week. :grinning:

I think purescript-nonbili-postgres is the 4th binding to pg on pursuit, the others are

  • purescript-postgresql-client
  • purescript-node-postgres
  • purescript-pg

Thanks, I will try my best.