pub struct D1ExportContext {
pub database_id: String,
pub table_name: String,
pub account_id: String,
pub api_token: String,
pub http_client: Arc<Client>,
pub key_fields_schema: Vec<FieldSchema>,
pub value_fields_schema: Vec<FieldSchema>,
pub metrics: PerformanceMetrics,
}Expand description
D1 export context (runtime state)
Fields§
§database_id: String§table_name: String§account_id: String§api_token: String§http_client: Arc<Client>Shared HTTP client with connection pooling
key_fields_schema: Vec<FieldSchema>§value_fields_schema: Vec<FieldSchema>§metrics: PerformanceMetricsImplementations§
Source§impl D1ExportContext
impl D1ExportContext
Sourcepub fn new(
database_id: String,
table_name: String,
account_id: String,
api_token: String,
http_client: Arc<Client>,
key_fields_schema: Vec<FieldSchema>,
value_fields_schema: Vec<FieldSchema>,
metrics: PerformanceMetrics,
) -> Result<Self, RecocoError>
pub fn new( database_id: String, table_name: String, account_id: String, api_token: String, http_client: Arc<Client>, key_fields_schema: Vec<FieldSchema>, value_fields_schema: Vec<FieldSchema>, metrics: PerformanceMetrics, ) -> Result<Self, RecocoError>
Create a new D1 export context with a shared HTTP client
Sourcepub fn new_with_default_client(
database_id: String,
table_name: String,
account_id: String,
api_token: String,
key_fields_schema: Vec<FieldSchema>,
value_fields_schema: Vec<FieldSchema>,
metrics: PerformanceMetrics,
) -> Result<Self, RecocoError>
pub fn new_with_default_client( database_id: String, table_name: String, account_id: String, api_token: String, key_fields_schema: Vec<FieldSchema>, value_fields_schema: Vec<FieldSchema>, metrics: PerformanceMetrics, ) -> Result<Self, RecocoError>
Create a new D1 export context with a default HTTP client (for tests and examples)
pub fn api_url(&self) -> String
pub fn build_upsert_stmt( &self, key: &KeyValue, values: &FieldValues, ) -> Result<(String, Vec<Value>), RecocoError>
pub fn build_delete_stmt( &self, key: &KeyValue, ) -> Result<(String, Vec<Value>), RecocoError>
pub async fn upsert( &self, upserts: &[ExportTargetUpsertEntry], ) -> Result<(), RecocoError>
pub async fn delete( &self, deletes: &[ExportTargetDeleteEntry], ) -> Result<(), RecocoError>
Auto Trait Implementations§
impl Freeze for D1ExportContext
impl !RefUnwindSafe for D1ExportContext
impl Send for D1ExportContext
impl Sync for D1ExportContext
impl Unpin for D1ExportContext
impl UnsafeUnpin for D1ExportContext
impl !UnwindSafe for D1ExportContext
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