Skip to content

rbarrois/minimodels

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

minimodels

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!

Example

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"}'

Backends

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>

About

A backend-independent database abstraction tool

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages