Skip to content

Commit

Permalink
chore: Update to latest clorinde
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobsvante committed Jan 10, 2025
1 parent 32dbb84 commit ef13a6f
Show file tree
Hide file tree
Showing 17 changed files with 122 additions and 93 deletions.
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions clorinde.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
name = "samling-clorinde"
version = "0.12.0"
license = "MIT"
publish = true
description = "Database queries etc for the `samling` crate"
repository = "https://github.com/hyperkliv/samling"
documentation = "https://docs.rs/samling/"
homepage = "https://github.com/hyperkliv/samling"
25 changes: 14 additions & 11 deletions samling-clorinde/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,22 @@
[package]
name = "samling-clorinde"
version = "0.12.0"
license = "MIT"
edition = "2021"
publish = true
description = "Database queries etc for the `samling` crate"
repository = "https://github.com/hyperkliv/samling"
documentation = "https://docs.rs/samling/"
homepage = "https://github.com/hyperkliv/samling"
repository = "https://github.com/hyperkliv/samling"
license = "MIT"


[features]
default = ["deadpool"]
default = ["deadpool", "chrono"]
deadpool = ["dep:deadpool-postgres", "tokio-postgres/default"]
wasm-async = ["tokio-postgres/js", "chrono/wasmbind"]
wasm-async = ["tokio-postgres/js", "chrono/wasmbind", "time/wasm-bindgen"]

chrono = ["dep:chrono"]
time = ["dep:time"]

[dependencies]
## Core dependencies
Expand All @@ -25,21 +30,19 @@ fallible-iterator = "0.2.0"

## Types dependencies
# JSON or JSONB
serde_json = { version = "1.0.135", features = ["raw_value"] }
serde_json = { version = "1.0.134", features = ["raw_value"] }
serde = { version = "1.0.217", features = ["derive"] }
# TIME, DATE, TIMESTAMP or TIMESTAMPZ
chrono = "0.4.39"
chrono = { version = "0.4.39", optional = true }
time = { version = "0.3.37", optional = true }
# DECIMAL
rust_decimal = { version = "1.36.0", features = ["db-postgres"] }

## Async client dependencies
# Postgres async client
tokio-postgres = { version = "0.7.12", default-features = false, features = [
"with-serde_json-1",
"with-chrono-0_4",
] }
tokio-postgres = { version = "0.7.12", default-features = false, features = ["with-serde_json-1","with-chrono-0_4","with-time-0_3",] }
# Async utils
async-trait = "0.1.85"
async-trait = "0.1.78"
futures = "0.3.31"

