Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed deprecated size and change connection security protocol #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/Statement/CreateConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,14 @@ private function __construct(string $name, string $definition)
public static function kafka(string $name, string ...$brokers): self
{
if (count($brokers) > 1) {
$definition = sprintf('KAFKA (BROKERS (%s))', implode(', ', array_map(static function (string $dsn) {
return sprintf('\'%s\'', $dsn);
}, $brokers)));
$definition = sprintf(
"KAFKA (BROKERS (%s), SECURITY PROTOCOL = 'PLAINTEXT')",
implode(', ', array_map(static function (string $dsn) {
return sprintf('\'%s\'', $dsn);
}, $brokers))
);
} else {
$definition = sprintf('KAFKA (BROKER \'%s\')', current($brokers));
$definition = sprintf("KAFKA (BROKER '%s', SECURITY PROTOCOL = 'PLAINTEXT')", current($brokers));
}

return new self($name, $definition);
Expand Down
4 changes: 2 additions & 2 deletions src/Statement/CreateSink.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ public function __toString(): string
$query .= ' IF NOT EXISTS';
}

$query .= ' %s FROM %s INTO %s WITH (SIZE = \'%s\')';
$query .= ' %s FROM %s INTO %s';

return sprintf($query, $this->name, $this->from, $this->definition, $this->size);
return sprintf($query, $this->name, $this->from, $this->definition);
}
}
21 changes: 2 additions & 19 deletions src/Statement/CreateSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ class CreateSource implements Command
*/
private $definition;

/**
* @var string
*/
private $size = '1';

/**
* @var bool
*/
Expand Down Expand Up @@ -71,18 +66,6 @@ public static function postgres(string $name, string $connection, string $public
return new self($name, $definition);
}

/**
* @param string $size
*
* @return self
*/
public function size(string $size): self
{
$this->size = $size;

return $this;
}

/**
* @return self
*/
Expand All @@ -106,8 +89,8 @@ public function __toString(): string
$query .= ' IF NOT EXISTS';
}

$query .= ' %s FROM %s WITH (SIZE = \'%s\')';
$query .= ' %s FROM %s';

return sprintf($query, $this->name, $this->definition, $this->size);
return sprintf($query, $this->name, $this->definition);
}
}