Add docs for DB::Database#setup_connection (#139)
This commit is contained in:
parent
bd45602864
commit
eaddae7d71
|
@ -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 New Issue