rename custom modules to index_method like in postgresql

This commit is contained in:
Nikita Sivukhin
2025-10-27 13:18:18 +04:00
parent 408ca235d1
commit 8a80e8b743
4 changed files with 19 additions and 17 deletions

View File

@@ -78,8 +78,8 @@ pub struct Opts {
pub mcp: bool,
#[clap(long, help = "Enable experimental encryption feature")]
pub experimental_encryption: bool,
#[clap(long, help = "Enable experimental custom modules feature")]
pub experimental_custom_modules: bool,
#[clap(long, help = "Enable experimental index method feature")]
pub experimental_index_method: bool,
}
const PROMPT: &str = "turso> ";
@@ -194,7 +194,7 @@ impl Limbo {
opts.experimental_views,
opts.experimental_strict,
opts.experimental_encryption,
opts.experimental_custom_modules,
opts.experimental_index_method,
)?
} else {
let flags = if opts.readonly {
@@ -212,7 +212,7 @@ impl Limbo {
.with_views(opts.experimental_views)
.with_strict(opts.experimental_strict)
.with_encryption(opts.experimental_encryption)
.with_custom_modules(opts.experimental_custom_modules)
.with_index_method(opts.experimental_index_method)
.turso_cli(),
None,
)?;

View File

@@ -316,7 +316,7 @@ mod tests {
enable_strict: false,
enable_load_extension: false,
enable_encryption: false,
enable_custom_modules: false,
enable_index_method: false,
},
None,
)?;

View File

@@ -113,7 +113,7 @@ pub struct DatabaseOpts {
pub enable_views: bool,
pub enable_strict: bool,
pub enable_encryption: bool,
pub enable_custom_modules: bool,
pub enable_index_method: bool,
enable_load_extension: bool,
}
@@ -125,7 +125,7 @@ impl Default for DatabaseOpts {
enable_views: false,
enable_strict: false,
enable_encryption: false,
enable_custom_modules: false,
enable_index_method: false,
enable_load_extension: false,
}
}
@@ -167,8 +167,8 @@ impl DatabaseOpts {
self
}
pub fn with_custom_modules(mut self, enable: bool) -> Self {
self.enable_custom_modules = enable;
pub fn with_index_method(mut self, enable: bool) -> Self {
self.enable_index_method = enable;
self
}
}
@@ -877,8 +877,8 @@ impl Database {
self.opts.enable_views
}
pub fn experimental_custom_modules_enabled(&self) -> bool {
self.opts.enable_custom_modules
pub fn experimental_index_method_enabled(&self) -> bool {
self.opts.enable_index_method
}
pub fn experimental_strict_enabled(&self) -> bool {
@@ -1503,7 +1503,7 @@ impl Connection {
.with_views(views)
.with_strict(strict)
.with_encryption(encryption)
.with_custom_modules(custom_modules),
.with_index_method(custom_modules),
None,
)?;
let conn = db.connect()?;
@@ -1533,7 +1533,7 @@ impl Connection {
.with_views(views)
.with_strict(strict)
.with_encryption(encryption)
.with_custom_modules(custom_modules),
.with_index_method(custom_modules),
encryption_opts.clone(),
)?;
if let Some(modeof) = opts.modeof {
@@ -2012,8 +2012,8 @@ impl Connection {
self.db.experimental_views_enabled()
}
pub fn experimental_custom_modules_enabled(&self) -> bool {
self.db.experimental_custom_modules_enabled()
pub fn experimental_index_method_enabled(&self) -> bool {
self.db.experimental_index_method_enabled()
}
pub fn experimental_strict_enabled(&self) -> bool {

View File

@@ -49,10 +49,12 @@ pub fn translate_create_index(
panic!("translate_create_index must be called with CreateIndex AST node");
};
if !connection.experimental_custom_modules_enabled()
if !connection.experimental_index_method_enabled()
&& (using.is_some() || !with_clause.is_empty())
{
bail_parse_error!("custom modules is an experimental feature. Enable with --experimental-custom-modules flag")
bail_parse_error!(
"index method is an experimental feature. Enable with --experimental-index-method flag"
)
}
let original_idx_name = idx_name;