You've already forked OpenIntegrations
mirror of
https://github.com/Bayselonarrend/OpenIntegrations.git
synced 2025-08-10 22:41:43 +02:00
Update methods.rs
This commit is contained in:
@@ -1,16 +1,4 @@
|
|||||||
use addin1c::{Variant};
|
use mongodb::{Client, Collection, options::ClientOptions, bson::{doc, Document}};
|
||||||
use crate::component::AddIn;
|
|
||||||
use mongodb::{Client, Collection, options::ClientOptions, bson::{doc, Bson, Document}};
|
|
||||||
use std::error::Error;
|
|
||||||
|
|
||||||
pub fn amount(obj: &AddIn, params: &mut [Variant]) -> i32 {
|
|
||||||
|
|
||||||
let result = params[0].get_i32().unwrap() + params[1].get_i32().unwrap();
|
|
||||||
params[0].set_i32(999);
|
|
||||||
|
|
||||||
result
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct MongoClient {
|
pub struct MongoClient {
|
||||||
client: Client,
|
client: Client,
|
||||||
@@ -68,7 +56,7 @@ impl MongoClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Синхронный метод для проверки наличия документа, возвращающий булевый результат
|
// Синхронный метод для проверки наличия документа, возвращающий булево результат
|
||||||
pub fn document_exists(&self, db_name: &str, collection_name: &str, query: &str) -> bool {
|
pub fn document_exists(&self, db_name: &str, collection_name: &str, query: &str) -> bool {
|
||||||
|
|
||||||
let collection: Collection<Document> = self.client.database(db_name).collection(collection_name);
|
let collection: Collection<Document> = self.client.database(db_name).collection(collection_name);
|
||||||
|
Reference in New Issue
Block a user