@@ -185,7 +185,7 @@ At this point, you should know a bit about developping database drivers in Go. O
## database/sql
databse/sql defines even more high-level methods on top of database/sql/driver for more convenient database operations, and it suggests that you implement a connection pool.
database/sql defines even more high-level methods on top of database/sql/driver for more convenient database operations, and it suggests that you implement a connection pool.
@@ -13,7 +13,7 @@ There are a couple of drivers that support MySQL in Go. Some of them implement t
I'll use the first driver in the following examples (I use this one in my personal projects too), and I also recommend that you use it for the following reasons:
- It's a new database driver and supports more features.
@@ -185,7 +185,7 @@ At this point, you should know a bit about developping database drivers in Go. O
## database/sql
databse/sql defines even more high-level methods on top of database/sql/driver for more convenient database operations, and it suggests that you implement a connection pool.
database/sql defines even more high-level methods on top of database/sql/driver for more convenient database operations, and it suggests that you implement a connection pool.
@@ -13,7 +13,7 @@ There are a couple of drivers that support MySQL in Go. Some of them implement t
I'll use the first driver in the following examples (I use this one in my personal projects too), and I also recommend that you use it for the following reasons:
- It's a new database driver and supports more features.
Мы видим, что все сторонние драйвера вызывают данную функцию для саморегистрации. При этом Go использует карту для сохранения информации о пользовательском драйвере внутри `databse/sql`.
Мы видим, что все сторонние драйвера вызывают данную функцию для саморегистрации. При этом Go использует карту для сохранения информации о пользовательском драйвере внутри `database/sql`.
var drivers = make(map[string]driver.Driver)
...
...
@@ -185,7 +185,7 @@ driver.Rows - это интерфейс для возвращения резул
## database/sql
`databse/sql` определяет высокоуровневые методы для более удобной работы с базами данных (выше чем драйвера) и предлагает вам реализовать пул соединений.
`database/sql` определяет высокоуровневые методы для более удобной работы с базами данных (выше чем драйвера) и предлагает вам реализовать пул соединений.
Я буду использовать первый драйвер в моих будущих примерах (в моих проекта я тоже использую его). Я рекомендую вам использовать его по следующим причинам:
- Это новый драйвер базы данных и он предоставляет множество возможностей.
- Полностью поддерживает стандарты интерфейса `databse/sql`.
- Полностью поддерживает стандарты интерфейса `database/sql`.
- Поддерживает постоянное соединение между потоками.