Skip to content

Instantly share code, notes, and snippets.

@JoMingyu

JoMingyu/orm.py Secret

Last active October 25, 2018 13:34
class User(Model):
meta = {
'tablename': 'tbl_users'
}
email = StringField()
name = StringField()
age = IntField()
@property
def json(self):
return {
'email': self.email,
'name': self.name,
'age': self.age
}
def get_user_list(age_matches):
results = User.query(age=age_matches).all()
return [res.json for res in results]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment