New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using DateTime in postgres insertable #294

Closed
Cottonwoods opened this Issue Apr 21, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@Cottonwoods

Cottonwoods commented Apr 21, 2016

Hey grif, me again. Could not find a private message feature, so this is the next best thing. I'm trying to use chrono after seeing the earlier changes you & tomhoule made, but get an error when doing so. Can not find any documentation in regards to the chrono feature, so I'm hoping you can help me make sense of this:

error: mismatched types:
 expected `diesel::expression::bound::Bound<diesel::types::Timestamp, &chrono::DateTime<chrono::UTC>>`,
    found `&chrono::DateTime<chrono::UTC>`
(expected struct `diesel::expression::bound::Bound`,
    found &-ptr) [E0308]

The relevant model.rs is:

#[macro_use]
extern crate chrono;

use chrono::{DateTime, UTC, Local, TimeZone};

#[derive(Queryable)]
pub struct User {
    pub id: i32,
    pub name: String,
    pub login: String,
    pub avatar: String,
    pub admin: bool,
    pub created_at: DateTime<UTC>,
    pub updated_at: DateTime<UTC>
}

use super::schema::users;

#[insertable_into(users)]
pub struct NewUser<'a> {
    pub name: &'a str,
    pub login: &'a str,
    pub created_at: DateTime<UTC>,
    pub updated_at: DateTime<UTC>
}

Any advice is appreciated, thanks

@sgrif

This comment has been minimized.

Member

sgrif commented Apr 22, 2016

Right now the correct type to use is NaiveDateTime, as we don't treat timestamp and timestamptz as separate types yet.

@sgrif sgrif closed this Apr 22, 2016

@sgrif

This comment has been minimized.

Member

sgrif commented Apr 22, 2016

I've opened #295 to address this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment