-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added validator for config, callback example added
- Loading branch information
Showing
9 changed files
with
149 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
error_reporting(E_ALL); | ||
ini_set('display_errors', 1); | ||
date_default_timezone_set('UTC'); | ||
include __DIR__ . '/../vendor/autoload.php'; | ||
|
||
use MySQLReplication\Event\DTO\DeleteRowsDTO; | ||
use MySQLReplication\Event\DTO\EventDTO; | ||
use MySQLReplication\Event\DTO\GTIDLogDTO; | ||
use MySQLReplication\Event\DTO\QueryDTO; | ||
use MySQLReplication\Event\DTO\RotateDTO; | ||
use MySQLReplication\Event\DTO\TableMapDTO; | ||
use MySQLReplication\Event\DTO\UpdateRowsDTO; | ||
use MySQLReplication\Event\DTO\WriteRowsDTO; | ||
use MySQLReplication\Event\DTO\XidDTO; | ||
use MySQLReplication\MySQLReplicationFactory; | ||
use MySQLReplication\Config\ConfigService; | ||
|
||
$binLogStream = new MySQLReplicationFactory( | ||
(new ConfigService())->makeConfigFromArray([ | ||
'user' => 'root', | ||
'ip' => '192.168.1.100', | ||
'password' => 'root' | ||
]) | ||
); | ||
|
||
$binLogStream->parseBinLogUsingCallback(function($event) | ||
{ | ||
/** @var DeleteRowsDTO|EventDTO|GTIDLogDTO|QueryDTO|RotateDTO|TableMapDTO|UpdateRowsDTO|WriteRowsDTO|XidDTO $event */ | ||
echo $event; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...yDataReader/BinaryDataReaderException.php → ...r/Exception/BinaryDataReaderException.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace MySQLReplication\Config\Exception; | ||
|
||
use MySQLReplication\Exception\MySQLReplicationException; | ||
|
||
class ConfigException extends MySQLReplicationException | ||
{ | ||
const USER_ERROR_MESSAGE = 'Incorrect user given'; | ||
const USER_ERROR_CODE = 1; | ||
const IP_ERROR_MESSAGE = 'Incorrect IP given'; | ||
const IP_ERROR_CODE = 2; | ||
const PORT_ERROR_MESSAGE = 'Incorrect port given should be numeric '; | ||
const PORT_ERROR_CODE = 3; | ||
const PASSWORD_ERROR_MESSAGE = 'Incorrect password type'; | ||
const PASSWORD_ERROR_CODE = 4; | ||
const DB_NAME_ERROR_MESSAGE = 'Incorrect db name type'; | ||
const DB_NAME_ERROR_CODE = 5; | ||
const CHARSET_ERROR_MESSAGE = 'Incorrect charset type'; | ||
const CHARSET_ERROR_CODE = 6; | ||
const GTID_ERROR_MESSAGE = 'Incorrect gtid'; | ||
const GTID_ERROR_CODE = 7; | ||
const SLAVE_ID_ERROR_MESSAGE = 'Incorrect slave id type'; | ||
const SLAVE_ID_ERROR_CODE = 8; | ||
const BIN_LOG_FILE_NAME_ERROR_MESSAGE = 'Incorrect binlog name type'; | ||
const BIN_LOG_FILE_NAME_ERROR_CODE = 9; | ||
const BIN_LOG_FILE_POSITION_ERROR_MESSAGE = 'Incorrect binlog position type'; | ||
const BIN_LOG_FILE_POSITION_ERROR_CODE = 10; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters