1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//! Field name case conversion (camelCase → `snake_case`).
//!
//! This module handles converting GraphQL field names (typically camelCase)
//! to PostgreSQL column names (typically `snake_case`).
/// The canonical field-name → `snake_case` JSONB-key rule.
///
/// Re-exported from `fraiseql-db` so the SQL projection generators and this
/// crate's Rust entity projector share **one** definition — eliminating the
/// historical drift where two copies disagreed on acronym field names
/// (`userID` → `user_id`, never `user_i_d`). See
/// [`fraiseql_db::utils::to_snake_case`].
pub use ;
/// Convert `snake_case` to camelCase.
///
/// This is the inverse of [`to_snake_case`]: a digit segment collapses onto the
/// previous word (`phone_1` → `phone1`), and `to_snake_case` reinserts the
/// boundary (`phone1` → `phone_1`), so the round trip is bijective. See
/// [`to_snake_case`] for the digit caveat (`oauth2`/`ipv4`/`s3`).
///
/// # Examples
///
/// ```
/// use fraiseql_core::utils::casing::to_camel_case;
///
/// assert_eq!(to_camel_case("user_id"), "userId");
/// assert_eq!(to_camel_case("created_at"), "createdAt");
/// assert_eq!(to_camel_case("http_response"), "httpResponse");
/// assert_eq!(to_camel_case("phone_1"), "phone1");
/// assert_eq!(to_camel_case("dns_1_id"), "dns1Id");
/// assert_eq!(to_camel_case("alreadyCamel"), "alreadyCamel");
/// ```
/// Normalize a field path for database access.
///
/// This handles dotted paths like "user.profile.name" and converts each segment.
///
/// # Examples
///
/// ```
/// use fraiseql_core::utils::casing::normalize_field_path;
///
/// assert_eq!(normalize_field_path("userId"), "user_id");
/// assert_eq!(normalize_field_path("user.createdAt"), "user.created_at");
/// assert_eq!(normalize_field_path("device.sensor.currentValue"), "device.sensor.current_value");
/// ```