-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(electric): Add support for BOOLEAN data type in electrified tabl…
- Loading branch information
1 parent
33ed7e8
commit cf4ee7c
Showing
9 changed files
with
197 additions
and
11 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,5 @@ | ||
--- | ||
"@core/electric": patch | ||
--- | ||
|
||
Implement support for the BOOLEAN column type in electrified tables |
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
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
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,72 @@ | ||
[doc NodeJS Satellite correctly syncs BOOL values from and to Electric] | ||
[include _shared.luxinc] | ||
[include _satellite_macros.luxinc] | ||
|
||
[invoke setup] | ||
|
||
[shell pg_1] | ||
[local sql= | ||
""" | ||
CREATE TABLE public.bools ( | ||
id TEXT PRIMARY KEY DEFAULT uuid_generate_v4(), | ||
b BOOLEAN | ||
); | ||
CALL electric.electrify('public.bools'); | ||
"""] | ||
[invoke migrate_pg 20230908 $sql] | ||
|
||
[invoke setup_client 1 electric_1 5133] | ||
|
||
[shell satellite_1] | ||
[invoke node_await_table "bools"] | ||
[invoke node_sync_table "bools"] | ||
|
||
[shell pg_1] | ||
!INSERT INTO public.bools (id, b) VALUES ('001', true), ('002', false), ('003', NULL); | ||
??INSERT 0 3 | ||
|
||
[shell satellite_1] | ||
[invoke node_await_get_from_table "bools" "003"] | ||
|
||
??id: '001' | ||
??b: 1 | ||
|
||
??id: '002' | ||
??b: 0 | ||
|
||
??id: '003' | ||
??b: null | ||
|
||
[invoke node_await_insert_extended_into "bools" "{id: '004', b: 1}"] | ||
|
||
[shell pg_1] | ||
[invoke wait-for "SELECT * FROM public.bools;" "004" 10 $psql] | ||
|
||
!SELECT * FROM public.bools; | ||
??001 | t | ||
??002 | f | ||
??003 | <NULL> | ||
??004 | t | ||
|
||
# Start a new Satellite client and verify that it receives all rows | ||
[invoke setup_client 2 electric_1 5133] | ||
|
||
[shell satellite_2] | ||
[invoke node_await_table "bools"] | ||
[invoke node_sync_table "bools"] | ||
|
||
[invoke node_await_get_from_table "bools" "004"] | ||
??id: '001' | ||
??b: 1 | ||
|
||
??id: '002' | ||
??b: 0 | ||
|
||
??id: '003' | ||
??b: null | ||
|
||
??id: '004' | ||
??b: 1 | ||
|
||
[cleanup] | ||
[invoke teardown] |