class Author(helo.Model): id = helo.Auto() name = helo.VarChar(length=45, comment='username') password = helo.VarChar(length=100) create_at = helo.Timestamp(default=helo.ON_CREATE) update_at = helo.Timestamp(default=helo.ON_UPDATE)
class User(People): nickname = helo.VarChar(length=100) password = helo.VarChar(name='pwd') role = helo.Int(default=0) lastlogin = helo.DateTime(default=datetime.datetime.now, name='loginat') class Meta: db = 'helo' name = 'user_' indexes = ( helo.K('idx_name', 'name'), helo.UK('unidx_nickname', 'nickname') )
class User(Person): email = helo.Email(default='') password = helo.VarChar(length=100, null=False) create_at = helo.Timestamp(default=helo.ON_CREATE) class Meta: indexes = [helo.K('idx_ep', ['email', 'password'])]
class Employee(People): salary = helo.Float() departmentid = helo.Int() phone = helo.VarChar(default='') email = helo.Email(length=100, default='') class Meta: indexes = [helo.K('idx_age_salary', ['age', 'salary'])]
class Role(helo.Model): id = helo.Int(primary_key=True, auto=True) name = helo.VarChar(length=50) is_deleted = helo.Bool(default=False) create_at = helo.Timestamp(default=helo.ON_CREATE) update_at = helo.Timestamp(default=helo.ON_UPDATE) class Meta: name = 'role_'
class People(helo.Model): id = helo.Auto() name = helo.VarChar(length=45) gender = helo.Tinyint(length=1, unsigned=True) age = helo.Tinyint(unsigned=True) create_at = helo.Timestamp(default=helo.ON_CREATE) update_at = helo.Timestamp(default=helo.ON_UPDATE) class Meta: indexes = [helo.K('idx_name', 'name')]
class Post(helo.Model): id = helo.Int(primary_key=True, auto=True) name = helo.VarChar(length=100) author = helo.Int(default=0) column = helo.Int(default=0) is_deleted = helo.Tinyint(default=0) created = helo.DateTime(default=datetime.datetime(2019, 10, 10)) def __repr__(self): return '<{} {}>'.format(self.__class__.__name__, self.name)
class Post(helo.Model): id = helo.Auto(comment='auto increment pk') title = helo.VarChar(length=100) content = helo.Text(encoding=helo.ENCODING.UTF8MB4) author = helo.Int(default=0) create_at = helo.Timestamp(default=helo.ON_CREATE) update_at = helo.Timestamp(default=helo.ON_UPDATE) class Meta: indexes = [ helo.K('idx_title', 'title'), helo.K('idx_author', 'author'), ]
class Author(helo.Model): id = helo.BigAuto() name = helo.VarChar(length=45, null=False) email = helo.Email(default='') password = helo.VarChar(length=100, null=False)
class Person(helo.Model): id = helo.BigAuto() name = helo.VarChar(length=45, null=False)