Skip to content

Commit 8f6b6b9

Browse files
author
Philip Z
committed
chore: release version 4.2.8
1 parent 347d22a commit 8f6b6b9

12 files changed

Lines changed: 367 additions & 176 deletions

File tree

Cargo.lock

Lines changed: 20 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ members = [
1818
resolver = "2"
1919

2020
[workspace.package]
21-
version = "4.2.7"
21+
version = "4.2.8"
2222
edition = "2024"
2323
license = "Apache-2.0"
2424
authors = ["Philip"]
@@ -42,12 +42,12 @@ proc-macro2 = "1"
4242
quote = "1"
4343
syn = { version = "2", features = ["full", "extra-traits"] }
4444

45-
teaql-core = { path = "teaql-core", version = "4.2.7" }
46-
teaql-macros = { path = "teaql-macros", version = "4.2.7" }
47-
teaql-runtime = { path = "teaql-runtime", version = "4.2.7" }
48-
teaql-sql = { path = "teaql-sql", version = "4.2.7" }
49-
teaql-provider-sqlite = { path = "teaql-provider-sqlite", version = "4.2.7" }
50-
teaql-provider-postgres = { path = "teaql-provider-postgres", version = "4.2.7" }
51-
teaql-provider-mysql = { path = "teaql-provider-mysql", version = "4.2.7" }
52-
teaql-data-service = { path = "teaql-data-service", version = "4.2.7" }
53-
teaql-provider-linux = { path = "teaql-provider-linux", version = "4.2.7" }
45+
teaql-core = { path = "teaql-core", version = "4.2.8" }
46+
teaql-macros = { path = "teaql-macros", version = "4.2.8" }
47+
teaql-runtime = { path = "teaql-runtime", version = "4.2.8" }
48+
teaql-sql = { path = "teaql-sql", version = "4.2.8" }
49+
teaql-provider-sqlite = { path = "teaql-provider-sqlite", version = "4.2.8" }
50+
teaql-provider-postgres = { path = "teaql-provider-postgres", version = "4.2.8" }
51+
teaql-provider-mysql = { path = "teaql-provider-mysql", version = "4.2.8" }
52+
teaql-data-service = { path = "teaql-data-service", version = "4.2.8" }
53+
teaql-provider-linux = { path = "teaql-provider-linux", version = "4.2.8" }

teaql-core/src/value.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::str::FromStr;
33

44
use chrono::{DateTime, NaiveDate, Utc};
55
pub use rust_decimal::Decimal;
6-
use rust_decimal::prelude::{FromPrimitive, ToPrimitive};
6+
use rust_decimal::prelude::ToPrimitive;
77

88
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
99
pub enum DataType {

teaql-provider-sqlite/src/lib.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -764,11 +764,16 @@ mod tests {
764764

765765
#[test]
766766
fn decimal_bind_is_numeric_and_comparable() {
767-
let value = bind_sqlite_value(&Value::Decimal(Decimal::from_str("123.450").unwrap())).unwrap();
767+
let value =
768+
bind_sqlite_value(&Value::Decimal(Decimal::from_str("123.450").unwrap())).unwrap();
768769
assert_eq!(value, SqliteValue::Text("123.450".to_owned()));
769770
let connection = Connection::open_in_memory().unwrap();
770771
let matches: i64 = connection
771-
.query_row("SELECT 1 WHERE CAST(? AS NUMERIC) BETWEEN 120 AND 130", [value], |row| row.get(0))
772+
.query_row(
773+
"SELECT 1 WHERE CAST(? AS NUMERIC) BETWEEN 120 AND 130",
774+
[value],
775+
|row| row.get(0),
776+
)
772777
.unwrap();
773778
assert_eq!(matches, 1);
774779
}

teaql-runtime/src/data_service/graph.rs

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,11 @@ where
412412
ensure_initial_version(&mut node.values, descriptor);
413413
crate::data_service::helpers::ensure_timestamps(&mut node.values, descriptor, true);
414414
} else {
415-
crate::data_service::helpers::ensure_timestamps(&mut node.values, descriptor, false);
415+
crate::data_service::helpers::ensure_timestamps(
416+
&mut node.values,
417+
descriptor,
418+
false,
419+
);
416420
}
417421
let update_fields = is_update
418422
.then(|| {
@@ -1216,7 +1220,8 @@ where
12161220
pub(crate) async fn execute_ledger_plan_internal(
12171221
&self,
12181222
root: crate::EntityRoot,
1219-
) -> Result<std::collections::BTreeMap<crate::EntityKey, Value>, DataServiceError<E::Error>> {
1223+
) -> Result<std::collections::BTreeMap<crate::EntityKey, Value>, DataServiceError<E::Error>>
1224+
{
12201225
let mut generated_ids = std::collections::BTreeMap::new();
12211226
let comment = root.get_comment();
12221227
let trace_chain = comment
@@ -1307,7 +1312,6 @@ where
13071312
let mut insert_order: Vec<String> = insert_batches.keys().cloned().collect();
13081313
insert_order.sort();
13091314

1310-
13111315
for entity in insert_order {
13121316
let keys = insert_batches.get(&entity).unwrap();
13131317
let descriptor = self
@@ -1323,7 +1327,10 @@ where
13231327
let mut db_record = Record::new();
13241328
let mut real_id = key.id.clone();
13251329
if crate::data_service::helpers::is_unassigned_id_value(&real_id) {
1326-
let gen_id = self.data_service.metadata.context
1330+
let gen_id = self
1331+
.data_service
1332+
.metadata
1333+
.context
13271334
.next_id(&entity)
13281335
.map_err(DataServiceError::Runtime)?;
13291336
real_id = Value::U64(gen_id);
@@ -1346,7 +1353,6 @@ where
13461353
let mut update_order: Vec<(String, String)> = update_batches.keys().cloned().collect();
13471354
update_order.sort();
13481355

1349-
13501356
for signature in update_order {
13511357
let keys = update_batches.get(&signature).unwrap();
13521358
let descriptor = self
@@ -1357,7 +1363,12 @@ where
13571363
.map_err(DataServiceError::Runtime)?;
13581364
let mut update_fields: Vec<String> =
13591365
signature.1.split(',').map(|s| s.to_string()).collect();
1360-
if descriptor.properties.iter().any(|p| p.name == "update_time") && !update_fields.contains(&"update_time".to_owned()) {
1366+
if descriptor
1367+
.properties
1368+
.iter()
1369+
.any(|p| p.name == "update_time")
1370+
&& !update_fields.contains(&"update_time".to_owned())
1371+
{
13611372
update_fields.push("update_time".to_owned());
13621373
}
13631374
let mut cmd = teaql_core::BatchUpdateCommand::new(&descriptor.name, update_fields);

teaql-runtime/src/data_service/helpers.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,9 @@ pub(super) fn ensure_initial_version(record: &mut Record, descriptor: &EntityDes
142142

143143
pub(super) fn ensure_timestamps(record: &mut Record, descriptor: &EntityDescriptor, is_new: bool) {
144144
let now = Value::Timestamp(teaql_core::time::Timestamp::now());
145-
let has_property = |name: &str| -> bool {
146-
descriptor.properties.iter().any(|p| p.name == name)
147-
};
148-
145+
let has_property =
146+
|name: &str| -> bool { descriptor.properties.iter().any(|p| p.name == name) };
147+
149148
if is_new && has_property("create_time") {
150149
let needs_time = match record.get("create_time") {
151150
None | Some(Value::Null) => true,
@@ -156,7 +155,7 @@ pub(super) fn ensure_timestamps(record: &mut Record, descriptor: &EntityDescript
156155
record.insert("create_time".to_owned(), now.clone());
157156
}
158157
}
159-
158+
160159
if has_property("update_time") {
161160
let needs_time = match record.get("update_time") {
162161
None | Some(Value::Null) => true,

teaql-runtime/src/entity_save.rs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,21 @@ where
8585
let eds = ctx
8686
.entity_data_service::<E>(&entity)
8787
.map_err(|e| RuntimeError::Graph(e.to_string()))?;
88-
let generated_ids = eds.execute_ledger_plan_internal(root)
89-
.await
90-
.map_err(|e| match e {
91-
DataServiceError::Runtime(r) => r,
92-
other => RuntimeError::Graph(other.to_string()),
93-
})?;
94-
88+
let generated_ids =
89+
eds.execute_ledger_plan_internal(root)
90+
.await
91+
.map_err(|e| match e {
92+
DataServiceError::Runtime(r) => r,
93+
other => RuntimeError::Graph(other.to_string()),
94+
})?;
95+
9596
let descriptor = ctx.require_entity(&entity).unwrap();
9697
if let Some(id_prop) = descriptor.id_property() {
97-
let current_id = node.values.get(&id_prop.name).cloned().unwrap_or(Value::I64(0));
98+
let current_id = node
99+
.values
100+
.get(&id_prop.name)
101+
.cloned()
102+
.unwrap_or(Value::I64(0));
98103
let root_key = crate::EntityKey::new(entity.clone(), current_id);
99104
if let Some(new_id) = generated_ids.get(&root_key) {
100105
node.values.insert(id_prop.name.clone(), new_id.clone());

teaql-runtime/src/id.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,4 +153,3 @@ pub(crate) fn local_id_generator() -> &'static AtomicCounterIdGenerator {
153153
static LOCAL_ID_GENERATOR: OnceLock<AtomicCounterIdGenerator> = OnceLock::new();
154154
LOCAL_ID_GENERATOR.get_or_init(AtomicCounterIdGenerator::default)
155155
}
156-

teaql-runtime/src/lib.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,9 +1230,10 @@ mod tests {
12301230
let events = Arc::new(Mutex::new(Vec::new()));
12311231
let safe_events = Arc::new(Mutex::new(Vec::new()));
12321232
let mut ctx = UserContext::new()
1233-
.with_metadata(InMemoryMetadataStore::new().with_entity(
1234-
entity().audit_mask_fields(vec!["name".to_owned()]),
1235-
))
1233+
.with_metadata(
1234+
InMemoryMetadataStore::new()
1235+
.with_entity(entity().audit_mask_fields(vec!["name".to_owned()])),
1236+
)
12361237
.with_entity_registry(InMemoryEntityRegistry::new().with_entity("Order"))
12371238
.with_internal_id_generator(FixedIdGenerator(88))
12381239
.with_event_sink(RecordingEventSink {

teaql-sql/src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,11 @@ mod tests {
169169
.partition_by("order_id"),
170170
)
171171
.unwrap();
172-
assert_eq!(query.sql.matches("\"id\"").count(), 2, "one projection and one window order");
172+
assert_eq!(
173+
query.sql.matches("\"id\"").count(),
174+
2,
175+
"one projection and one window order"
176+
);
173177
assert!(!query.sql.contains("\"id\", \"order_id\", \"id\""));
174178
}
175179

0 commit comments

Comments
 (0)