Support for database other than mongodb
Are there any plans to support other databases? I'm writing an application using Redis and need to add user management. Now I would like to implement Redis support for userman but want to discuss the approach. The most straightforward option would be to turn the UserManController into an interface and then implement various concrete classes for each supported db. The UserManSettings would need to be extended with some additional properties (e.g. databaseIndex for Redis).
No concrete plans, yet, but this would be a welcome change. I think the interface suggestion is the quickest way to add support right now. I'm currently investigating in a DB abstraction, which would be ideal for this (dotter), but it's still in the experimentation phase.
As for the UserManSettings, I'd say that a single databaseURL field would be ideal (the databaseName field could then be deprecated). This would have the advantage that the MongoDB server (or cluster) and various other parameters could also be configured. For Redis, it would look like "redis://localhost:6379/0".
The databaseURL is a good idea. So I'll do it this way then. A db abstraction layer would definitely be great although tricky with NoSQL.
Yeah, the abstraction layer will definitely have to be limited to simple operations (at least at first), so there would still be at least some DB specific code.
How would you handle the entity abstraction (User, AuthInfo, Group)? Currently they have properties with BSON types like BsonObjectID and BsonDate for easy (de)serialization which is mongodb specific. So far I came up with the following two options:
- Use the 'BSON classes' in an intermediate step and map them to more generic classes (with e.g. string id) to be exposed by the API?
- Implement UDAs to make the vibe.d BSON module treat properties with e.g. the attribute
@("BsonObjectID")accordingly.
How would you go about it?
I've discovered the serialization customization methods and implemented those.