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 1
1
use skytable:: actions:: AsyncActions ;
2
2
use skytable:: aio:: Connection ;
3
+ use skytable:: ConnectionBuilder ;
3
4
4
5
#[ tokio:: main]
5
6
async fn main ( ) {
@@ -9,4 +10,13 @@ async fn main() {
9
10
// example of getting a custom type
10
11
let get: u8 = con. get ( "x" ) . await . unwrap ( ) ;
11
12
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 ( ) ;
12
22
}
Original file line number Diff line number Diff line change 1
1
use skytable:: actions:: Actions ;
2
2
use skytable:: Connection ;
3
+ use skytable:: ConnectionBuilder ;
3
4
4
5
fn main ( ) {
6
+ // simple example
5
7
let mut con = Connection :: new ( "127.0.0.1" , 2003 ) . unwrap ( ) ;
6
8
con. set ( "sayan" , "is writing code" ) . unwrap ( ) ;
7
9
let get: String = con. get ( "sayan" ) . unwrap ( ) ;
8
10
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 ( ) ;
9
19
}
You can’t perform that action at this time.
0 commit comments