feat:multi cluster application

This commit is contained in:
pengcong06
2020-05-25 22:38:03 +08:00
parent d4b7d88b4b
commit 59839439d5
73 changed files with 9838 additions and 6278 deletions

View File

@@ -61,9 +61,11 @@ func FromContext(ctx context.Context) (*Database, bool) {
func (db *Database) New(ctx context.Context) *Conn {
actualDb, ok := FromContext(ctx)
conn := db.Conn
if ok {
var conn *dbr.Connection
if ok || db == nil {
conn = actualDb.Conn
} else {
conn = db.Conn
}
return &Conn{
Session: conn.NewSession(&EventReceiver{ctx}),