Metadata-Version: 2.1
Name: gino-factory
Version: 0.1.0a7
Summary: Gino Factory
Home-page: UNKNOWN
Author: Basalex (Alexander Baskakov)
Author-email: <alexanderbaskakov@mail.ru>
License: UNKNOWN
Project-URL: Source, https://github.com/Basalex/gino_factory
Keywords: python,gino,faker
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: Unix
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows
Requires-Dist: gino
Requires-Dist: faker


Gino Factory
===========================

| **Install**: ``pip install gino-factory``

**Github**: https://github.com/Basalex/gino_factory

Examples of usage:
~~~~~~~~~~~~~~~~~~

Let's create gino model

.. code:: python

    class User(db.Model):
        __tablename__ = 'users'
        id = db.Column(db.BigInteger(), primary_key=True)
        parent_id = db.Column(db.BigInteger(), primary_key=True)
        username = db.Column(db.String(255), nullable=False, unique=True)
        custom_field = db.Column(db.String(255), nullable=False, unique=True)
        custom_factory = db.Column(db.String(255), nullable=False, unique=True)

Next you need to register this model

.. code:: python

    from gino_factory import GinoFactory

    class Factory(GinoFactory):
        pass

    Factory.register(User, custom_field='value', custom_factory=function)

And use this class for testing purposes

.. code:: python

    async def test():
        user = await Factory.user()
        ten_users = await Factory.cycle(10).user()
        user_tree = await Factory.tree().user()

or you may fill your database with random data using __random__ method

.. code:: python

    await Factory.__random__()

This method inserts random data to all registered tables