## Async features dependencies
Expand Down
8 changes: 4 additions & 4 deletions samling-clorinde/src/queries/attribute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ pub struct AttributeRow {
pub slug: String,
pub external_id: Option<String>,
pub created_by: Option<i32>,
pub created_at: chrono::DateTime<chrono::FixedOffset>,
pub updated_at: chrono::DateTime<chrono::FixedOffset>,
pub created_at: crate::types::time::TimestampTz,
pub updated_at: crate::types::time::TimestampTz,
pub r#type: serde_json::Value,
}
pub struct AttributeRowBorrowed<'a> {
Expand All @@ -76,8 +76,8 @@ pub struct AttributeRowBorrowed<'a> {
pub slug: &'a str,
pub external_id: Option<&'a str>,
pub created_by: Option<i32>,
pub created_at: chrono::DateTime<chrono::FixedOffset>,
pub updated_at: chrono::DateTime<chrono::FixedOffset>,
pub created_at: crate::types::time::TimestampTz,
pub updated_at: crate::types::time::TimestampTz,
pub r#type: postgres_types::Json<&'a serde_json::value::RawValue>,
}
impl<'a> From<AttributeRowBorrowed<'a>> for AttributeRow {
Expand Down
8 changes: 4 additions & 4 deletions samling-clorinde/src/queries/attributetype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ pub struct AttributeTypeRow {
pub slug: String,
pub external_id: Option<String>,
pub created_by: Option<i32>,
pub created_at: chrono::DateTime<chrono::FixedOffset>,
pub updated_at: chrono::DateTime<chrono::FixedOffset>,
pub created_at: crate::types::time::TimestampTz,
pub updated_at: crate::types::time::TimestampTz,
}
pub struct AttributeTypeRowBorrowed<'a> {
pub id: i32,
Expand All @@ -54,8 +54,8 @@ pub struct AttributeTypeRowBorrowed<'a> {
pub slug: &'a str,
pub external_id: Option<&'a str>,
pub created_by: Option<i32>,
pub created_at: chrono::DateTime<chrono::FixedOffset>,
pub updated_at: chrono::DateTime<chrono::FixedOffset>,
pub created_at: crate::types::time::TimestampTz,
pub updated_at: crate::types::time::TimestampTz,
}
impl<'a> From<AttributeTypeRowBorrowed<'a>> for AttributeTypeRow {
fn from(
Expand Down
8 changes: 4 additions & 4 deletions samling-clorinde/src/queries/category.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ pub struct CategoryRow {
pub external_id: Option<String>,
pub name: serde_json::Value,
pub created_by: Option<i32>,
pub created_at: chrono::DateTime<chrono::FixedOffset>,
pub updated_at: chrono::DateTime<chrono::FixedOffset>,
pub created_at: crate::types::time::TimestampTz,
pub updated_at: crate::types::time::TimestampTz,
}
pub struct CategoryRowBorrowed<'a> {
pub id: i32,
Expand All @@ -57,8 +57,8 @@ pub struct CategoryRowBorrowed<'a> {
pub external_id: Option<&'a str>,
pub name: postgres_types::Json<&'a serde_json::value::RawValue>,
pub created_by: Option<i32>,
pub created_at: chrono::DateTime<chrono::FixedOffset>,
pub updated_at: chrono::DateTime<chrono::FixedOffset>,
pub created_at: crate::types::time::TimestampTz,
pub updated_at: crate::types::time::TimestampTz,
}
impl<'a> From<CategoryRowBorrowed<'a>> for CategoryRow {
fn from(
Expand Down
16 changes: 8 additions & 8 deletions samling-clorinde/src/queries/collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ pub struct CollectionRow {
pub external_id: Option<String>,
pub name: serde_json::Value,
pub created_by: Option<i32>,
pub created_at: chrono::DateTime<chrono::FixedOffset>,
pub updated_at: chrono::DateTime<chrono::FixedOffset>,
pub created_at: crate::types::time::TimestampTz,
pub updated_at: crate::types::time::TimestampTz,
pub image_url: Option<String>,
pub acronym: serde_json::Value,
pub pricing: serde_json::Value,
Expand All @@ -103,8 +103,8 @@ pub struct CollectionRowBorrowed<'a> {
pub external_id: Option<&'a str>,
pub name: postgres_types::Json<&'a serde_json::value::RawValue>,
pub created_by: Option<i32>,
pub created_at: chrono::DateTime<chrono::FixedOffset>,
pub updated_at: chrono::DateTime<chrono::FixedOffset>,
pub created_at: crate::types::time::TimestampTz,
pub updated_at: crate::types::time::TimestampTz,
pub image_url: Option<&'a str>,
pub acronym: postgres_types::Json<&'a serde_json::value::RawValue>,
pub pricing: postgres_types::Json<&'a serde_json::value::RawValue>,
Expand Down Expand Up @@ -151,8 +151,8 @@ pub struct CollectionSummaryRow {
pub external_id: Option<String>,
pub name: serde_json::Value,
pub created_by: Option<i32>,
pub created_at: chrono::DateTime<chrono::FixedOffset>,
pub updated_at: chrono::DateTime<chrono::FixedOffset>,
pub created_at: crate::types::time::TimestampTz,
pub updated_at: crate::types::time::TimestampTz,
pub image_url: Option<String>,
pub acronym: serde_json::Value,
pub num_sizes: i64,
Expand All @@ -167,8 +167,8 @@ pub struct CollectionSummaryRowBorrowed<'a> {
pub external_id: Option<&'a str>,
pub name: postgres_types::Json<&'a serde_json::value::RawValue>,
pub created_by: Option<i32>,
pub created_at: chrono::DateTime<chrono::FixedOffset>,
pub updated_at: chrono::DateTime<chrono::FixedOffset>,
pub created_at: crate::types::time::TimestampTz,
pub updated_at: crate::types::time::TimestampTz,
pub image_url: Option<&'a str>,
pub acronym: postgres_types::Json<&'a serde_json::value::RawValue>,
pub num_sizes: i64,
Expand Down
8 changes: 4 additions & 4 deletions samling-clorinde/src/queries/color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ pub struct ColorRow {
pub number: String,
pub name: serde_json::Value,
pub created_by: Option<i32>,
pub created_at: chrono::DateTime<chrono::FixedOffset>,
pub updated_at: chrono::DateTime<chrono::FixedOffset>,
pub created_at: crate::types::time::TimestampTz,
pub updated_at: crate::types::time::TimestampTz,
pub style: serde_json::Value,
pub images: serde_json::Value,
}
Expand All @@ -79,8 +79,8 @@ pub struct ColorRowBorrowed<'a> {
pub number: &'a str,
pub name: postgres_types::Json<&'a serde_json::value::RawValue>,
pub created_by: Option<i32>,
pub created_at: chrono::DateTime<chrono::FixedOffset>,
pub updated_at: chrono::DateTime<chrono::FixedOffset>,
pub created_at: crate::types::time::TimestampTz,
pub updated_at: crate::types::time::TimestampTz,
pub style: postgres_types::Json<&'a serde_json::value::RawValue>,
pub images: postgres_types::Json<&'a serde_json::value::RawValue>,
}
Expand Down
8 changes: 4 additions & 4 deletions samling-clorinde/src/queries/group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ pub struct GroupRow {
pub name: String,
pub description: String,
pub created_by: Option<i32>,
pub created_at: chrono::DateTime<chrono::FixedOffset>,
pub updated_at: chrono::DateTime<chrono::FixedOffset>,
pub created_at: crate::types::time::TimestampTz,
pub updated_at: crate::types::time::TimestampTz,
pub users: serde_json::Value,
pub collections: serde_json::Value,
pub price_lists: serde_json::Value,
Expand All @@ -91,8 +91,8 @@ pub struct GroupRowBorrowed<'a> {
pub name: &'a str,
pub description: &'a str,
pub created_by: Option<i32>,
pub created_at: chrono::DateTime<chrono::FixedOffset>,
pub updated_at: chrono::DateTime<chrono::FixedOffset>,
pub created_at: crate::types::time::TimestampTz,
pub updated_at: crate::types::time::TimestampTz,
pub users: postgres_types::Json<&'a serde_json::value::RawValue>,
pub collections: postgres_types::Json<&'a serde_json::value::RawValue>,
pub price_lists: postgres_types::Json<&'a serde_json::value::RawValue>,
Expand Down
8 changes: 4 additions & 4 deletions samling-clorinde/src/queries/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ pub struct ImageRow {
pub position: i32,
pub color_id: i32,
pub uploaded_by: Option<i32>,
pub uploaded_at: chrono::DateTime<chrono::FixedOffset>,
pub updated_at: chrono::DateTime<chrono::FixedOffset>,
pub uploaded_at: crate::types::time::TimestampTz,
pub updated_at: crate::types::time::TimestampTz,
pub color: serde_json::Value,
}
pub struct ImageRowBorrowed<'a> {
Expand All @@ -64,8 +64,8 @@ pub struct ImageRowBorrowed<'a> {
pub position: i32,
pub color_id: i32,
pub uploaded_by: Option<i32>,
pub uploaded_at: chrono::DateTime<chrono::FixedOffset>,
pub updated_at: chrono::DateTime<chrono::FixedOffset>,
pub uploaded_at: crate::types::time::TimestampTz,
pub updated_at: crate::types::time::TimestampTz,
pub color: postgres_types::Json<&'a serde_json::value::RawValue>,
}
impl<'a> From<ImageRowBorrowed<'a>> for ImageRow {
Expand Down
8 changes: 4 additions & 4 deletions samling-clorinde/src/queries/organization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ pub struct OrganizationRow {
pub id: i32,
pub name: String,
pub created_by: Option<i32>,
pub created_at: chrono::DateTime<chrono::FixedOffset>,
pub updated_at: chrono::DateTime<chrono::FixedOffset>,
pub created_at: crate::types::time::TimestampTz,
pub updated_at: crate::types::time::TimestampTz,
pub logo_url: Option<String>,
}
pub struct OrganizationRowBorrowed<'a> {
pub id: i32,
pub name: &'a str,
pub created_by: Option<i32>,
pub created_at: chrono::DateTime<chrono::FixedOffset>,
pub updated_at: chrono::DateTime<chrono::FixedOffset>,
pub created_at: crate::types::time::TimestampTz,
pub updated_at: crate::types::time::TimestampTz,
pub logo_url: Option<&'a str>,
}
impl<'a> From<OrganizationRowBorrowed<'a>> for OrganizationRow {
Expand Down
32 changes: 16 additions & 16 deletions samling-clorinde/src/queries/price.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ pub struct InsertPriceParams<T1: crate::StringSql, T2: crate::StringSql, T3: cra
pub uom: Option<T1>,
pub currency: T2,
pub amount: rust_decimal::Decimal,
pub start: chrono::NaiveDate,
pub end: chrono::NaiveDate,
pub start: crate::types::time::Date,
pub end: crate::types::time::Date,
pub style_id: i32,
pub list_id: i32,
pub external_id: Option<T3>,
Expand All @@ -36,8 +36,8 @@ pub struct UpdatePriceParams<T1: crate::StringSql, T2: crate::StringSql, T3: cra
pub uom: Option<T1>,
pub currency: Option<T2>,
pub amount: Option<rust_decimal::Decimal>,
pub start: Option<chrono::NaiveDate>,
pub end: Option<chrono::NaiveDate>,
pub start: Option<crate::types::time::Date>,
pub end: Option<crate::types::time::Date>,
pub style_id: Option<i32>,
pub list_id: Option<i32>,
pub external_id: Option<T3>,
Expand All @@ -59,11 +59,11 @@ pub struct PriceRow {
pub external_id: Option<String>,
pub style_id: i32,
pub created_by: Option<i32>,
pub created_at: chrono::DateTime<chrono::FixedOffset>,
pub updated_at: chrono::DateTime<chrono::FixedOffset>,
pub created_at: crate::types::time::TimestampTz,
pub updated_at: crate::types::time::TimestampTz,
pub amount: rust_decimal::Decimal,
pub start: chrono::NaiveDate,
pub end: chrono::NaiveDate,
pub start: crate::types::time::Date,
pub end: crate::types::time::Date,
pub style: serde_json::Value,
pub list: serde_json::Value,
}
Expand All @@ -77,11 +77,11 @@ pub struct PriceRowBorrowed<'a> {
pub external_id: Option<&'a str>,
pub style_id: i32,
pub created_by: Option<i32>,
pub created_at: chrono::DateTime<chrono::FixedOffset>,
pub updated_at: chrono::DateTime<chrono::FixedOffset>,
pub created_at: crate::types::time::TimestampTz,
pub updated_at: crate::types::time::TimestampTz,
pub amount: rust_decimal::Decimal,
pub start: chrono::NaiveDate,
pub end: chrono::NaiveDate,
pub start: crate::types::time::Date,
pub end: crate::types::time::Date,
pub style: postgres_types::Json<&'a serde_json::value::RawValue>,
pub list: postgres_types::Json<&'a serde_json::value::RawValue>,
}
Expand Down Expand Up @@ -429,8 +429,8 @@ impl InsertPriceStmt {
uom: &'a Option<T1>,
currency: &'a T2,
amount: &'a rust_decimal::Decimal,
start: &'a chrono::NaiveDate,
end: &'a chrono::NaiveDate,
start: &'a crate::types::time::Date,
end: &'a crate::types::time::Date,
style_id: &'a i32,
list_id: &'a i32,
external_id: &'a Option<T3>,
Expand Down Expand Up @@ -516,8 +516,8 @@ impl UpdatePriceStmt {
uom: &'a Option<T1>,
currency: &'a Option<T2>,
amount: &'a Option<rust_decimal::Decimal>,
start: &'a Option<chrono::NaiveDate>,
end: &'a Option<chrono::NaiveDate>,
start: &'a Option<crate::types::time::Date>,
end: &'a Option<crate::types::time::Date>,
style_id: &'a Option<i32>,
list_id: &'a Option<i32>,
external_id: &'a Option<T3>,
Expand Down
8 changes: 4 additions & 4 deletions samling-clorinde/src/queries/pricelist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ pub struct PriceListRow {
pub slug: String,
pub external_id: Option<String>,
pub created_by: Option<i32>,
pub created_at: chrono::DateTime<chrono::FixedOffset>,
pub updated_at: chrono::DateTime<chrono::FixedOffset>,
pub created_at: crate::types::time::TimestampTz,
pub updated_at: crate::types::time::TimestampTz,
}
pub struct PriceListRowBorrowed<'a> {
pub id: i32,
Expand All @@ -67,8 +67,8 @@ pub struct PriceListRowBorrowed<'a> {
pub slug: &'a str,
pub external_id: Option<&'a str>,
pub created_by: Option<i32>,
pub created_at: chrono::DateTime<chrono::FixedOffset>,
pub updated_at: chrono::DateTime<chrono::FixedOffset>,
pub created_at: crate::types::time::TimestampTz,
pub updated_at: crate::types::time::TimestampTz,
}
impl<'a> From<PriceListRowBorrowed<'a>> for PriceListRow {
fn from(
Expand Down
Loading

0 comments on commit ef13a6f

Please sign in to comment.