Skip to content

Commit 01aab33

Browse files
authored
Merge pull request #20 from mleduque/typo-get_existsing
handle typo get_existsing/get_existing
2 parents c7ef472 + 8d63344 commit 01aab33

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

chat-demo/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ fn print_all_messages(db: &Database) -> Result<(), Box<dyn std::error::Error>> {
192192
let id = item.get_raw_checked(0)?;
193193
let id = id.as_str()?;
194194
println!("iteration id {}", id);
195-
let doc = db.get_existsing(id)?;
195+
let doc = db.get_existing(id)?;
196196
println!("doc id {}", doc.id());
197197

198198
let db_msg: Message = doc.decode_data()?;
@@ -217,7 +217,7 @@ fn print_external_changes(db: &mut Option<Database>) -> Result<(), Box<dyn std::
217217
}
218218
}
219219
for doc_id in &doc_ids {
220-
let doc = match db.get_existsing(doc_id.as_str()) {
220+
let doc = match db.get_existing(doc_id.as_str()) {
221221
Ok(x) => x,
222222
Err(err) => {
223223
eprintln!("Can not get {}: {}", doc_id, err);

couchbase-lite/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "couchbase-lite"
3-
version = "0.1.0"
3+
version = "0.2.0"
44
authors = ["Evgeniy A. Dushistov <dushistov@mail.ru>"]
55
edition = "2018"
66

couchbase-lite/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
//! while let Some(item) = iter.next()? {
3131
//! let id = item.get_raw_checked(0)?;
3232
//! let id = id.as_str()?;
33-
//! let doc = db.get_existsing(id)?;
33+
//! let doc = db.get_existing(id)?;
3434
//! println!("doc id {}", doc.id());
3535
//! let db_msg: Message = doc.decode_data()?;
3636
//! println!("db_msg: {:?}", db_msg);
@@ -192,12 +192,12 @@ impl Database {
192192
pub fn document_count(&self) -> u64 {
193193
unsafe { c4db_getDocumentCount(self.inner.0.as_ptr()) }
194194
}
195+
195196
/// Return existing document from database
196-
pub fn get_existsing(&self, doc_id: &str) -> Result<Document> {
197+
pub fn get_existing(&self, doc_id: &str) -> Result<Document> {
197198
self.internal_get(doc_id, true)
198199
.map(|x| Document::new_internal(x, doc_id))
199200
}
200-
201201
/// Compiles a query from an expression given as JSON.
202202
/// The expression is a predicate that describes which documents should be returned.
203203
/// A separate, optional sort expression describes the ordering of the results.

couchbase-lite/tests/smoke_tests.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ fn test_write_read() {
5353
}
5454
assert_eq!(ids_and_data.len() as u64, db.document_count());
5555
for (doc_id, foo) in &ids_and_data {
56-
let doc = db.get_existsing(doc_id).unwrap();
56+
let doc = db.get_existing(doc_id).unwrap();
5757
let loaded_foo: Foo = doc.decode_data().unwrap();
5858
assert_eq!(*foo, loaded_foo);
5959
}
@@ -63,15 +63,15 @@ fn test_write_read() {
6363
let mut db = Database::open(&db_path, DatabaseConfig::default()).unwrap();
6464
assert_eq!(ids_and_data.len() as u64, db.document_count());
6565
for (doc_id, foo) in &ids_and_data {
66-
let doc = db.get_existsing(doc_id).unwrap();
66+
let doc = db.get_existing(doc_id).unwrap();
6767
let loaded_foo: Foo = doc.decode_data().unwrap();
6868
assert_eq!(*foo, loaded_foo);
6969
}
7070

7171
{
7272
let mut trans = db.transaction().unwrap();
7373
for (doc_id, foo) in &ids_and_data {
74-
let mut doc = trans.get_existsing(doc_id).unwrap();
74+
let mut doc = trans.get_existing(doc_id).unwrap();
7575
let mut foo_updated = foo.clone();
7676
foo_updated.i += 1;
7777
doc.update_data(&foo_updated).unwrap();
@@ -81,7 +81,7 @@ fn test_write_read() {
8181
}
8282
assert_eq!(ids_and_data.len() as u64, db.document_count());
8383
for (doc_id, foo) in &ids_and_data {
84-
let doc = db.get_existsing(doc_id).unwrap();
84+
let doc = db.get_existing(doc_id).unwrap();
8585
let loaded_foo: Foo = doc.decode_data().unwrap();
8686
assert_eq!(
8787
Foo {
@@ -123,7 +123,7 @@ fn test_write_read() {
123123
{
124124
let mut trans = db.transaction().unwrap();
125125
for doc_id in ids_and_data.iter().take(n).map(|x| x.0.as_str()) {
126-
let mut doc = trans.get_existsing(doc_id).unwrap();
126+
let mut doc = trans.get_existing(doc_id).unwrap();
127127
trans.delete(&mut doc).unwrap();
128128
}
129129
trans.commit().unwrap();
@@ -170,7 +170,7 @@ fn test_observed_changes() {
170170

171171
{
172172
let mut trans = db.transaction().unwrap();
173-
let mut doc = trans.get_existsing(&doc_id).unwrap();
173+
let mut doc = trans.get_existing(&doc_id).unwrap();
174174
trans.delete(&mut doc).unwrap();
175175
trans.commit().unwrap();
176176
}
@@ -182,7 +182,7 @@ fn test_observed_changes() {
182182
assert!(!changes[0].external());
183183
assert_eq!(2, changes[0].body_size());
184184

185-
let doc = db.get_existsing(&doc_id).unwrap();
185+
let doc = db.get_existing(&doc_id).unwrap();
186186
println!("doc {:?}", doc);
187187
doc.decode_data::<Empty>().unwrap();
188188
}
@@ -208,7 +208,7 @@ fn test_save_float() {
208208
let doc_id: String = doc.id().into();
209209
drop(doc);
210210

211-
let doc = db.get_existsing(&doc_id).unwrap();
211+
let doc = db.get_existing(&doc_id).unwrap();
212212
let loaded_s: S = doc.decode_data().unwrap();
213213
assert_eq!(s, loaded_s);
214214
}
@@ -238,7 +238,7 @@ fn test_save_several_times() {
238238
drop(doc);
239239
assert_eq!(1, db.document_count());
240240

241-
let doc = db.get_existsing(&doc_id).unwrap();
241+
let doc = db.get_existing(&doc_id).unwrap();
242242
assert_eq!(s, doc.decode_data::<S>().unwrap());
243243

244244
let s = create_s(501);
@@ -249,7 +249,7 @@ fn test_save_several_times() {
249249
drop(doc);
250250
assert_eq!(1, db.document_count());
251251

252-
let doc = db.get_existsing(&doc_id).unwrap();
252+
let doc = db.get_existing(&doc_id).unwrap();
253253
assert_eq!(s, doc.decode_data::<S>().unwrap());
254254

255255
let s = create_s(400);
@@ -261,7 +261,7 @@ fn test_save_several_times() {
261261
drop(doc);
262262
assert_eq!(1, db.document_count());
263263

264-
let doc = db.get_existsing(&doc_id).unwrap();
264+
let doc = db.get_existing(&doc_id).unwrap();
265265
assert_eq!(s, doc.decode_data::<S>().unwrap());
266266
}
267267
tmp_dir.close().expect("Can not close tmp_dir");
@@ -324,7 +324,7 @@ fn test_indices() {
324324
let id = item.get_raw_checked(0).unwrap();
325325
let id = id.as_str().unwrap();
326326
println!("iteration id {}", id);
327-
let doc = db.get_existsing(id).unwrap();
327+
let doc = db.get_existing(id).unwrap();
328328
println!("doc id {}", doc.id());
329329

330330
let foo: Foo = doc.decode_data().unwrap();

0 commit comments

Comments
 (0)