Crystal勉強会#4 LT資料
- 12. Topazというライブラリを開発中
github: tbrand/topaz
シンプルなDBラッパー(crystal-mysqlをサポート)
Version 0.0.2をリリース!
awesome-crystal にも追加していただきました
モデルの定義
class SampleModel < Topaz::Model
columns(
{name: name, type: String},
{name: age, type: Int32},
{name: score, type: Float64}
)
end
テーブルの作成・削除
SampleModel.create_table
データの作成・削除・検索・更新
SampleModel#create,delete,update,select
SampleModel.where(“age = 25”).order(“score”).range(0, 10).select
モデルの関連付け
has, belongs など
dependencies:
topaz:
github: tbrand/topaz
インストール