示例#1
0
class User(AsyncModel, connection=ConnectionManager(DB_URI)):

    __tablename__ = 'users'

    id = Column(primary_key=True)
    name = Column()
    email = Column()
示例#2
0
class WodResult(Entity):
    __tablename__ = 'wod_result'

    id = Column(default=uuid.uuid4, primary_key=True)
    wod_id = Column()
    user_id = Column()
    result = Column()
    sys_date = Column()
示例#3
0
class Location(Entity):
    __tablename__ = 'location'

    user_id = Column(primary_key=True)
    longitude = Column()
    latitude = Column()
    locale = Column()
    tz = Column()
示例#4
0
class WOD(Entity):
    __tablename__ = 'wod'

    id = Column(default=uuid.uuid4, primary_key=True)
    wod_day = Column()
    title = Column()
    description = Column()
    warmup = Column()
示例#5
0
class UserModelMixin:

    __tablename__ = 'users'

    id = Column('_id', default=uuid.uuid4, primary_key=True)
    name = Column(default='test')
    email = Column()

    @classmethod
    async def populate(cls, n):
        for _ in range(n):
            name = random_string()
            email = f'{name}@example.com'
            model = cls(name=name, email=email)
            await model.save()
示例#6
0
class DbModel(AsyncModel, connection=manager):
    """Base database model class that we inherit from.

    Adds the ``id`` column to all models that inherit from this class.  The
    ``id`` in the database will be found at a column named ``_id``.

    """
    id = Column('_id', default=uuid.uuid4, primary_key=True)
示例#7
0
class User(DbModel):
    """A simple user class.

    Table Columns
    -------------

    _id : uuid  Primary Key
    name : text  Not Null
    email : text

    """
    # Set the database tablename.  If not supplied then it defaults
    # to lower case version of class name.
    __tablename__ = 'users'

    name = Column()
    email = Column()
示例#8
0
class User(Entity):
    __tablename__ = 'users'

    id = Column(default=uuid.uuid4, primary_key=True)
    user_id = Column()
    name = Column()
    surname = Column()
    lang = Column()
    admin = Column()
示例#9
0
class Subscriber(Entity):
    __tablename__ = 'subscribers'

    id = Column(default=uuid.uuid4, primary_key=True)
    user_id = Column()