File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change 11use skytable:: actions:: AsyncActions ;
22use skytable:: aio:: Connection ;
3+ use skytable:: ConnectionBuilder ;
34
45#[ tokio:: main]
56async fn main ( ) {
@@ -9,4 +10,13 @@ async fn main() {
910 // example of getting a custom type
1011 let get: u8 = con. get ( "x" ) . await . unwrap ( ) ;
1112 assert_eq ! ( get, 100 ) ;
13+
14+ // doing the same thing using a connection builder
15+ let _con = ConnectionBuilder :: new ( )
16+ . set_host ( "127.0.0.1" . to_string ( ) )
17+ . set_port ( 2003 )
18+ . set_entity ( "default:default" . to_owned ( ) )
19+ . get_async_connection ( )
20+ . await
21+ . unwrap ( ) ;
1222}
Original file line number Diff line number Diff line change 11use skytable:: actions:: Actions ;
22use skytable:: Connection ;
3+ use skytable:: ConnectionBuilder ;
34
45fn main ( ) {
6+ // simple example
57 let mut con = Connection :: new ( "127.0.0.1" , 2003 ) . unwrap ( ) ;
68 con. set ( "sayan" , "is writing code" ) . unwrap ( ) ;
79 let get: String = con. get ( "sayan" ) . unwrap ( ) ;
810 assert_eq ! ( get, "is writing code" . to_owned( ) ) ;
11+
12+ // getting a connection using the connection builder
13+ let _con = ConnectionBuilder :: new ( )
14+ . set_host ( "127.0.0.1" . to_string ( ) )
15+ . set_port ( 2003 )
16+ . set_entity ( "default:default" . to_owned ( ) )
17+ . get_connection ( )
18+ . unwrap ( ) ;
919}
You can’t perform that action at this time.
0 commit comments