Clone returns a cloned db.Session session.
()
| 130 | |
| 131 | // Clone returns a cloned db.Session session. |
| 132 | func (s *Source) Clone() (db.Session, error) { |
| 133 | clone := &Source{ |
| 134 | Settings: db.NewSettings(), |
| 135 | |
| 136 | name: s.name, |
| 137 | connURL: s.connURL, |
| 138 | version: s.version, |
| 139 | collections: map[string]*Collection{}, |
| 140 | } |
| 141 | |
| 142 | if err := clone.open(); err != nil { |
| 143 | return nil, err |
| 144 | } |
| 145 | |
| 146 | return clone, nil |
| 147 | } |
| 148 | |
| 149 | // Ping checks whether a connection to the database is still alive by pinging |
| 150 | // it, establishing a connection if necessary. |