Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PostgreSQL #50

Open
33 tasks done
friendbear opened this issue Aug 28, 2023 · 0 comments
Open
33 tasks done

PostgreSQL #50

friendbear opened this issue Aug 28, 2023 · 0 comments
Assignees
Labels
learning Books and other studies

Comments

@friendbear
Copy link
Owner

friendbear commented Aug 28, 2023

#Lang/Rust

PostgreSQL

データベースアクセスの概要

  • 使用する外部クレート
クレート 概要
postgres PostgreSQLをシンプルにアクセスする機能を提供する
rsd2 コネクションプールの基本機能を提供する
r2d2_postgres PostgreSQL専用のコネクションプール機能を提供する
lombok Javaでお馴染みのコンストラクタ、セッター、ゲッター生成のRust版 アトリビュートを利用
anyhow Error及びResult型を利用して複数種類のErrorをシンプルに扱える
once_cell コネクションプールをスレッドや非同期処理間で共有するために利用する
  • 使用するテーブル構造
  • postgresクレートの概要

データベース接続

  • 接続機能の概要
  • 接続パラメータ
  • 接続文字列の生成
  • 接続の実装
  • 接続テスト

トランザクション制御

  • TransactionBuilder構造体
  • トランザクション制御機能の実装

CRUD操作の準備

  • CRUD操作メソッド
  • サンプルコードのパターン
  • Entityの実装
  • Repositoryトレイト
  • Repositoryトレイトの実装

CRUD操作の実装

  • 全件問い合わせ
  • 主キーの問い合わせ
  • レコードの追加
  • テーブル結合
  • SQL関数の利用

コネクションプール

  • r2s2_postgreクレートの概要
  • コネクションプールの生成
  • r2d2::Builder構造体
  • r2d2::コネクションプールの利用

非同期実行

  • tokio_postgresクレートの概要
  • データベース接続
  • トランザクションの開始
  • Repositoryトレイト
  • Repositoryの実装
  • 非同期メソッドのテスト

YAMLファイルの利用

  • ファイルの定義
  • SQL取得機能の実装
  • 関数の利用
@friendbear friendbear added the learning Books and other studies label Aug 28, 2023
This was referenced Aug 30, 2023
@friendbear friendbear self-assigned this Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
learning Books and other studies
Projects
None yet
Development

No branches or pull requests

1 participant