mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-31 23:14:21 +01:00
Merge 'Clean up functions' from Pekka Enberg
Move functions to a new `core/functions` module. Closes #908
This commit is contained in:
@@ -122,7 +122,7 @@ fn format_dt(dt: NaiveDateTime, output_type: DateTimeOutput, subsec: bool) -> St
|
||||
// Not as fast as if the formatting was native to chrono, but a good enough
|
||||
// for now, just to have the feature implemented
|
||||
fn strftime_format(dt: &NaiveDateTime, format_str: &str) -> String {
|
||||
use super::strftime::CustomStrftimeItems;
|
||||
use crate::functions::strftime::CustomStrftimeItems;
|
||||
use std::fmt::Write;
|
||||
// Necessary to remove %f and %J that are exclusive formatters to sqlite
|
||||
// Chrono does not support them, so it is necessary to replace the modifiers manually
|
||||
3
core/functions/mod.rs
Normal file
3
core/functions/mod.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
pub mod datetime;
|
||||
pub mod printf;
|
||||
pub mod strftime;
|
||||
@@ -1,6 +1,7 @@
|
||||
mod error;
|
||||
mod ext;
|
||||
mod function;
|
||||
mod functions;
|
||||
mod info;
|
||||
mod io;
|
||||
#[cfg(feature = "json")]
|
||||
|
||||
@@ -18,17 +18,18 @@
|
||||
//! https://www.sqlite.org/opcode.html
|
||||
|
||||
pub mod builder;
|
||||
mod datetime;
|
||||
pub mod explain;
|
||||
pub mod insn;
|
||||
pub mod likeop;
|
||||
mod printf;
|
||||
pub mod sorter;
|
||||
mod strftime;
|
||||
|
||||
use crate::error::{LimboError, SQLITE_CONSTRAINT_PRIMARYKEY};
|
||||
use crate::ext::ExtValue;
|
||||
use crate::function::{AggFunc, ExtFunc, FuncCtx, MathFunc, MathFuncArity, ScalarFunc, VectorFunc};
|
||||
use crate::functions::datetime::{
|
||||
exec_date, exec_datetime_full, exec_julianday, exec_strftime, exec_time, exec_unixepoch,
|
||||
};
|
||||
use crate::functions::printf::exec_printf;
|
||||
use crate::info;
|
||||
use crate::pseudo::PseudoCursor;
|
||||
use crate::result::LimboResult;
|
||||
@@ -51,16 +52,12 @@ use crate::{
|
||||
json::json_remove, json::json_set, json::json_type,
|
||||
};
|
||||
use crate::{resolve_ext_path, Connection, Result, TransactionState, DATABASE_VERSION};
|
||||
use datetime::{
|
||||
exec_date, exec_datetime_full, exec_julianday, exec_strftime, exec_time, exec_unixepoch,
|
||||
};
|
||||
use insn::{
|
||||
exec_add, exec_and, exec_bit_and, exec_bit_not, exec_bit_or, exec_boolean_not, exec_concat,
|
||||
exec_divide, exec_multiply, exec_or, exec_remainder, exec_shift_left, exec_shift_right,
|
||||
exec_subtract,
|
||||
};
|
||||
use likeop::{construct_like_escape_arg, exec_glob, exec_like_with_escape};
|
||||
use printf::exec_printf;
|
||||
use rand::distributions::{Distribution, Uniform};
|
||||
use rand::{thread_rng, Rng};
|
||||
use regex::{Regex, RegexBuilder};
|
||||
|
||||
Reference in New Issue
Block a user