pub struct Connection { /* private fields */ }Expand description
Thin wrapper around rusqlite::Connection that guarantees the sqlite-vec
extension is available and applies Paper’s pragmas.
Implementations§
Source§impl Connection
impl Connection
Sourcepub fn open(path: &Path) -> Result<Self>
pub fn open(path: &Path) -> Result<Self>
Open an existing database file, running PRAGMA quick_check to verify
integrity before any work proceeds. If the file doesn’t exist, it is
created with creation-time pragmas (page_size, etc.).
quick_check is O(database size) and only runs on the first open after
creation; subsequent opens skip it since WAL mode guarantees crash
safety (I4: avoids per-search latency on large indexes).
Sourcepub fn open_or_create(path: &Path) -> Result<Self>
pub fn open_or_create(path: &Path) -> Result<Self>
Open a database file that will be created if it doesn’t exist. Runs
PRAGMA quick_check on the new/empty file (always “ok”) and applies
creation-time pragmas like page_size.
This is a convenience alias for open; both now handle fresh files.
pub fn open_in_memory() -> Result<Self>
pub fn inner(&self) -> &Connection
pub fn inner_mut(&mut self) -> &mut Connection
pub fn execute_batch(&self, sql: &str) -> Result<()>
Sourcepub fn query_i64(&self, sql: &str) -> Result<i64>
pub fn query_i64(&self, sql: &str) -> Result<i64>
Convenience for scalar queries used by doctor/tests.
pub fn query_row<T, P: Params>( &self, sql: &str, params: P, f: impl FnOnce(&Row<'_>) -> Result<T>, ) -> Result<T>
Sourcepub fn stored_embedding_model(&self) -> Result<Option<String>>
pub fn stored_embedding_model(&self) -> Result<Option<String>>
Get the embedding model ID stored in the index, if any.
Auto Trait Implementations§
impl !Freeze for Connection
impl !RefUnwindSafe for Connection
impl !Sync for Connection
impl !UnwindSafe for Connection
impl Forget for Connection
impl Move for Connection
impl Send for Connection
impl Unpin for Connection
impl UnsafeUnpin for Connection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more