Skip to content

feat(exporter, landing): fix GORM bugs and redesign landing page#150

Open
2heunxun wants to merge 6 commits into
dev-five-git:mainfrom
2heunxun:main
Open

feat(exporter, landing): fix GORM bugs and redesign landing page#150
2heunxun wants to merge 6 commits into
dev-five-git:mainfrom
2heunxun:main

Conversation

@2heunxun
Copy link
Copy Markdown

개요

이 PR은 두 가지 주요 변경을 포함합니다.

  1. GORM 구현 및 익스포터 버그 수정 및 기능 보완
  2. 랜딩 페이지 전면 리디자인

1. GORM 익스포터 버그 수정 및 기능 보완

버그 수정

go_type_for_column 미정의로 인한 컴파일 오류

test_go_type_mapping 테스트가 존재하지 않는 함수 go_type_for_column을 호출하고 있었습니다.
내부 enum 매핑이 불필요한 단순 타입 테스트용 2-파라미터 래퍼를 추가하여 해결했습니다.

fn go_type_for_column(col_type: &ColumnType, nullable: bool) -> String {
    go_type_for_column_mapped(col_type, nullable, &HashMap::new())
}

HasMany 필드명 복수형 중복 (PostssPosts)

이미 복수형인 테이블명(예: posts)에 s를 추가로 붙여 Postss 같은 잘못된 Go 식별자가 생성되는 문제를 수정했습니다.

// 수정 전: format!("{}s", to_pascal_case(&other.name))  → "Postss"
// 수정 후: 이미 s로 끝나면 그대로 사용               → "Posts"
let pascal = to_pascal_case(&other.name);
let base_name = if pascal.ends_with('s') { pascal } else { format!("{pascal}s") };

기능 보완

JSONB 커스텀 타입 매핑

Custom { custom_type: "JSONB" }string 대신 datatypes.JSON으로 매핑하고,
gorm.io/datatypes 임포트를 자동으로 추가합니다. type:JSONB 태그는 유지되어 DB 컬럼 타입도 정확히 명시됩니다.

// 수정 전
Data string `gorm:"column:data;not null;type:JSONB" json:"data"`

// 수정 후
Data datatypes.JSON `gorm:"column:data;not null;type:JSONB" json:"data"`

HasMany 역방향 관계에 on_delete / on_update 반영

스키마 컨텍스트에서 역방향 관계를 생성할 때 FK constraint 정보가 누락되어 있었습니다.
ReverseRelation 구조체에 on_delete, on_update를 추가하고 GORM 태그에 반영합니다.

// 수정 전
Posts []Posts `gorm:"foreignKey:UserID" json:"-"`

// 수정 후
Posts []Posts `gorm:"foreignKey:UserID;constraint:OnDelete:CASCADE,OnUpdate:RESTRICT" json:"-"`

테스트 추가

테스트 내용
test_table_with_jsonb_column JSONB → datatypes.JSON 매핑 및 임포트 검증
test_server_default_skipped NOW() 등 서버 함수 기본값이 GORM 태그에서 제외되고, 리터럴 기본값은 포함되는 동작 검증
test_has_many_with_constraint on_delete/on_update가 HasMany 태그에 반영되는 동작 검증
test_go_type_mapping (3 케이스 추가) JSONB, jsonb, 기타 커스텀 타입 매핑 검증

2. 랜딩 페이지 전면 리디자인

신규 컴포넌트

파일 역할
code-tabs.tsx 탭 전환 인터랙티브 코드 예제 블록
code-window.tsx 파일명 헤더가 있는 코드 창
copy-install.tsx 설치 명령어 클릭 복사 버튼
_lib/highlight.ts 서버 사이드 구문 강조 유틸리티

제거된 컴포넌트

  • example.tsx (ExampleContainer, ExampleImage, ExampleProvider)
  • join-icon-button.tsx (JoinIconButton)

페이지 변경 사항

  • Hero 섹션에 JSON 모델 정의 코드 미리보기와 CopyInstall 버튼 추가
  • CLI 사용법, ORM export, SeaORM 런타임 예제를 탭 전환 방식으로 표시
  • 지원 ORM 목록에 GORM (Go) 추가 — SeaORM, SQLAlchemy, SQLModel, GORM
  • 통계 항목에 "4 ORM exports" 추가

변경 파일 요약

crates/vespertide-exporter/src/gorm/mod.rs                        (버그 수정 + 기능 보완)
crates/vespertide-exporter/src/gorm/snapshots/*.snap              (스냅샷 테스트 3개 추가)
apps/landing/src/app/page.tsx                                     (페이지 리디자인)
apps/landing/src/app/_components/code-tabs.tsx                    (신규)
apps/landing/src/app/_components/code-window.tsx                  (신규)
apps/landing/src/app/_components/copy-install.tsx                 (신규)
apps/landing/src/app/_lib/highlight.ts                            (신규)
apps/landing/src/app/_components/example.tsx                      (제거)
apps/landing/src/app/_components/join-icon-button.tsx             (제거)

테스트

cargo test -p vespertide-exporter  # 362 passed

Copy link
Copy Markdown
Contributor

@owjs3901 owjs3901 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changepacks를 사용해야 합니다

Comment on lines +1 to +19
import { globalCss } from '@devup-ui/react'

globalCss({
'.shiki, .shiki span': {
fontFamily: 'D2Coding',
fontSize: '13px',
lineHeight: '1.65',
},
'.shiki': {
background: 'transparent !important',
padding: '0',
margin: '0',
overflowX: 'auto',
},
'[data-theme="dark"] .shiki, [data-theme="dark"] .shiki span': {
color: 'var(--shiki-dark) !important',
backgroundColor: 'transparent !important',
},
})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code-window.tsx에서 밖에 사용되지 않으므로 해당 파일 안에 정의되는 것이 더욱 적절해 보입니다

Comment on lines +52 to +72
export function StaticCodeBlock({
title,
html,
}: {
title: string
html: string
}) {
return (
<CodeWindow title={title}>
<HighlightedCode html={html} />
</CodeWindow>
)
}

export function HeroCodeWrapper({ children }: { children: React.ReactNode }) {
return (
<Flex justifyContent={[null, null, null, 'flex-end']} w="100%">
{children}
</Flex>
)
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use client 가 필요 없는 코드들이 use client가 선언된 파일 내에 정의되어 있는 것은 피해야 합니다

Comment thread CLAUDE.md
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

불 필요한 변경사항입니다

Comment thread CHANGELOG.md
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changelog는 우리는 사용하지 않고 있습니다

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants