pub struct ContextQueryBuilder { /* private fields */ }Expand description
Builder for CONTEXT SELECT queries
Implementations§
Source§impl ContextQueryBuilder
impl ContextQueryBuilder
Sourcepub fn with_connection(conn: Arc<SochConnection>) -> Self
pub fn with_connection(conn: Arc<SochConnection>) -> Self
Create a new builder with a connection for executing DB queries
Sourcepub fn connection(self, conn: Arc<SochConnection>) -> Self
pub fn connection(self, conn: Arc<SochConnection>) -> Self
Attach a connection for executing DB queries
Sourcepub fn for_session(self, session_id: &str) -> Self
pub fn for_session(self, session_id: &str) -> Self
Set session ID for context
Sourcepub fn with_budget(self, budget: usize) -> Self
pub fn with_budget(self, budget: usize) -> Self
Set token budget
Sourcepub fn include_schema(self, include: bool) -> Self
pub fn include_schema(self, include: bool) -> Self
Set whether to include schema
Sourcepub fn format(self, format: ContextFormat) -> Self
pub fn format(self, format: ContextFormat) -> Self
Set output format
Sourcepub fn truncation(self, strategy: TruncationStrategy) -> Self
pub fn truncation(self, strategy: TruncationStrategy) -> Self
Set truncation strategy
Sourcepub fn set_var(self, name: &str, value: ContextValue) -> Self
pub fn set_var(self, name: &str, value: ContextValue) -> Self
Set a variable for query execution
Sourcepub fn section(self, name: &str, priority: i32) -> SectionBuilder
pub fn section(self, name: &str, priority: i32) -> SectionBuilder
Start building a section
Sourcepub fn variable(self, name: &str, priority: i32, var_name: &str) -> Self
pub fn variable(self, name: &str, priority: i32, var_name: &str) -> Self
Add a variable reference section
Sourcepub fn build(self) -> ContextQuery
pub fn build(self) -> ContextQuery
Build the context query
Sourcepub fn execute(self) -> Result<ContextQueryResult, ContextQueryError>
pub fn execute(self) -> Result<ContextQueryResult, ContextQueryError>
Execute the query - uses connection if available for real DB queries
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ContextQueryBuilder
impl !RefUnwindSafe for ContextQueryBuilder
impl Send for ContextQueryBuilder
impl Sync for ContextQueryBuilder
impl Unpin for ContextQueryBuilder
impl !UnwindSafe for ContextQueryBuilder
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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