1use uqa_core::{ArrayValue, DecimalValue, TemporalValue, Value};
11
12use crate::ast::{BinaryOp, Expr};
13#[cfg(test)]
14use crate::ast::{ColumnType, FunctionBinding, FunctionDispatch};
15use crate::error::{Result, SQLError};
16use crate::params::SQLParam;
17#[cfg(test)]
18use crate::result::ResultRow;
19
20mod array_access;
21pub use array_access::eval_array_access_with_control;
22mod array_transform;
23pub mod datums;
24mod encoding;
25mod floating;
26mod in_range;
27pub(crate) mod integer_input;
28mod json;
29mod json_strip;
30mod random;
31mod range;
32mod regex;
33mod time;
34mod uuid;
35
36pub use array_transform::{
37 argument_positions as array_transform_argument_positions,
38 argument_positions_with_control as array_transform_argument_positions_with_control,
39};
40pub(crate) use json::{decode_jsonb_datum_with_control, encode_jsonb_datum};
41pub use json::{validate_json_object_key_type, value_to_json_text};
42pub use json_strip::argument_positions as json_strip_nulls_argument_positions;
43pub use range::{
44 multirange_from_ranges, parse_multirange, parse_range, CanonicalMultirange, CanonicalRange,
45};
46pub use time::IntervalFields;
47use time::{
48 age_between, coerce_temporal, format_pg_number, format_temporal, hex_encode, make_timestamp,
49 parse_timestamp, pg_to_chrono_fmt,
50};
51pub(crate) use uuid::format_uuid;
52use uuid::generate_random_uuid;
53pub use uuid::parse_uuid_bytes;
54mod binary;
55mod casting;
56mod collation_for;
57pub mod composites;
58mod concatenation;
59mod conversion;
60mod current_time;
61pub mod enums;
62pub(crate) mod hashing;
63pub(crate) mod internal_char;
64pub(crate) mod interval_style;
65mod pattern;
66mod scalar_array;
67mod scalar_core;
68mod scalar_dispatch;
69mod scalar_geospatial;
70mod scalar_helpers;
71mod scalar_json;
72mod scalar_math;
73mod scalar_postgres;
74mod scalar_range;
75mod scalar_temporal;
76mod session_settings;
77mod session_sleep;
78mod temporal_input;
79mod value_catalog;
80pub mod variadic_any;
81pub use value_catalog::{EngineValueCatalog, SQLValueCatalog};
82
83#[cfg(test)]
84use binary::eval_comparison_op;
85pub use binary::{
86 compare_grouping_values_with_enum_catalog, compare_nullable_with_control,
87 compare_typed_values_with_control, compare_typed_values_with_enum_catalog,
88 compare_with_control, equal_typed_values_with_enum_catalog, eval_binary_values,
89 eval_binary_values_with_control, eval_binary_values_with_engine,
90 eval_binary_values_with_integer_width, eval_binary_values_with_integer_width_with_control,
91 eval_comparison_truth, eval_comparison_truth_with_control,
92 eval_comparison_truth_with_deferred_state, eval_comparison_truth_with_engine,
93 eval_comparison_truth_with_enum_catalog, eval_record_comparison_truth_with_engine,
94 eval_value_comparison_truth_with_engine, integer_width_for_literal, integer_width_for_type,
95 truthy, type_comparison_can_fail, validate_legacy_vector_comparison, value_comparison_can_fail,
96 values_equal_nullable_with_control, values_equal_with_control, IntegerWidth,
97};
98pub(crate) use binary::{datetime_out_of_range, division_by_zero, out_of_range};
99pub use casting::{
100 array_dimensions, cast_value, cast_value_from, cast_value_from_with_control,
101 invalid_boolean_input, negate_value, negate_value_with_control, parse_boolean_input,
102 parse_pg_array_literal, parse_pg_array_literal_with_control,
103};
104use conversion::{
105 allocation_error, float_to_i64_rounded, float_to_i64_trunc, nonnegative_usize, to_decimal,
106 to_i64,
107};
108pub use conversion::{
109 array_value_to_string, catalog_output_required, invalid_numeric_input, value_to_string,
110 value_to_string_with_control, vector_value_to_string,
111};
112pub(crate) use conversion::{
113 bytea_to_string_with_control, tensor_items, vector_element, vector_items,
114};
115pub use conversion::{
116 value_to_tensor, value_to_tensor_with_control, value_to_vector, value_to_vector_with_control,
117};
118pub(crate) use current_time::transaction_timestamp_or_clock;
119pub use current_time::{clock_timestamp_micros, transaction_clock_micros, TransactionClockScope};
120pub use floating::{
121 eval_float_arithmetic, eval_float_arithmetic_with_control, format_real, FloatWidth,
122};
123pub use in_range::{in_range, in_range_with_engine};
124#[cfg(test)]
125use scalar_dispatch::eval_scalar_function;
126pub(crate) use scalar_helpers::{append_sql_literal, quote_ident_with_control};
127use scalar_helpers::{point_xy, typeof_value};
128pub use scalar_helpers::{quote_ident, CompiledLikePattern};
129pub use temporal_input::{
130 temporal_date_order, temporal_interval_style, DateOrderScope, IntervalStyleScope,
131 TemporalInputContext, TemporalInputScope,
132};
133
134mod builtin;
135mod call_arguments;
136mod call_dispatch;
137mod context;
138mod diagnostics;
139mod evaluator;
140
141pub use builtin::{
142 bound_scalar_function_strictness, builtin_scalar_function_strictness,
143 eval_bound_builtin_function_call,
144};
145pub use call_arguments::{
146 call_argument_name, call_argument_value, evaluate_call_args, validate_named_argument_order,
147 validate_named_argument_order_with_control, variadic_argument_value, wrap_variadic_argument,
148};
149pub use call_dispatch::{
150 eval_builtin_function_call, eval_builtin_function_call_with_control, eval_function_call,
151 eval_generated_function_call_with_control,
152};
153pub use context::{
154 cast_value_with_type_resolution, cast_value_with_type_resolution_with_control,
155 coercion_type_name, format_regtype_value, format_regtype_value_with_control,
156 read_catalog_array_input, read_catalog_input, CatalogInputFunctions, EngineHook, EvalContext,
157 RowLookup,
158};
159pub(crate) use context::{
160 format_regtype_value_with_catalog_and_control, requires_catalog_constant_input,
161 requires_domain_array_input,
162};
163pub use diagnostics::{unknown_function_error, value_type_name};
164pub use evaluator::eval;
165mod numeric_operator;
166pub use numeric_operator::{eval_numeric_operator, eval_numeric_operator_with_control};
167
168#[cfg(test)]
169mod tests;
170
171mod json_carrier;
172pub use json_carrier::{core_value_to_json, value_to_text, value_to_text_with_control};