Skip to content

Instantly share code, notes, and snippets.

@MarkJr94
Created May 15, 2017 23:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MarkJr94/e672e73f18839c93223f7687c3a0525b to your computer and use it in GitHub Desktop.
Save MarkJr94/e672e73f18839c93223f7687c3a0525b to your computer and use it in GitHub Desktop.
problem with diesel and custom enum
#[derive(PartialEq, Eq, Debug, Clone, Insertable)]
#[table_name="orders"]
pub struct NewOrder {
pub id: i32,
pub account_id: Option<i32>,
pub side: Side,
pub instrument_id: i32,
pub price: u32,
pub num_shares: u32,
pub stamp: DateTime<UTC>,
pub rank: u32,
}
#[derive(PartialEq, Eq, Debug, Clone)]
pub enum Side {
Ask,
Bid,
}
impl Side {
pub fn to_rep(&self) -> &'static str {
match *self {
Side::Bid => "b",
Side::Ask => "a",
}
}
pub fn from_rep(s: &str) -> Result<Side> {
match s {
"a" | "yes" | "y" => Ok(Side::Ask),
"b" | "no" | "n" => Ok(Side::Bid),
_ => Err(ErrorKind::BadJson("bad side".into()).into()),
}
}
pub fn from_int(i: i32) -> Side {
if i == 0 { Side::Bid } else { Side::Ask }
}
}
impl<'a> AsExpression<Integer> for Side {
type Expression = expression::helper_types::AsExprOf<i32, Integer>;
fn as_expression(self) -> Self::Expression {
AsExpression::<Integer>::as_expression(self as i32)
}
}
impl<DB: Backend<RawValue=[u8]> + HasSqlType<Integer>> FromSqlRow<Integer, DB> for Side {
fn build_from_row<T: Row<DB>>(row: &mut T) -> ::std::result::Result<Self, Box<StdErr + Send + Sync>> {
let i = i32::build_from_row(row)?;
Ok(Side::from_int(i))
}
}
error[E0277]: the trait bound `data::order::Side: diesel::Expression` is not satisfied
--> src/data/order.rs:31:39
|
31 | #[derive(PartialEq, Eq, Debug, Clone, Insertable)]
| ^^^^^^^^^^ the trait `diesel::Expression` is not implemented for `data::order::Side`
|
= note: required because of the requirements on the impl of `diesel::Expression` for `&'insert data::order::Side`
= note: required because of the requirements on the impl of `diesel::expression::AsExpression<diesel::types::Nullable<diesel::types::Integer>>` for `&'insert data::order::Side`
= note: this error originates in a macro outside of the current crate
error[E0277]: the trait bound `u32: diesel::Expression` is not satisfied
--> src/data/order.rs:31:39
|
31 | #[derive(PartialEq, Eq, Debug, Clone, Insertable)]
| ^^^^^^^^^^ the trait `diesel::Expression` is not implemented for `u32`
|
= note: required because of the requirements on the impl of `diesel::Expression` for `&'insert u32`
= note: required because of the requirements on the impl of `diesel::expression::AsExpression<diesel::types::Nullable<diesel::types::Integer>>` for `&'insert u32`
= note: this error originates in a macro outside of the current crate
error[E0277]: the trait bound `&'insert data::order::NewOrder: diesel::Insertable<schema::__diesel_infer_schema::infer_orders::orders::table, DB>` is not satisfied
--> src/data/order.rs:31:39
|
31 | #[derive(PartialEq, Eq, Debug, Clone, Insertable)]
| ^^^^^^^^^^ the trait `diesel::Insertable<schema::__diesel_infer_schema::infer_orders::orders::table, DB>` is not implemented for `&'insert data::order::NewOrder`
|
= help: the following implementations were found:
<&'insert data::order::NewOrder as diesel::Insertable<schema::__diesel_infer_schema::infer_orders::orders::table, DB>>
= note: required by `diesel::Insertable`
= note: this error originates in a macro outside of the current crate
error[E0277]: the trait bound `data::order::Side: diesel::Expression` is not satisfied
--> src/data/order.rs:31:39
|
31 | #[derive(PartialEq, Eq, Debug, Clone, Insertable)]
| ^^^^^^^^^^ the trait `diesel::Expression` is not implemented for `data::order::Side`
|
= note: required because of the requirements on the impl of `diesel::Expression` for `&'insert data::order::Side`
= note: required because of the requirements on the impl of `diesel::expression::AsExpression<diesel::types::Nullable<diesel::types::Integer>>` for `&'insert data::order::Side`
= note: this error originates in a macro outside of the current crate
error[E0277]: the trait bound `u32: diesel::Expression` is not satisfied
--> src/data/order.rs:31:39
|
31 | #[derive(PartialEq, Eq, Debug, Clone, Insertable)]
| ^^^^^^^^^^ the trait `diesel::Expression` is not implemented for `u32`
|
= note: required because of the requirements on the impl of `diesel::Expression` for `&'insert u32`
= note: required because of the requirements on the impl of `diesel::expression::AsExpression<diesel::types::Nullable<diesel::types::Integer>>` for `&'insert u32`
= note: this error originates in a macro outside of the current crate
error[E0277]: the trait bound `DB: diesel::backend::SupportsDefaultKeyword` is not satisfied
--> src/data/order.rs:31:39
|
31 | #[derive(PartialEq, Eq, Debug, Clone, Insertable)]
| ^^^^^^^^^^ the trait `diesel::backend::SupportsDefaultKeyword` is not implemented for `DB`
|
= help: consider adding a `where DB: diesel::backend::SupportsDefaultKeyword` bound
= note: required because of the requirements on the impl of `diesel::insertable::InsertValues<DB>` for `(diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::id, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Integer>, &i32>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::account_id, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Integer>, &std::option::Option<i32>>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::side, &'insert data::order::Side>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::instrument_id, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Integer>, &i32>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::price, &'insert u32>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::num_shares, &'insert u32>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::stamp, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Timestamptz>, &chrono::DateTime<chrono::UTC>>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::rank, &'insert u32>)`
= note: required by `diesel::insertable::InsertValues`
= note: this error originates in a macro outside of the current crate
error[E0277]: the trait bound `data::order::Side: diesel::query_builder::QueryFragment<DB>` is not satisfied
--> src/data/order.rs:31:39
|
31 | #[derive(PartialEq, Eq, Debug, Clone, Insertable)]
| ^^^^^^^^^^ the trait `diesel::query_builder::QueryFragment<DB>` is not implemented for `data::order::Side`
|
= note: required because of the requirements on the impl of `diesel::query_builder::QueryFragment<DB>` for `&'insert data::order::Side`
= note: required because of the requirements on the impl of `diesel::insertable::InsertValues<DB>` for `(diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::id, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Integer>, &i32>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::account_id, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Integer>, &std::option::Option<i32>>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::side, &'insert data::order::Side>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::instrument_id, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Integer>, &i32>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::price, &'insert u32>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::num_shares, &'insert u32>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::stamp, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Timestamptz>, &chrono::DateTime<chrono::UTC>>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::rank, &'insert u32>)`
= note: required by `diesel::insertable::InsertValues`
= note: this error originates in a macro outside of the current crate
error[E0277]: the trait bound `u32: diesel::query_builder::QueryFragment<DB>` is not satisfied
--> src/data/order.rs:31:39
|
31 | #[derive(PartialEq, Eq, Debug, Clone, Insertable)]
| ^^^^^^^^^^ the trait `diesel::query_builder::QueryFragment<DB>` is not implemented for `u32`
|
= note: required because of the requirements on the impl of `diesel::query_builder::QueryFragment<DB>` for `&'insert u32`
= note: required because of the requirements on the impl of `diesel::insertable::InsertValues<DB>` for `(diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::id, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Integer>, &i32>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::account_id, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Integer>, &std::option::Option<i32>>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::side, &'insert data::order::Side>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::instrument_id, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Integer>, &i32>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::price, &'insert u32>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::num_shares, &'insert u32>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::stamp, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Timestamptz>, &chrono::DateTime<chrono::UTC>>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::rank, &'insert u32>)`
= note: required by `diesel::insertable::InsertValues`
= note: this error originates in a macro outside of the current crate
error[E0277]: the trait bound `DB: diesel::types::HasSqlType<diesel::types::Timestamptz>` is not satisfied
--> src/data/order.rs:31:39
|
31 | #[derive(PartialEq, Eq, Debug, Clone, Insertable)]
| ^^^^^^^^^^ the trait `diesel::types::HasSqlType<diesel::types::Timestamptz>` is not implemented for `DB`
|
= help: consider adding a `where DB: diesel::types::HasSqlType<diesel::types::Timestamptz>` bound
= note: required because of the requirements on the impl of `diesel::types::HasSqlType<diesel::types::Nullable<diesel::types::Timestamptz>>` for `DB`
= note: required because of the requirements on the impl of `diesel::query_builder::QueryFragment<DB>` for `diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Timestamptz>, &chrono::DateTime<chrono::UTC>>`
= note: required because of the requirements on the impl of `diesel::insertable::InsertValues<DB>` for `(diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::id, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Integer>, &i32>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::account_id, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Integer>, &std::option::Option<i32>>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::side, &'insert data::order::Side>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::instrument_id, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Integer>, &i32>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::price, &'insert u32>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::num_shares, &'insert u32>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::stamp, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Timestamptz>, &chrono::DateTime<chrono::UTC>>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::rank, &'insert u32>)`
= note: required by `diesel::insertable::InsertValues`
= note: this error originates in a macro outside of the current crate
error[E0277]: the trait bound `chrono::DateTime<chrono::UTC>: diesel::types::ToSql<diesel::types::Timestamptz, DB>` is not satisfied
--> src/data/order.rs:31:39
|
31 | #[derive(PartialEq, Eq, Debug, Clone, Insertable)]
| ^^^^^^^^^^ the trait `diesel::types::ToSql<diesel::types::Timestamptz, DB>` is not implemented for `chrono::DateTime<chrono::UTC>`
|
= help: consider adding a `where chrono::DateTime<chrono::UTC>: diesel::types::ToSql<diesel::types::Timestamptz, DB>` bound
= note: required because of the requirements on the impl of `diesel::types::ToSql<diesel::types::Nullable<diesel::types::Timestamptz>, DB>` for `chrono::DateTime<chrono::UTC>`
= note: required because of the requirements on the impl of `diesel::types::ToSql<diesel::types::Nullable<diesel::types::Timestamptz>, DB>` for `&chrono::DateTime<chrono::UTC>`
= note: required because of the requirements on the impl of `diesel::query_builder::QueryFragment<DB>` for `diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Timestamptz>, &chrono::DateTime<chrono::UTC>>`
= note: required because of the requirements on the impl of `diesel::insertable::InsertValues<DB>` for `(diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::id, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Integer>, &i32>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::account_id, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Integer>, &std::option::Option<i32>>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::side, &'insert data::order::Side>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::instrument_id, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Integer>, &i32>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::price, &'insert u32>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::num_shares, &'insert u32>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::stamp, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Timestamptz>, &chrono::DateTime<chrono::UTC>>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::rank, &'insert u32>)`
= note: required by `diesel::insertable::InsertValues`
= note: this error originates in a macro outside of the current crate
error[E0277]: the trait bound `data::order::Side: diesel::Expression` is not satisfied
--> src/data/order.rs:31:39
|
31 | #[derive(PartialEq, Eq, Debug, Clone, Insertable)]
| ^^^^^^^^^^ the trait `diesel::Expression` is not implemented for `data::order::Side`
|
= note: required because of the requirements on the impl of `diesel::Expression` for `&'insert data::order::Side`
= note: required because of the requirements on the impl of `diesel::expression::AsExpression<diesel::types::Nullable<diesel::types::Integer>>` for `&'insert data::order::Side`
= note: this error originates in a macro outside of the current crate
error[E0277]: the trait bound `u32: diesel::Expression` is not satisfied
--> src/data/order.rs:31:39
|
31 | #[derive(PartialEq, Eq, Debug, Clone, Insertable)]
| ^^^^^^^^^^ the trait `diesel::Expression` is not implemented for `u32`
|
= note: required because of the requirements on the impl of `diesel::Expression` for `&'insert u32`
= note: required because of the requirements on the impl of `diesel::expression::AsExpression<diesel::types::Nullable<diesel::types::Integer>>` for `&'insert u32`
= note: this error originates in a macro outside of the current crate
error[E0277]: the trait bound `data::order::Side: diesel::Expression` is not satisfied
--> src/data/order.rs:31:39
|
31 | #[derive(PartialEq, Eq, Debug, Clone, Insertable)]
| ^^^^^^^^^^ the trait `diesel::Expression` is not implemented for `data::order::Side`
|
= note: required because of the requirements on the impl of `diesel::Expression` for `&'insert data::order::Side`
= note: required because of the requirements on the impl of `diesel::expression::AsExpression<diesel::types::Nullable<diesel::types::Integer>>` for `&'insert data::order::Side`
= note: this error originates in a macro outside of the current crate
error[E0277]: the trait bound `u32: diesel::Expression` is not satisfied
--> src/data/order.rs:31:39
|
31 | #[derive(PartialEq, Eq, Debug, Clone, Insertable)]
| ^^^^^^^^^^ the trait `diesel::Expression` is not implemented for `u32`
|
= note: required because of the requirements on the impl of `diesel::Expression` for `&'insert u32`
= note: required because of the requirements on the impl of `diesel::expression::AsExpression<diesel::types::Nullable<diesel::types::Integer>>` for `&'insert u32`
= note: this error originates in a macro outside of the current crate
error[E0277]: the trait bound `data::order::Side: diesel::Expression` is not satisfied
--> src/data/order.rs:31:39
|
31 | #[derive(PartialEq, Eq, Debug, Clone, Insertable)]
| ^^^^^^^^^^ the trait `diesel::Expression` is not implemented for `data::order::Side`
|
= note: required because of the requirements on the impl of `diesel::Expression` for `&'insert data::order::Side`
= note: required because of the requirements on the impl of `diesel::expression::AsExpression<diesel::types::Nullable<diesel::types::Integer>>` for `&'insert data::order::Side`
= note: this error originates in a macro outside of the current crate
error[E0277]: the trait bound `u32: diesel::Expression` is not satisfied
--> src/data/order.rs:31:39
|
31 | #[derive(PartialEq, Eq, Debug, Clone, Insertable)]
| ^^^^^^^^^^ the trait `diesel::Expression` is not implemented for `u32`
|
= note: required because of the requirements on the impl of `diesel::Expression` for `&'insert u32`
= note: required because of the requirements on the impl of `diesel::expression::AsExpression<diesel::types::Nullable<diesel::types::Integer>>` for `&'insert u32`
= note: this error originates in a macro outside of the current crate
error[E0277]: the trait bound `&'insert data::order::NewOrder: diesel::Insertable<schema::__diesel_infer_schema::infer_orders::orders::table, DB>` is not satisfied
--> src/data/order.rs:31:39
|
31 | #[derive(PartialEq, Eq, Debug, Clone, Insertable)]
| ^^^^^^^^^^ the trait `diesel::Insertable<schema::__diesel_infer_schema::infer_orders::orders::table, DB>` is not implemented for `&'insert data::order::NewOrder`
|
= help: the following implementations were found:
<&'insert data::order::NewOrder as diesel::Insertable<schema::__diesel_infer_schema::infer_orders::orders::table, DB>>
= note: this error originates in a macro outside of the current crate
error[E0277]: the trait bound `data::order::Side: diesel::Expression` is not satisfied
--> src/data/order.rs:31:39
|
31 | #[derive(PartialEq, Eq, Debug, Clone, Insertable)]
| ^^^^^^^^^^ the trait `diesel::Expression` is not implemented for `data::order::Side`
|
= note: required because of the requirements on the impl of `diesel::Expression` for `&'insert data::order::Side`
= note: required because of the requirements on the impl of `diesel::expression::AsExpression<diesel::types::Nullable<diesel::types::Integer>>` for `&'insert data::order::Side`
= note: this error originates in a macro outside of the current crate
error[E0277]: the trait bound `u32: diesel::Expression` is not satisfied
--> src/data/order.rs:31:39
|
31 | #[derive(PartialEq, Eq, Debug, Clone, Insertable)]
| ^^^^^^^^^^ the trait `diesel::Expression` is not implemented for `u32`
|
= note: required because of the requirements on the impl of `diesel::Expression` for `&'insert u32`
= note: required because of the requirements on the impl of `diesel::expression::AsExpression<diesel::types::Nullable<diesel::types::Integer>>` for `&'insert u32`
= note: this error originates in a macro outside of the current crate
error[E0277]: the trait bound `DB: diesel::backend::SupportsDefaultKeyword` is not satisfied
--> src/data/order.rs:31:39
|
31 | #[derive(PartialEq, Eq, Debug, Clone, Insertable)]
| ^^^^^^^^^^ the trait `diesel::backend::SupportsDefaultKeyword` is not implemented for `DB`
|
= help: consider adding a `where DB: diesel::backend::SupportsDefaultKeyword` bound
= note: required because of the requirements on the impl of `diesel::insertable::InsertValues<DB>` for `(diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::id, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Integer>, &i32>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::account_id, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Integer>, &std::option::Option<i32>>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::side, &'insert data::order::Side>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::instrument_id, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Integer>, &i32>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::price, &'insert u32>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::num_shares, &'insert u32>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::stamp, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Timestamptz>, &chrono::DateTime<chrono::UTC>>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::rank, &'insert u32>)`
= note: required by `diesel::insertable::InsertValues`
= note: this error originates in a macro outside of the current crate
error[E0277]: the trait bound `data::order::Side: diesel::query_builder::QueryFragment<DB>` is not satisfied
--> src/data/order.rs:31:39
|
31 | #[derive(PartialEq, Eq, Debug, Clone, Insertable)]
| ^^^^^^^^^^ the trait `diesel::query_builder::QueryFragment<DB>` is not implemented for `data::order::Side`
|
= note: required because of the requirements on the impl of `diesel::query_builder::QueryFragment<DB>` for `&'insert data::order::Side`
= note: required because of the requirements on the impl of `diesel::insertable::InsertValues<DB>` for `(diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::id, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Integer>, &i32>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::account_id, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Integer>, &std::option::Option<i32>>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::side, &'insert data::order::Side>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::instrument_id, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Integer>, &i32>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::price, &'insert u32>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::num_shares, &'insert u32>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::stamp, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Timestamptz>, &chrono::DateTime<chrono::UTC>>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::rank, &'insert u32>)`
= note: required by `diesel::insertable::InsertValues`
= note: this error originates in a macro outside of the current crate
error[E0277]: the trait bound `u32: diesel::query_builder::QueryFragment<DB>` is not satisfied
--> src/data/order.rs:31:39
|
31 | #[derive(PartialEq, Eq, Debug, Clone, Insertable)]
| ^^^^^^^^^^ the trait `diesel::query_builder::QueryFragment<DB>` is not implemented for `u32`
|
= note: required because of the requirements on the impl of `diesel::query_builder::QueryFragment<DB>` for `&'insert u32`
= note: required because of the requirements on the impl of `diesel::insertable::InsertValues<DB>` for `(diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::id, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Integer>, &i32>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::account_id, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Integer>, &std::option::Option<i32>>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::side, &'insert data::order::Side>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::instrument_id, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Integer>, &i32>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::price, &'insert u32>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::num_shares, &'insert u32>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::stamp, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Timestamptz>, &chrono::DateTime<chrono::UTC>>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::rank, &'insert u32>)`
= note: required by `diesel::insertable::InsertValues`
= note: this error originates in a macro outside of the current crate
error[E0277]: the trait bound `DB: diesel::types::HasSqlType<diesel::types::Timestamptz>` is not satisfied
--> src/data/order.rs:31:39
|
31 | #[derive(PartialEq, Eq, Debug, Clone, Insertable)]
| ^^^^^^^^^^ the trait `diesel::types::HasSqlType<diesel::types::Timestamptz>` is not implemented for `DB`
|
= help: consider adding a `where DB: diesel::types::HasSqlType<diesel::types::Timestamptz>` bound
= note: required because of the requirements on the impl of `diesel::types::HasSqlType<diesel::types::Nullable<diesel::types::Timestamptz>>` for `DB`
= note: required because of the requirements on the impl of `diesel::query_builder::QueryFragment<DB>` for `diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Timestamptz>, &chrono::DateTime<chrono::UTC>>`
= note: required because of the requirements on the impl of `diesel::insertable::InsertValues<DB>` for `(diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::id, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Integer>, &i32>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::account_id, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Integer>, &std::option::Option<i32>>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::side, &'insert data::order::Side>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::instrument_id, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Integer>, &i32>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::price, &'insert u32>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::num_shares, &'insert u32>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::stamp, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Timestamptz>, &chrono::DateTime<chrono::UTC>>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::rank, &'insert u32>)`
= note: required by `diesel::insertable::InsertValues`
= note: this error originates in a macro outside of the current crate
error[E0277]: the trait bound `chrono::DateTime<chrono::UTC>: diesel::types::ToSql<diesel::types::Timestamptz, DB>` is not satisfied
--> src/data/order.rs:31:39
|
31 | #[derive(PartialEq, Eq, Debug, Clone, Insertable)]
| ^^^^^^^^^^ the trait `diesel::types::ToSql<diesel::types::Timestamptz, DB>` is not implemented for `chrono::DateTime<chrono::UTC>`
|
= help: consider adding a `where chrono::DateTime<chrono::UTC>: diesel::types::ToSql<diesel::types::Timestamptz, DB>` bound
= note: required because of the requirements on the impl of `diesel::types::ToSql<diesel::types::Nullable<diesel::types::Timestamptz>, DB>` for `chrono::DateTime<chrono::UTC>`
= note: required because of the requirements on the impl of `diesel::types::ToSql<diesel::types::Nullable<diesel::types::Timestamptz>, DB>` for `&chrono::DateTime<chrono::UTC>`
= note: required because of the requirements on the impl of `diesel::query_builder::QueryFragment<DB>` for `diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Timestamptz>, &chrono::DateTime<chrono::UTC>>`
= note: required because of the requirements on the impl of `diesel::insertable::InsertValues<DB>` for `(diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::id, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Integer>, &i32>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::account_id, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Integer>, &std::option::Option<i32>>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::side, &'insert data::order::Side>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::instrument_id, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Integer>, &i32>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::price, &'insert u32>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::num_shares, &'insert u32>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::stamp, diesel::expression::bound::Bound<diesel::types::Nullable<diesel::types::Timestamptz>, &chrono::DateTime<chrono::UTC>>>, diesel::insertable::ColumnInsertValue<schema::__diesel_infer_schema::infer_orders::orders::columns::rank, &'insert u32>)`
= note: required by `diesel::insertable::InsertValues`
= note: this error originates in a macro outside of the current crate
error: aborting due to 24 previous errors
error: Could not compile `rustviewer`.
CREATE TABLE orders (
id SERIAL PRIMARY KEY,
account_id INTEGER REFERENCES users,
side INTEGER NOT NULL,
instrument_id INTEGER NOT NULL REFERENCES claims,
price INTEGER NOT NULL,
num_shares INTEGER NOT NULL,
stamp TIMESTAMP WITH TIME ZONE NOT NULL,
rank INTEGER NOT NULL
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment