We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
var document: YDocument! var map: YMap<TestType>! override func setUp() { document = YDocument() map = document.getOrCreateMap(named: "test") } override func tearDown() { document = nil map = nil } func test_insert() { let initialInstance = TestType(name: "Aidar", age: 24) let secondInstance = TestType(name: "Joe", age: 55) // the map looks like an array? XCTAssertEqual(map.length(), 0) map[initialInstance.name] = initialInstance map[secondInstance.name] = secondInstance XCTAssertEqual(map.length(), 2) let finalInstance = map.get(key: initialInstance.name) XCTAssertEqual(initialInstance, finalInstance) let contains = map.containsKey(secondInstance.name) XCTAssertTrue(contains) }
use yrs::{any, Array, ArrayPrelim, Doc, In, JsonPath, JsonPathEval, Map, MapPrelim, Out, Transact, WriteTxn}; let doc = Doc::new(); let mut txn = doc.transact_mut(); let users = txn.get_or_insert_array("users"); // here is a map in an array users.insert(&mut txn, 0, MapPrelim::from([ ("name".to_string(), In::Any(any!("Alice"))), ("surname".into(), In::Any(any!("Smith"))), ("age".into(), In::Any(any!(25))), ( "friends".into(), In::from(ArrayPrelim::from([ any!({ "name": "Bob", "nick": "boreas" }), any!({ "nick": "crocodile91" }), ])), ), ]));
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Swift
Rust
The text was updated successfully, but these errors were encountered: