mirror of
https://github.com/nghialt/xun.git
synced 2025-12-24 13:18:14 +08:00
28 lines
439 B
Go
28 lines
439 B
Go
package capsule
|
|
|
|
import (
|
|
"sync"
|
|
|
|
"github.com/jmoiron/sqlx"
|
|
"github.com/yaoapp/xun/dbal"
|
|
)
|
|
|
|
// Manager The database manager
|
|
type Manager struct {
|
|
Pool *Pool
|
|
Connections *sync.Map // map[string]*Connection
|
|
Option *dbal.Option
|
|
}
|
|
|
|
// Pool the connection pool
|
|
type Pool struct {
|
|
Primary []*Connection
|
|
Readonly []*Connection
|
|
}
|
|
|
|
// Connection The database connection
|
|
type Connection struct {
|
|
sqlx.DB
|
|
Config *dbal.Config
|
|
}
|