(ctx context.Context, db *gosql.DB, count int)
| 146 | } |
| 147 | |
| 148 | func CreateConns(ctx context.Context, db *gosql.DB, count int) ([]*Conn, error) { |
| 149 | conns := make([]*Conn, count) |
| 150 | for i := 0; i < count; i++ { |
| 151 | conn, err := db.Conn(ctx) |
| 152 | if err != nil { |
| 153 | return nil, err |
| 154 | } |
| 155 | |
| 156 | originVal, err := GetSetWaitTimeout(conn) |
| 157 | if err != nil { |
| 158 | g.Logger.Warn("CreateConns. GetSetWaitTimeout. failed. error ignored", "err", err, "originVal", originVal) |
| 159 | } |
| 160 | |
| 161 | _, err = conn.ExecContext(ctx, "SET @@session.foreign_key_checks = 0") |
| 162 | if err != nil { |
| 163 | return nil, err |
| 164 | } |
| 165 | |
| 166 | conns[i] = &Conn{ |
| 167 | DbMutex: &sync.Mutex{}, |
| 168 | Db: conn, |
| 169 | } |
| 170 | } |
| 171 | return conns, nil |
| 172 | } |
| 173 | |
| 174 | // RowToArray is a convenience function, typically not called directly, which maps a |
| 175 | // single read database row into a NullString |
no test coverage detected