nim-lang / RFCs

A repository for your Nim proposals.
136 stars 26 forks source link

Implementing a seqtosqlarray proc for db_postgres #280

Closed C-NERD closed 3 years ago

C-NERD commented 3 years ago

Summary

Hello guys I have been using the db_postgres module for a while and I noticed that I have to manually convert seqs to sqlarrays. This is not a problem but I think there should be a proc which does that. Now I would like to do this myself but I am not familiar with GitHub and how foss works so would someone guide me

Araq commented 3 years ago

Please outline the proc declaration that you have in mind. Also please outline if the other db_* modules (db_sqlite, db_mysql) would benefit from it.

C-NERD commented 3 years ago

Please outline the proc declaration that you have in mind. Also please outline if the other db_* modules (db_sqlite, db_mysql) would benefit from it.

I have 2 procedure declarations in mind :

1. seqtosqlarray:

This procedure aims at converting nim seq to sqlarrays

2. sqlarraytoseq:

This procedure aims to covert sqlarrays back to nim seq

And no the other db_* module will not benefit, it's only for db_postgres because of postgres support for arrays

Araq commented 3 years ago

And no the other db_* module will not benefit, it's only for db_postgres because of postgres support for arrays

The db_* modules are DB-agnostic though. This means you should add these helpers to a module like db_postgres_extensions and preferably this should start as a Nimble package.

C-NERD commented 3 years ago

Thanks for the reply i am already working on a nimble package, i think db_extensions will be a good name just in case anyone wants to add extended features to the other db_* modules through the package in the future.