(connName string)
| 1095 | } |
| 1096 | |
| 1097 | func IsConnected(connName string) (bool, error) { |
| 1098 | if IsLocalConnName(connName) { |
| 1099 | return true, nil |
| 1100 | } |
| 1101 | connOpts, err := remote.ParseOpts(connName) |
| 1102 | if err != nil { |
| 1103 | return false, fmt.Errorf("error parsing connection name: %w", err) |
| 1104 | } |
| 1105 | conn := getConnInternal(connOpts, false) |
| 1106 | if conn == nil { |
| 1107 | return false, nil |
| 1108 | } |
| 1109 | return conn.GetStatus() == Status_Connected, nil |
| 1110 | } |
| 1111 | |
| 1112 | // Convenience function for ensuring a connection is established |
| 1113 | func EnsureConnection(ctx context.Context, connName string) error { |
no test coverage detected