MCPcopy Create free account
hub / github.com/Houseofmvps/codesight / orm_from_bases

Function orm_from_bases

plugins/ast/python/src/lib.rs:604–619  ·  view source on GitHub ↗

Map a base class to its ORM when the field constructors didn't already reveal it.

(bases: &[String])

Source from the content-addressed store, hash-verified

602
603/// Map a base class to its ORM when the field constructors didn't already reveal it.
604fn orm_from_bases(bases: &[String]) -> &'static str {
605 for base in bases {
606 let leaf = base.rsplit('.').next().unwrap_or(base);
607
608 match leaf {
609 "Model" if base.starts_with("models.") => return "django",
610 "SQLModel" => return "sqlmodel",
611 "BaseModel" => return "pydantic",
612 "DeclarativeBase" | "Base" => return "sqlalchemy",
613 "Model" => return "sqlalchemy", // db.Model (Flask-SQLAlchemy)
614 _ => {}
615 }
616 }
617
618 "unknown"
619}
620
621/// Normalize a Django field constructor to a simple type name.
622fn django_type(field: &str) -> String {

Callers 1

extract_schemasFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected