dlang-community / d2sqlite3

A small wrapper around SQLite for the D programming language
Boost Software License 1.0
75 stars 26 forks source link

Adds support for bind/inject/peek JSONValue types #38

Closed sleekslush closed 7 years ago

sleekslush commented 7 years ago

I was interested in taking a stab at supporting automatic JSON (de)serialization. Curious about your thoughts on something like this, as well as the implementation.

I'd add more tests if you're interested in merging

denizzzka commented 7 years ago

This patch can block future native JSON values usage, IMHO

https://sqlite.org/json1.html

sleekslush commented 7 years ago

What specifically are you referring to? Not sure I understand the concern

denizzzka commented 7 years ago

I was wrong, I forgot that in SQLite fields types is unspecified.

biozic commented 7 years ago

Thanks for this PR. But I'm not yet convinced of its usefulness:

  1. I'm pretty sure that some people (me included) don't use std.json but another library (e.g. vibe.d's implementation) that is not compatible.

  2. I would like the library to focus on handling generic strings and let the user handle JSON parsing and generation. In my opinion, it's usually quick and straightforward.

sleekslush commented 7 years ago

The original reason that I wanted to try something like this out was so that I could use T as(T)() on a struct that had a member of type JSONValue. Your point about keeping this mostly agnostic to other libraries makes perfect sense. Maybe there's a middle ground somewhere