mirror of
https://gitea.invidious.io/iv-org/shard-crystal-db.git
synced 2024-08-15 00:53:32 +00:00
Add docs for DB::Database#setup_connection (#139)
This commit is contained in:
parent
bd45602864
commit
eaddae7d71
1 changed files with 9 additions and 0 deletions
|
@ -61,6 +61,15 @@ module DB
|
|||
}
|
||||
end
|
||||
|
||||
# Run the specified block every time a new connection is established, yielding the new connection
|
||||
# to the block.
|
||||
#
|
||||
# ```
|
||||
# db = DB.open(DB_URL)
|
||||
# db.setup_connection do |connection|
|
||||
# connection.exec "SET TIME ZONE 'America/New_York'"
|
||||
# end
|
||||
# ```
|
||||
def setup_connection(&proc : Connection -> Nil)
|
||||
@setup_connection = proc
|
||||
@pool.each_resource do |conn|
|
||||
|
|
Loading…
Reference in a new issue