| 217 | } |
| 218 | |
| 219 | func setDefaultQueryExecMode(config *pgx.ConnConfig) { |
| 220 | // Default mode if no specific mode is found in the connection string |
| 221 | defaultMode := "cache_statement" |
| 222 | |
| 223 | // Iterate through the map keys to check if any are mentioned in the connection string |
| 224 | for key := range queryExecModes { |
| 225 | if strings.Contains(config.ConnString(), "default_query_exec_mode="+key) { |
| 226 | config.DefaultQueryExecMode = queryExecModes[key] |
| 227 | slog.Info("setDefaultQueryExecMode", slog.String("mode", key)) |
| 228 | return |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | // Set to default mode if no matching mode is found |
| 233 | config.DefaultQueryExecMode = queryExecModes[defaultMode] |
| 234 | slog.Warn("setDefaultQueryExecMode", slog.String("mode", defaultMode)) |
| 235 | } |
| 236 | |
| 237 | var planCacheModes = map[string]string{ |
| 238 | "auto": "auto", |