@vlasky/zongji 0.6.1 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,27 +0,0 @@
1
- class ComBinlog {
2
- constructor({ serverId, nonBlock, filename, position }) {
3
- this.command = 0x12;
4
- this.position = position || 4;
5
-
6
- // will send eof package if there is no more binlog event
7
- // https://dev.mysql.com/doc/internals/en/com-binlog-dump.html#binlog-dump-non-block
8
- this.flags = nonBlock ? 1 : 0;
9
-
10
- this.serverId = serverId || 1;
11
- this.filename = filename || '';
12
- }
13
-
14
- write(writer) {
15
- writer.writeUnsignedNumber(1, this.command);
16
- writer.writeUnsignedNumber(4, this.position);
17
- writer.writeUnsignedNumber(2, this.flags);
18
- writer.writeUnsignedNumber(4, this.serverId);
19
- writer.writeNullTerminatedString(this.filename);
20
- }
21
-
22
- parse() {
23
- throw new Error('should never be called here');
24
- }
25
- }
26
-
27
- export default ComBinlog;
@@ -1,66 +0,0 @@
1
- import ComBinlog from './combinlog.js';
2
- import initBinlogPacketClass from './binlog.js';
3
-
4
- // from npm package mysql
5
- class EofPacket {
6
- constructor(options = {}) {
7
- this.fieldCount = undefined;
8
- this.warningCount = options.warningCount;
9
- this.serverStatus = options.serverStatus;
10
- this.protocol41 = options.protocol41;
11
- }
12
-
13
- parse(parser) {
14
- this.fieldCount = parser.parseUnsignedNumber(1);
15
- if (this.protocol41) {
16
- this.warningCount = parser.parseUnsignedNumber(2);
17
- this.serverStatus = parser.parseUnsignedNumber(2);
18
- }
19
- }
20
-
21
- write(writer) {
22
- writer.writeUnsignedNumber(1, 0xfe);
23
- if (this.protocol41) {
24
- writer.writeUnsignedNumber(2, this.warningCount);
25
- writer.writeUnsignedNumber(2, this.serverStatus);
26
- }
27
- }
28
- }
29
-
30
- // from npm package mysql
31
- class ErrorPacket {
32
- constructor(options = {}) {
33
- this.fieldCount = options.fieldCount;
34
- this.errno = options.errno;
35
- this.sqlStateMarker = options.sqlStateMarker;
36
- this.sqlState = options.sqlState;
37
- this.message = options.message;
38
- }
39
-
40
- parse(parser) {
41
- this.fieldCount = parser.parseUnsignedNumber(1);
42
- this.errno = parser.parseUnsignedNumber(2);
43
-
44
- // sqlStateMarker ('#' = 0x23) indicates error packet format
45
- if (parser.peak() === 0x23) {
46
- this.sqlStateMarker = parser.parseString(1);
47
- this.sqlState = parser.parseString(5);
48
- }
49
-
50
- this.message = parser.parsePacketTerminatedString();
51
- }
52
-
53
- write(writer) {
54
- writer.writeUnsignedNumber(1, 0xff);
55
- writer.writeUnsignedNumber(2, this.errno);
56
-
57
- if (this.sqlStateMarker) {
58
- writer.writeString(this.sqlStateMarker);
59
- writer.writeString(this.sqlState);
60
- }
61
-
62
- writer.writeString(this.message);
63
- }
64
- }
65
-
66
- export { EofPacket, ErrorPacket, ComBinlog, initBinlogPacketClass };
@@ -1,28 +0,0 @@
1
- #!/bin/bash
2
- # Start MySQL Docker containers for testing
3
- # Skips MySQL 5.7 on ARM64 (Apple Silicon) as no image is available
4
-
5
- if [ "$(uname -m)" = "arm64" ]; then
6
- SERVICES="mysql80 mysql84"
7
- else
8
- SERVICES="mysql57 mysql80 mysql84"
9
- fi
10
-
11
- docker-compose up -d $SERVICES
12
-
13
- # Wait for MySQL to be ready
14
- for service in $SERVICES; do
15
- container="zongji-${service}-1"
16
- echo -n "Waiting for ${service}..."
17
- for i in $(seq 1 30); do
18
- if docker exec "$container" mysqladmin ping -u root -psecret --silent 2>/dev/null; then
19
- echo " ready"
20
- break
21
- fi
22
- if [ "$i" -eq 30 ]; then
23
- echo " timed out"
24
- exit 1
25
- fi
26
- sleep 2
27
- done
28
- done