Spaces:
Running
on
Zero
Running
on
Zero
from dataclasses import dataclass | |
from tortoise.models import Model | |
from tortoise import fields | |
class User(Model): | |
id = fields.IntField(pk=True) | |
username = fields.CharField(max_length=50, unique=True) | |
email = fields.CharField(max_length=100, unique=True) | |
class Product(Model): | |
id = fields.IntField(pk=True) | |
name = fields.CharField(max_length=100) | |
price = fields.DecimalField(max_digits=10, decimal_places=2) |