2017-04-13 20:48:32 +00:00
|
|
|
package connutil
|
|
|
|
|
|
|
|
import (
|
2017-12-14 22:03:11 +00:00
|
|
|
"context"
|
2017-04-13 20:48:32 +00:00
|
|
|
"errors"
|
|
|
|
"sync"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2017-05-11 21:38:54 +00:00
|
|
|
ErrNotInitialized = errors.New("connection has not been initalized")
|
2017-04-13 20:48:32 +00:00
|
|
|
)
|
|
|
|
|
2017-04-24 20:59:12 +00:00
|
|
|
// ConnectionProducer can be used as an embeded interface in the Database
|
2017-04-13 20:48:32 +00:00
|
|
|
// definition. It implements the methods dealing with individual database
|
|
|
|
// connections and is used in all the builtin database types.
|
|
|
|
type ConnectionProducer interface {
|
|
|
|
Close() error
|
2017-12-14 22:03:11 +00:00
|
|
|
Initialize(context.Context, map[string]interface{}, bool) error
|
|
|
|
Connection(context.Context) (interface{}, error)
|
2017-04-13 20:48:32 +00:00
|
|
|
|
|
|
|
sync.Locker
|
|
|
|
}
|