zero4rs 2.0.0

zero4rs is a powerful, pragmatic, and extremely fast web framework for Rust
Documentation
use lazy_static::lazy_static;

use serde_json::json;

use crate::core::mongo;

lazy_static! {
    pub static ref CHAT_MESSAGE_DB: &'static str = "chat_message_db";
    pub static ref CHAT_MESSAGE_COL: &'static str = "t_chat_messages";
}

// use crate::core::error2::Error;
use crate::core::error2::Result;

pub async fn save_chat_message(client: &mongo::MongoClient, msg: &str) -> Result<String> {
    let now = chrono::Utc::now().timestamp_millis();

    log::info!("save_chat_message: msg={}, now={}", msg, now);

    client
        .insert_one(
            *CHAT_MESSAGE_DB,
            *CHAT_MESSAGE_COL,
            json!({"msg": msg, "time": now}),
        )
        .await
}