func (cfg Config) validate(db *sql.DB) error {
	switch {
	case db == nil:
		return fmt.Errorf("database required")
	case cfg.QueryPeriod <= 0:
		return fmt.Errorf("positive idle period required")
	}
	return nil
}
// validate ensures the configuration and parameters have no errors.
validate ensures the configuration and parameters have no errors.
// validate ensures the configuration and parameters have no errors .
func (cfg Config) validate(db *sql.DB) error {
	switch {
	case db == nil:
		return fmt.Errorf("database required")
	case cfg.QueryPeriod <= 0:
		return fmt.Errorf("positive idle period required")
	}
	return nil
}
func ( cfg Config ) validate ( db * sql . DB ) error { switch { case db == nil : return fmt . Errorf ( " " ) case cfg . QueryPeriod <= 0 : return fmt . Errorf ( " " ) } return nil }
validate ensures the configuration and parameters have no errors.
validate ensures the configuration and parameters have no errors .