Query A DATETIME Field In MySQL With Rust's Diesel Crate
These are scratch notes with code snippets showing what I did to get a datetime working. The model is up top with the other stuff below.
use NaiveDateTime;
use *;
chrono crate
The chrono crate is used behind the scenes. It has to be added to Cargo.toml and the feature turned on for diesel. Mine looks like this:
[dependencies]
chrono = "0.4.24"
diesel = { version = "2.0.0", features = ["mysql", "serde_json", "chrono"] }
dotenvy = "0.15"
Other Stuff
This is the other stuff that uses the code
INT PRIMARY KEY,
datetime DATETIME
) (
id
use establish_connection;
use *;
use *;
use *;
use *;
use dotenv;
use env;
-- end of line --