pub struct Sqlite { /* private fields */ }Expand description
§Capabilities
Depending on its configuration and the backing system, this service can expose:
- create_dir
- stat
- read
- write
- delete
- list
- copy
- rename
- presign
Inspect the effective capability set with opendal_core::Operator::info and
opendal_core::OperatorInfo::capability after building an operator.
§Configuration
Use crate::SqliteConfig for serializable configuration and this builder’s
methods for direct construction. The field and method documentation defines
accepted values, defaults, and environment interaction.
§Example
§Via Builder
use opendal_core::Operator;
use opendal_core::Result;
use opendal_service_sqlite::Sqlite;
#[tokio::main]
async fn main() -> Result<()> {
let mut builder = Sqlite::default()
.root("/")
.connection_string("file//abc.db")
.table("your_table")
// key field type in the table should be compatible with Rust's &str like text
.key_field("key")
// value field type in the table should be compatible with Rust's Vec<u8> like bytea
.value_field("value");
let op = Operator::new(builder)?;
Ok(())
}Implementations§
Source§impl SqliteBuilder
impl SqliteBuilder
Sourcepub fn connection_string(self, v: &str) -> Self
pub fn connection_string(self, v: &str) -> Self
Set the connection_string of the sqlite service.
This connection string is used to connect to the sqlite service. There are url based formats:
§Url
This format resembles the url format of the sqlite client:
sqlite::memory:sqlite:data.dbsqlite://data.db
For more information, please visit https://docs.rs/sqlx/latest/sqlx/sqlite/struct.SqliteConnectOptions.html.
Sourcepub fn root(self, root: &str) -> Self
pub fn root(self, root: &str) -> Self
set the working directory, all operations will be performed under it.
default: “/”
Sourcepub fn table(self, table: &str) -> Self
pub fn table(self, table: &str) -> Self
Set the table name of the sqlite service to read/write.
Sourcepub fn key_field(self, key_field: &str) -> Self
pub fn key_field(self, key_field: &str) -> Self
Set the key field name of the sqlite service to read/write.
Default to key if not specified.
Sourcepub fn value_field(self, value_field: &str) -> Self
pub fn value_field(self, value_field: &str) -> Self
Set the value field name of the sqlite service to read/write.
Default to value if not specified.
Trait Implementations§
Source§impl Builder for SqliteBuilder
impl Builder for SqliteBuilder
Source§impl Debug for SqliteBuilder
impl Debug for SqliteBuilder
Source§impl Default for SqliteBuilder
impl Default for SqliteBuilder
Source§fn default() -> SqliteBuilder
fn default() -> SqliteBuilder
Auto Trait Implementations§
impl Freeze for SqliteBuilder
impl RefUnwindSafe for SqliteBuilder
impl Send for SqliteBuilder
impl Sync for SqliteBuilder
impl Unpin for SqliteBuilder
impl UnsafeUnpin for SqliteBuilder
impl UnwindSafe for SqliteBuilder
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
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