This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import asyncio | |
| from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession | |
| from sqlalchemy.orm import declarative_base, relationship, sessionmaker | |
| from sqlalchemy import Column, Integer, String, ForeignKey, select | |
| from sqlalchemy.orm import selectinload, joinedload | |
| # 创建基类 | |
| Base = declarative_base() | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import datetime | |
| from sqlalchemy import Column, Integer, String, Float, ForeignKey, create_engine, select, func, Table | |
| from sqlalchemy.orm import declarative_base, Mapped, relationship, sessionmaker | |
| Base = declarative_base() | |
| # 关联表 | |
| user_favorites = Table('user_favorites', Base.metadata, | |
| Column('user_id', Integer, ForeignKey('users.id'), primary_key=True), | |
| Column('product_id', Integer, ForeignKey('products.id'), primary_key=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "os" | |
| "path/filepath" | |
| "strings" | |
| ) | |
| func main() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package radix | |
| import ( | |
| "strconv" | |
| "testing" | |
| ) | |
| func radix(x, base int) string { | |
| var s string | |
| if x == 0 { |