Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Małe co nieco Sequela
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Marta Buda
May 20, 2015
Programming
0
190
Małe co nieco Sequela
TRUG#37 presentation about one of Ruby gems - Sequel. Slides are in polish.
Marta Buda
May 20, 2015
Tweet
Share
Other Decks in Programming
See All in Programming
Geminiの機能を調べ尽くしてみた
naruyoshimi
0
200
CSC307 Lecture 12
javiergs
PRO
0
470
Takumiから考えるSecurity_Maturity_Model.pdf
gessy0129
1
130
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
300
Codexに役割を持たせる 他のAIエージェントと組み合わせる実務Tips
o8n
3
1.2k
朝日新聞のデジタル版を支えるGoバックエンド ー価値ある情報をいち早く確実にお届けするために
junkiishida
1
720
守る「だけ」の優しいEMを抜けて、 事業とチームを両方見る視点を身につけた話
maroon8021
3
460
手戻りゼロ? Spec Driven Developmentとは@KAG AI week
tmhirai
1
170
New in Go 1.26 Implementing go fix in product development
sunecosuri
0
390
RubyとGoでゼロから作る証券システム: 高信頼性が求められるシステムのコードの外側にある設計と運用のリアル
free_world21
0
240
PJのドキュメントを全部Git管理にしたら、一番喜んだのはAIだった
nanaism
0
250
AI主導でFastAPIのWebサービスを作るときに 人間が構造化すべき境界線
okajun35
0
640
Featured
See All Featured
Exploring anti-patterns in Rails
aemeredith
2
280
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
150
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.4k
Producing Creativity
orderedlist
PRO
348
40k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
210
Typedesign – Prime Four
hannesfritz
42
3k
Faster Mobile Websites
deanohume
310
31k
Color Theory Basics | Prateek | Gurzu
gurzu
0
240
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
150
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
62
51k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
220
The Cost Of JavaScript in 2023
addyosmani
55
9.8k
Transcript
Małe co nieco Sequela .BSUB#VEB 536(
Sequel? • Narzędzie do korzystania z relacyjnych baz danych. •
Obsługuje: ADO, Amalgalite, CUBRID, DataObjects, IBM_DB, JDBC, MySQL, Mysql2, ODBC, Oracle, PostgreSQL, SQLAnywhere, SQLite3, Swift oraz TinyTDS. • https://github.com/jeremyevans/sequel • http://sequel.jeremyevans.net
Historia • 1. wersja: 4. marca 2007. • Do tej
pory 168 wydań. • Obecnie 4.22.0 najnowsza. • Na początku każdego miesiąca uaktualnienia. • TL;DR Rozwija się regularnie od ponad 8 lat.
Od czego zacząć? • Od połączenia z bazą danych. •
Można nawiązać więcej niż jedno połączenie. • Obiekt Sequel::Database • Więcej na: http://sequel.jeremyevans.net/rdoc/files/ doc/opening_databases_rdoc.html
Migracje • Podobne do ActiveRecord, zmieniają schemat bazy danych. Dodawanie
tabel, zmiany kolumn, indeksy, itd. itp. • Sequel Migrator odpalany w terminalu: sequel -m path/to/migrations postgres://host/database • Rollback do początku: sequel -m path/to/migrations -M 0 postgres://host/database
Sequel::Dataset • Obiekt reprezentujący zapytania SQL do bazy. • Może
zawierać całą tabele DB[:table_name] • lub wybrany zbiór rekordów DB.from(“table_name”).where(:column => “value”) .order(:another_column).all
Sequel::Model class Example < Sequel::Model(FIRST_DB[:examples]) end class Other < Sequel::Model(SECOND_DB[:others])
end • Model powiązany ze swoim Dataset. • Walidacja: def validate super errors.add(:column, ‘cannot be empty’) if !column || column.empty? end
Pluginy • Rozszerzają możliwości Sequela. • Przykłady: - validation_helpers -
timestamps • Sequel::Model.plugin :timestamps
Testy, testy • DatabaseCleaner: DatabaseCleaner[:sequel, {:connection => Sequel.connect(uri)}] • Sequel.mock
Sequel.mock(:fetch => [ {:column => “value”, :another => “other” }, { :column => “blabla”, :another => “other” } ]) }
Pytania? Uwagi? Spostrzeżenia?
Dziękuję Thank you 㗂㘊㗌㗨㗆 ❤