#1 リファクタリング

Closed
opened 10 months ago by みてるぞ · 6 comments

以下について記述を検討する:

  • DAO の SQL 自動生成
  • クエリ・ビルダで SQL 生成
以下について記述を検討する: * DAO の SQL 自動生成 * クエリ・ビルダで SQL 生成
みてるぞ commented 10 months ago
Owner

独自のアノテーション作る.
DAO には @dao アノテーションを附することで CRUD を自動生成するくらゐのことはしたぃ.s
DTO にも @entity アノテーションにより各コラム名との対応づけしたぃ.

独自のアノテーション作る. DAO には @dao アノテーションを附することで CRUD を自動生成するくらゐのことはしたぃ.s DTO にも @entity アノテーションにより各コラム名との対応づけしたぃ.
みてるぞ commented 10 months ago
Owner

DTO

@entity (id_         = 'id',
         code        = 'code',
         title       = 'title',
         description = 'description',
         uploaded_at = 'uploaded_at',
         deleted_at  = 'deleted_at')
class VideoDto:
    code:               str
    title:              str
    description:        str
    uploaded_at:        datetime
    id_:                int | None                      = None
    deleted_at:         datetime | DbNullType           = DbNull
    video_tags:         list[VideoTagDto] | None        = None
    comments:           list[CommentDto] | None         = None
    video_histories:    list[VideoHistoryDto] | None    = None

DAO

@dao (entity = VideoDto)
class VideoDao: ...
### DTO ```python @entity (id_ = 'id', code = 'code', title = 'title', description = 'description', uploaded_at = 'uploaded_at', deleted_at = 'deleted_at') class VideoDto: code: str title: str description: str uploaded_at: datetime id_: int | None = None deleted_at: datetime | DbNullType = DbNull video_tags: list[VideoTagDto] | None = None comments: list[CommentDto] | None = None video_histories: list[VideoHistoryDto] | None = None ``` ### DAO ```python @dao (entity = VideoDto) class VideoDao: ... ```
みてるぞ commented 10 months ago
Owner

DbNull と DbNullType を独自型にしたはぅがいぃね.
今のとこ None(変更なし)との区別つかなぃし.

DbNull と DbNullType を独自型にしたはぅがいぃね. 今のとこ None(変更なし)との区別つかなぃし.
みてるぞ commented 10 months ago
Owner

手順としては,

  1. DbNull と None の区別
  2. クエリ・ビルダの導入、移行
  3. アノテーションでラッピング

といったところか.

手順としては, 1. DbNull と None の区別 2. クエリ・ビルダの導入、移行 3. アノテーションでラッピング といったところか.
みてるぞ commented 10 months ago
Owner

Eloquent の導入で 3. は不要に.
型定義ファイル作成し,MyPy のチェック通過,本番環境で問題なく動作することを確認し完了とする.

Eloquent の導入で 3. は不要に. 型定義ファイル作成し,MyPy のチェック通過,本番環境で問題なく動作することを確認し完了とする.
みてるぞ commented 10 months ago
Owner

アップサート周りでエラー発生.
とりあへずリファクタリングの作業はすでに終了してるので,今後の問題は別にイシュー立てることとする(ややこしなるので).

アップサート周りでエラー発生. とりあへずリファクタリングの作業はすでに終了してるので,今後の問題は別にイシュー立てることとする(ややこしなるので).
みてるぞ closed this issue 10 months ago
Sign in to join this conversation.
No Label
No Milestone
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.