Skip to content

mandrewcito/json_repository

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

json_repository

Donate  travis build Pypi Downloads Downloads codecov.io

Install

https://pypi.org/project/json-repository/ pip install json-repository

Examples

You can also go to tests to check a good how-to!

Creating custom repository

class Foo(object):
    foo = None
    bar = None
    id = None

class FoobarRepository(BaseJsonRepository):
  def __init__(self):
    super(FoobarRepository, self).__init__(Foo)

using created repository

  with FoobarRepository() as repo:
    for entity in repo.get_all():
      repo.delete(entity)
    repo.context.commit()