abstract class Memo::Dialect::Base

Overview

Abstract interface for SQL dialect differences between SQLite and PostgreSQL.

Most SQL in Memo is cross-database compatible. This module only abstracts the patterns that differ:

Direct Known Subclasses

Defined in:

memo/dialect/base.cr

Instance Method Summary

Instance Method Detail

abstract def db_file_path(db : DB::Database) : String | Nil #

Get the database file path from a connection, if applicable.

SQLite: reads pragma_database_list PostgreSQL: returns nil (no local file)


[View source]
abstract def embedding_rowid_column : String #

The column name for embedding row identity used as USearch key.

SQLite: "rowid" (implicit) PostgreSQL: "eid" (explicit column)


[View source]
abstract def fts_delete(db : DB::Database, source_id : Int64) #

Delete FTS index entry for a source.


[View source]
abstract def fts_join_sql : String #

Build FTS JOIN clause for search queries.


[View source]
abstract def fts_upsert(db : DB::Database, source_id : Int64, content : String) #

Insert or update FTS index for a source.


[View source]
abstract def fts_where_sql : String #

Build FTS WHERE clause for match queries.


[View source]
abstract def insert_or_ignore_sql(table : String, columns : String, placeholders : String) : String #

Build INSERT OR IGNORE SQL.


[View source]
abstract def insert_returning_id(db : DB::Database, sql : String, *args) : Int64 #

Execute an INSERT and return the generated ID.


[View source]
abstract def schema_statements : Array(String) #

Get schema DDL statements.


[View source]
abstract def upsert_sql(table : String, columns : String, placeholders : String, conflict_columns : String, update_columns : Array(String)) : String #

Build upsert SQL (INSERT OR REPLACE equivalent).


[View source]