feat: Create a strong DocumentId type

Forcing it to be something internal will permit to avoid possible miss comparisons to be done with other types.
This commit is contained in:
Clément Renault 2018-12-22 12:00:24 +01:00
parent a756ca5e3f
commit 4ebae7784c
No known key found for this signature in database
GPG key ID: 0151CDAB43460DAE
9 changed files with 46 additions and 29 deletions

View file

@ -10,6 +10,7 @@ use meilidb::database::schema::{Schema, SchemaBuilder, STORED, INDEXED};
use meilidb::database::update::PositiveUpdateBuilder;
use meilidb::tokenizer::DefaultBuilder;
use meilidb::database::Database;
use meilidb::DocumentId;
#[derive(Debug, StructOpt)]
pub struct Opt {
@ -67,7 +68,7 @@ fn index(schema: Schema, database_path: &Path, csv_data_path: &Path) -> Result<D
}
};
let document_id = calculate_hash(&document.id);
let document_id = DocumentId(calculate_hash(&document.id));
update.update(document_id, &document).unwrap();
}