Dictu icon indicating copy to clipboard operation
Dictu copied to clipboard

[FEATURE] - Redis Support

Open briandowns opened this issue 4 years ago • 6 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Is your feature request related to a problem?

Not necessarily a problem but more so a need for use with Redis.

Describe the solution you'd like

A module like the sqlite module that provides a simple API for use with Redis databases.

Describe alternatives you've considered

The use of the socket module could be used and the content parsed and marshalled to and from however this seems tedious for the implementer.

Additional context

I have an implementation that can be ported into Dictu.

briandowns avatar Dec 27 '21 02:12 briandowns

I did make an incredibly simple implementation a while back to connect to Redis in Dictu. I think this is probably one of those things that would benefit greatly if a package manager was available. I don't think I would have a stdlib module for Redis, but I'm very happy to spin up a new Repo under the Dictu organisation here on Github if that interests you?

Jason2605 avatar Dec 27 '21 13:12 Jason2605

Makes sense. I'd be curious how to do a package in C that could be imported. I did the Redis implementation in C and can push the branch if you're interested. Along with that, I started work on a generic "database" package that would have a "new" function and take some config. In that config would be an indicator of the driver to use; mysql, redis, sqlite, postgres, etc and a generic interface to run queries with. I ended up getting side tracked and didn't finish it.

briandowns avatar Dec 27 '21 18:12 briandowns

I wrote out a comment for this but seems it was lost to the ether 😢 Anyways, let me write it back out!

I'd be curious how to do a package in C that could be imported.

Yeah thats currently not quite possible, there is no FFI in Dictu which would allow C code outside of the interpreter to be ran at runtime. Something that definitely needs adding eventually else everything would either need to be in the interpreter or written in Dictu, which isn't really feasible.

Luckily the Redis protocol isn't too difficult to implement something manually in Dictu (not saying you have to do this, I'm just saying from my previous attempt; although I didn't get too complex with it, so it could get harder).

Along with that, I started work on a generic "database" package that would have a "new" function and take some config. In that config would be an indicator of the driver to use; mysql, redis, sqlite, postgres, etc and a generic interface to run queries with.

A single API that deals with multiple different database dialects is always nice!

I ended up getting side tracked and didn't finish it.

Hah! I've been there many-a-time.

Jason2605 avatar Dec 27 '21 18:12 Jason2605

I wrote out a comment for this but seems it was lost to the ether 😢 Anyways, let me write it back out!

I'd be curious how to do a package in C that could be imported.

Yeah thats currently not quite possible, there is no FFI in Dictu which would allow C code outside of the interpreter to be ran at runtime. Something that definitely needs adding eventually else everything would either need to be in the interpreter or written in Dictu, which isn't really feasible.

Luckily the Redis protocol isn't too difficult to implement something manually in Dictu (not saying you have to do this, I'm just saying from my previous attempt; although I didn't get too complex with it, so it could get harder).

Along with that, I started work on a generic "database" package that would have a "new" function and take some config. In that config would be an indicator of the driver to use; mysql, redis, sqlite, postgres, etc and a generic interface to run queries with.

A single API that deals with multiple different database dialects is always nice!

I ended up getting side tracked and didn't finish it.

Hah! I've been there many-a-time.

Ive been playing around with something ffi-like, even if very early and very wip image

liz3 avatar Jan 20 '24 21:01 liz3

@liz3 This would be an incredible addition!!

Jason2605 avatar Jan 22 '24 17:01 Jason2605

Agreed. I was looking at this last night and the potential is huge.

briandowns avatar Jan 22 '24 17:01 briandowns