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

Rust module API rework #1660

Merged
merged 13 commits into from
Sep 27, 2024
Prev Previous commit
Next Next commit
Port modules to new api
  • Loading branch information
coolreader18 committed Sep 26, 2024
commit aa2e85fe5872f03bc8b07e502e11fdbbce61d34f
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/sdk/examples/cursive-chat/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ fn connect_to_db() {

/// Register subscriptions for all rows of both tables.
fn subscribe_to_tables() {
subscribe(&["SELECT * FROM User;", "SELECT * FROM Message;"]).unwrap();
subscribe(&["SELECT * FROM user;", "SELECT * FROM message;"]).unwrap();
}

// # Construct the user interface
Expand Down
4 changes: 2 additions & 2 deletions crates/sdk/tests/connect_disconnect_client/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fn main() {
sub_applied_one_row_result(check());
});
once_on_connect(move |_, _| {
subscribe_result(subscribe(&["SELECT * FROM Connected;"]));
subscribe_result(subscribe(&["SELECT * FROM connected;"]));
});

connect_result(connect(LOCALHOST, &db_name_or_panic(), None));
Expand Down Expand Up @@ -68,7 +68,7 @@ fn main() {
sub_applied_one_row_result(check());
});
once_on_connect(move |_, _| {
subscribe_result(subscribe(&["SELECT * FROM Disconnected;"]));
subscribe_result(subscribe(&["SELECT * FROM disconnected;"]));
});

connect_result(connect(LOCALHOST, &db_name_or_panic(), Some(credentials().unwrap())));
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

