pub trait Ddl: SyncSocket {
fn switch<'s, T: IntoSkyhashBytes + 's>(
&'s mut self,
entity: T
) -> SkyResult<()> { ... }
fn create_keyspace<'s>(
&'s mut self,
ks: impl IntoSkyhashBytes + 's
) -> SkyResult<bool> { ... }
fn create_table<'s>(
&'s mut self,
table: impl CreateTableIntoQuery + 's
) -> SkyResult<()> { ... }
fn drop_table<'s>(
&'s mut self,
table: impl IntoSkyhashBytes + 's
) -> SkyResult<bool> { ... }
fn drop_keyspace<'s>(
&'s mut self,
keyspace: impl IntoSkyhashBytes + 's,
force: bool
) -> SkyResult<()> { ... }
fn whereami<'s>(&'s mut self) -> SkyResult<WhereAmI> { ... }
}
This is supported on crate feature
sync
only.Expand description
DDL queries that can be run on a sync socket connections
Provided methods
fn switch<'s, T: IntoSkyhashBytes + 's>(
&'s mut self,
entity: T
) -> SkyResult<()>
fn switch<'s, T: IntoSkyhashBytes + 's>(
&'s mut self,
entity: T
) -> SkyResult<()>
This function switches to the provided entity.
This is equivalent to:
USE <entity>
Example
use skytable::ddl::Ddl;
use skytable::sync::Connection;
let mut con = Connection::new("127.0.0.1", 2003).unwrap();
con.switch("mykeyspace:mytable").unwrap();
fn create_keyspace<'s>(
&'s mut self,
ks: impl IntoSkyhashBytes + 's
) -> SkyResult<bool>
fn create_keyspace<'s>(
&'s mut self,
ks: impl IntoSkyhashBytes + 's
) -> SkyResult<bool>
Create the provided keyspace
This is equivalent to:
CREATE KEYSPACE <ksname>
This will return true if the keyspace was created or false if the keyspace already exists
fn create_table<'s>(
&'s mut self,
table: impl CreateTableIntoQuery + 's
) -> SkyResult<()>
fn create_table<'s>(
&'s mut self,
table: impl CreateTableIntoQuery + 's
) -> SkyResult<()>
Create a table from the provided configuration
fn drop_table<'s>(
&'s mut self,
table: impl IntoSkyhashBytes + 's
) -> SkyResult<bool>
fn drop_table<'s>(
&'s mut self,
table: impl IntoSkyhashBytes + 's
) -> SkyResult<bool>
Drop the provided table
This returns true if the table was removed for false if the table didn’t exist
fn drop_keyspace<'s>(
&'s mut self,
keyspace: impl IntoSkyhashBytes + 's,
force: bool
) -> SkyResult<()>
fn drop_keyspace<'s>(
&'s mut self,
keyspace: impl IntoSkyhashBytes + 's,
force: bool
) -> SkyResult<()>
Drop the provided keyspace