Query A DATETIME Field In MySQL With Rust's Diesel Crate
Note
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.
Code
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:
Code
[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
Code
CREATE TABLE test2 (
id INT PRIMARY KEY,
datetime DATETIME
)
Code
use establish_connection;
use *;
use *;
use *;
Code
use *;
use dotenv;
use env;