This library aims to provide a generic abstraction over various data storage backends. It provides a simple, declarative API for data structures, which can then be mapped to custom backends.
Note
This is only a draft documentation, no actual code yet!
class User(minimodels.Model):
first_name = minimodels.fields.CharField()
last_name = minimodels.fields.CharField()
>>> user = User(first_name="John", last_name="Lennon")
>>> user.serialize('json')
'{"first_name": "John", "last_name": "Lennon"}'
A specific backend may be provided for each model, in its Meta
class:
class User(minimodels.Model):
# Field definitions
class Meta:
backend = minimodels.backends.Redis(settings.REDIS_URL, prefix='user')
>>> user = User(username='john', first_name="John", last_name="Lennon")
>>> user.save()
>>> user = User.objects.get(username='john')
<User: John Lennon>