Skip to content

Commit 1fc93c7

Browse files
committed
docs(exporter): GORM 식별자·태그 규칙과 파이썬 백엔드 변경을 기재
1 parent bed34c9 commit 1fc93c7

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"changes": {"crates/vespertide-cli/Cargo.toml": "Minor", "crates/vespertide-config/Cargo.toml": "Minor", "crates/vespertide-core/Cargo.toml": "Minor", "crates/vespertide-exporter/Cargo.toml": "Minor", "crates/vespertide-loader/Cargo.toml": "Minor", "crates/vespertide-lsp/Cargo.toml": "Minor", "crates/vespertide-macro/Cargo.toml": "Minor", "crates/vespertide-naming/Cargo.toml": "Minor", "crates/vespertide-planner/Cargo.toml": "Minor", "crates/vespertide-query/Cargo.toml": "Minor", "crates/vespertide/Cargo.toml": "Minor"}, "note": "GORM(Go)·Django(Python) 익스포터를 7·8번째 ORM 백엔드로 추가. `Orm`이 exhaustive pub enum이라 `Orm::Gorm`/`Orm::Django` 추가가 0.x 기준 breaking이고, vespertide-config에 `django` 설정 섹션과 GORM 패키지명 추론(`go_package_name`)이, vespertide-cli에 `export --orm gorm|django` 경로가 함께 들어간다. vespertide-core의 `SimpleColumnType`·`ReferenceAction`에서 `#[non_exhaustive]`를 제거해 downstream이 exhaustive match를 쓸 수 있게 한다(기존 `_` arm은 `unreachable_patterns` 경고가 된다). published 크레이트를 전부 같은 Minor로 올리는 이유는 #185·#186과 동일하다: [workspace.dependencies]의 `=` 핀으로 물려 있어 일부만 올리면 핀과 크레이트 버전이 어긋나 resolve가 깨진다.", "date": "2026-09-15T07:40:25.0000000Z"}
1+
{"changes": {"crates/vespertide-cli/Cargo.toml": "Minor", "crates/vespertide-config/Cargo.toml": "Minor", "crates/vespertide-core/Cargo.toml": "Minor", "crates/vespertide-exporter/Cargo.toml": "Minor", "crates/vespertide-loader/Cargo.toml": "Minor", "crates/vespertide-lsp/Cargo.toml": "Minor", "crates/vespertide-macro/Cargo.toml": "Minor", "crates/vespertide-naming/Cargo.toml": "Minor", "crates/vespertide-planner/Cargo.toml": "Minor", "crates/vespertide-query/Cargo.toml": "Minor", "crates/vespertide/Cargo.toml": "Minor"}, "note": "GORM(Go)·Django(Python) 익스포터를 7·8번째 ORM 백엔드로 추가. `Orm`이 exhaustive pub enum이라 `Orm::Gorm`/`Orm::Django` 추가가 0.x 기준 breaking이고, vespertide-config에 `django` 설정 섹션과 GORM 패키지명 추론(`go_package_name`)이, vespertide-cli에 `export --orm gorm|django` 경로가 함께 들어간다. 기존 파이썬 백엔드(SQLAlchemy·SQLModel)도 파이썬 키워드 컬럼명을 이스케이프하고 export 파일명을 모듈명으로 산어화하며, Django 모델은 `managed = False`로 나간다. vespertide-core의 `SimpleColumnType`·`ReferenceAction`에서 `#[non_exhaustive]`를 제거해 downstream이 exhaustive match를 쓸 수 있게 한다(기존 `_` arm은 `unreachable_patterns` 경고가 된다). published 크레이트를 전부 같은 Minor로 올리는 이유는 #185·#186과 동일하다: [workspace.dependencies]의 `=` 핀으로 물려 있어 일부만 올리면 핀과 크레이트 버전이 어긋나 resolve가 깨진다.", "date": "2026-09-15T07:40:25.0000000Z"}

‎crates/vespertide-exporter/AGENTS.md‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,14 @@ trailing `_` — so `django/render.rs::django_field_name` applies Django's field
8989
pluralized table name to avoid colliding with the struct's own name
9090
- **No M2M/junction detection**: a junction table (composite-PK, 2+ FKs) is rendered as a plain
9191
has-many to the junction struct itself, not a dedicated M2M relation
92+
- **Identifiers**: every struct, field and type name is an exported Go name (`exported_go_name`:
93+
`1users` → `X1users`), `Id` becomes `ID` only where it ends a word (`UserID`, but `Identity`),
94+
and one taken set per struct covers the columns first and then every relation field, so a
95+
has-many or belongs-to never takes a column's name (`Posts2`, `OrderRegions3`)
96+
- **Tags**: `index:`/`uniqueIndex:` names come from the naming builders, so they match what the
97+
SQL layer creates and GORM groups a composite index by them; `char(N)` and the PG network types
98+
carry an explicit `type:`; a default GORM's tag syntax cannot hold (`"`, `;`, a function call)
99+
is omitted, and an integer enum's variant-name default becomes its value
92100
- **Package name**: there is no `gorm` config section. `GormExporterWithConfig` takes a resolved
93101
`&str`, which callers get from `vespertide_config::go_package_name(export_dir)` — the export
94102
directory's final path segment sanitized into a Go identifier, falling back to `"models"`. The
@@ -111,9 +119,9 @@ trailing `_` — so `django/render.rs::django_field_name` applies Django's field
111119
junctions reach one target) and run through `django_field_name` after the columns, so it never
112120
shadows a scalar field. Purely self-referential junctions are skipped rather than guessed at
113121
- **Composite (multi-column) FK**: Django has no native multi-column FK field, so
114-
`collect_composite_fks` (from `utils/common.rs`, shared with SQLAlchemy, SQLModel and GORM) is used to emit a
115-
`# composite foreign key: (...) -> ref_table(...)` comment instead of silently dropping the
116-
relationship
122+
`collect_composite_fks` (from `utils/common.rs`, shared with SQLAlchemy, SQLModel and GORM)
123+
emits a `# composite foreign key: (...) -> ref_table(...)` comment instead of silently dropping
124+
the relationship
117125
- **`build_default()`**: only emits a bare (unquoted) SQL default when it parses as a numeric
118126
literal — an unrecognized bare constant (e.g. a named SQL constant) is omitted rather than
119127
emitted as an undefined Python name

0 commit comments

Comments
 (0)