180 changes: 90 additions & 90 deletions crates/sdk/tests/test-client/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,94 +239,94 @@ fn assert_all_tables_empty() -> anyhow::Result<()> {

/// A great big honking query that subscribes to all rows from all tables.
const SUBSCRIBE_ALL: &[&str] = &[
"SELECT * FROM OneU8;",
"SELECT * FROM OneU16;",
"SELECT * FROM OneU32;",
"SELECT * FROM OneU64;",
"SELECT * FROM OneU128;",
"SELECT * FROM OneU256;",
"SELECT * FROM OneI8;",
"SELECT * FROM OneI16;",
"SELECT * FROM OneI32;",
"SELECT * FROM OneI64;",
"SELECT * FROM OneI128;",
"SELECT * FROM OneI256;",
"SELECT * FROM OneBool;",
"SELECT * FROM OneF32;",
"SELECT * FROM OneF64;",
"SELECT * FROM OneString;",
"SELECT * FROM OneIdentity;",
"SELECT * FROM OneAddress;",
"SELECT * FROM OneSimpleEnum;",
"SELECT * FROM OneEnumWithPayload;",
"SELECT * FROM OneUnitStruct;",
"SELECT * FROM OneByteStruct;",
"SELECT * FROM OneEveryPrimitiveStruct;",
"SELECT * FROM OneEveryVecStruct;",
"SELECT * FROM VecU8;",
"SELECT * FROM VecU16;",
"SELECT * FROM VecU32;",
"SELECT * FROM VecU64;",
"SELECT * FROM VecU128;",
"SELECT * FROM VecU256;",
"SELECT * FROM VecI8;",
"SELECT * FROM VecI16;",
"SELECT * FROM VecI32;",
"SELECT * FROM VecI64;",
"SELECT * FROM VecI128;",
"SELECT * FROM VecI256;",
"SELECT * FROM VecBool;",
"SELECT * FROM VecF32;",
"SELECT * FROM VecF64;",
"SELECT * FROM VecString;",
"SELECT * FROM VecIdentity;",
"SELECT * FROM VecAddress;",
"SELECT * FROM VecSimpleEnum;",
"SELECT * FROM VecEnumWithPayload;",
"SELECT * FROM VecUnitStruct;",
"SELECT * FROM VecByteStruct;",
"SELECT * FROM VecEveryPrimitiveStruct;",
"SELECT * FROM VecEveryVecStruct;",
"SELECT * FROM OptionI32;",
"SELECT * FROM OptionString;",
"SELECT * FROM OptionIdentity;",
"SELECT * FROM OptionSimpleEnum;",
"SELECT * FROM OptionEveryPrimitiveStruct;",
"SELECT * FROM OptionVecOptionI32;",
"SELECT * FROM UniqueU8;",
"SELECT * FROM UniqueU16;",
"SELECT * FROM UniqueU32;",
"SELECT * FROM UniqueU64;",
"SELECT * FROM UniqueU128;",
"SELECT * FROM UniqueU256;",
"SELECT * FROM UniqueI8;",
"SELECT * FROM UniqueI16;",
"SELECT * FROM UniqueI32;",
"SELECT * FROM UniqueI64;",
"SELECT * FROM UniqueI128;",
"SELECT * FROM UniqueI256;",
"SELECT * FROM UniqueBool;",
"SELECT * FROM UniqueString;",
"SELECT * FROM UniqueIdentity;",
"SELECT * FROM UniqueAddress;",
"SELECT * FROM PkU8;",
"SELECT * FROM PkU16;",
"SELECT * FROM PkU32;",
"SELECT * FROM PkU64;",
"SELECT * FROM PkU128;",
"SELECT * FROM PkU256;",
"SELECT * FROM PkI8;",
"SELECT * FROM PkI16;",
"SELECT * FROM PkI32;",
"SELECT * FROM PkI64;",
"SELECT * FROM PkI128;",
"SELECT * FROM PkI256;",
"SELECT * FROM PkBool;",
"SELECT * FROM PkString;",
"SELECT * FROM PkIdentity;",
"SELECT * FROM PkAddress;",
"SELECT * FROM LargeTable;",
"SELECT * FROM TableHoldsTable;",
"SELECT * FROM one_u8;",
"SELECT * FROM one_u16;",
"SELECT * FROM one_u32;",
"SELECT * FROM one_u64;",
"SELECT * FROM one_u128;",
"SELECT * FROM one_u256;",
"SELECT * FROM one_i8;",
"SELECT * FROM one_i16;",
"SELECT * FROM one_i32;",
"SELECT * FROM one_i64;",
"SELECT * FROM one_i128;",
"SELECT * FROM one_i256;",
"SELECT * FROM one_bool;",
"SELECT * FROM one_f32;",
"SELECT * FROM one_f64;",
"SELECT * FROM one_string;",
"SELECT * FROM one_identity;",
"SELECT * FROM one_address;",
"SELECT * FROM one_simple_enum;",
"SELECT * FROM one_enum_with_payload;",
"SELECT * FROM one_unit_struct;",
"SELECT * FROM one_byte_struct;",
"SELECT * FROM one_every_primitive_struct;",
"SELECT * FROM one_every_vec_struct;",
"SELECT * FROM vec_u8;",
"SELECT * FROM vec_u16;",
"SELECT * FROM vec_u32;",
"SELECT * FROM vec_u64;",
"SELECT * FROM vec_u128;",
"SELECT * FROM vec_u256;",
"SELECT * FROM vec_i8;",
"SELECT * FROM vec_i16;",
"SELECT * FROM vec_i32;",
"SELECT * FROM vec_i64;",
"SELECT * FROM vec_i128;",
"SELECT * FROM vec_i256;",
"SELECT * FROM vec_bool;",
"SELECT * FROM vec_f32;",
"SELECT * FROM vec_f64;",
"SELECT * FROM vec_string;",
"SELECT * FROM vec_identity;",
"SELECT * FROM vec_address;",
"SELECT * FROM vec_simple_enum;",
"SELECT * FROM vec_enum_with_payload;",
"SELECT * FROM vec_unit_struct;",
"SELECT * FROM vec_byte_struct;",
"SELECT * FROM vec_every_primitive_struct;",
"SELECT * FROM vec_every_vec_struct;",
"SELECT * FROM option_i32;",
"SELECT * FROM option_string;",
"SELECT * FROM option_identity;",
"SELECT * FROM option_simple_enum;",
"SELECT * FROM option_every_primitive_struct;",
"SELECT * FROM option_vec_option_i32;",
"SELECT * FROM unique_u8;",
"SELECT * FROM unique_u16;",
"SELECT * FROM unique_u32;",
"SELECT * FROM unique_u64;",
"SELECT * FROM unique_u128;",
"SELECT * FROM unique_u256;",
"SELECT * FROM unique_i8;",
"SELECT * FROM unique_i16;",
"SELECT * FROM unique_i32;",
"SELECT * FROM unique_i64;",
"SELECT * FROM unique_i128;",
"SELECT * FROM unique_i256;",
"SELECT * FROM unique_bool;",
"SELECT * FROM unique_string;",
"SELECT * FROM unique_identity;",
"SELECT * FROM unique_address;",
"SELECT * FROM pk_u8;",
"SELECT * FROM pk_u16;",
"SELECT * FROM pk_u32;",
"SELECT * FROM pk_u64;",
"SELECT * FROM pk_u128;",
"SELECT * FROM pk_u256;",
"SELECT * FROM pk_i8;",
"SELECT * FROM pk_i16;",
"SELECT * FROM pk_i32;",
"SELECT * FROM pk_i64;",
"SELECT * FROM pk_i128;",
"SELECT * FROM pk_i256;",
"SELECT * FROM pk_bool;",
"SELECT * FROM pk_string;",
"SELECT * FROM pk_identity;",
"SELECT * FROM pk_address;",
"SELECT * FROM large_table;",
"SELECT * FROM table_holds_table;",
];

/// This tests that we can:
Expand Down Expand Up @@ -1387,7 +1387,7 @@ fn exec_resubscribe() {
subscribe_less_result(run_checks());
});
let subscribe_result = test_counter.add_test("resubscribe");
subscribe_result(subscribe(&["SELECT * FROM OneU8 WHERE n > 127"]));
subscribe_result(subscribe(&["SELECT * FROM one_u8 WHERE n > 127"]));
// Wait before continuing, and remove callbacks.
test_counter.wait_for_all();
OneU8::remove_on_delete(on_delete_verify);
Expand Down Expand Up @@ -1417,7 +1417,7 @@ fn exec_resubscribe() {
subscribe_more_result(run_checks());
});
let subscribe_result = test_counter.add_test("resubscribe-again");
subscribe_result(subscribe(&["SELECT * FROM OneU8"]));
subscribe_result(subscribe(&["SELECT * FROM one_u8"]));
test_counter.wait_for_all();
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading