$30 off During Our Annual Pro Sale. View Details »
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Małe co nieco Sequela
Search
Marta Buda
May 20, 2015
Programming
0
180
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
なあ兄弟、 余白の意味を考えてから UI実装してくれ!
ktcryomm
10
11k
AIコードレビューがチームの"文脈"を 読めるようになるまで
marutaku
0
300
All(?) About Point Sets
hole
0
260
Socio-Technical Evolution: Growing an Architecture and Its Organization for Fast Flow
cer
PRO
0
250
Level up your Gemini CLI - D&D Style!
palladius
1
170
Full-Cycle Reactivity in Angular: SignalStore mit Signal Forms und Resources
manfredsteyer
PRO
0
170
20 years of Symfony, what's next?
fabpot
2
310
Querying Design System デザインシステムの意思決定を支える構造検索
ikumatadokoro
1
1.2k
AIエージェントを活かすPM術 AI駆動開発の現場から
gyuta
0
220
ID管理機能開発の裏側 高速にSaaS連携を実現したチームのAI活用編
atzzcokek
0
180
CSC509 Lecture 14
javiergs
PRO
0
220
dotfiles 式年遷宮 令和最新版
masawada
1
650
Featured
See All Featured
Raft: Consensus for Rubyists
vanstee
140
7.2k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.2k
A Tale of Four Properties
chriscoyier
162
23k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
690
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
960
How STYLIGHT went responsive
nonsquared
100
5.9k
Imperfection Machines: The Place of Print at Facebook
scottboms
269
13k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Visualization
eitanlees
150
16k
The Power of CSS Pseudo Elements
geoffreycrofte
80
6.1k
YesSQL, Process and Tooling at Scale
rocio
174
15k
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 㗂㘊㗌㗨㗆 ❤