File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
examples/postgres_embedded/src Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -10,20 +10,22 @@ fn main() -> Result<()> {
10
10
let database_name = "test" ;
11
11
postgresql. create_database ( database_name) ?;
12
12
let settings = postgresql. settings ( ) ;
13
- let host = settings. host . to_string ( ) ;
14
- let port = settings. port . to_string ( ) ;
15
- let username = settings. username . to_string ( ) ;
16
- let password = settings. password . to_string ( ) ;
17
-
18
13
let mut client = Client :: connect (
19
- format ! ( "host={host} port={port} user={username} password={password}" ) . as_str ( ) ,
14
+ format ! (
15
+ "host={host} port={port} user={username} password={password}" ,
16
+ host = settings. host,
17
+ port = settings. port,
18
+ username = settings. username,
19
+ password = settings. password
20
+ )
21
+ . as_str ( ) ,
20
22
NoTls ,
21
23
) ?;
22
24
23
25
println ! ( "Creating table 'todos'" ) ;
24
26
create_table_todo ( & mut client) ?;
25
27
26
- let description = "Implement embedded database with sqlx " ;
28
+ let description = "Implement embedded database with postgres " ;
27
29
println ! ( "Adding new todo with description '{description}'" ) ;
28
30
let todo_id = add_todo ( & mut client, description) ?;
29
31
println ! ( "Added new todo with id {todo_id}" ) ;
You can’t perform that action at this time.
0 commit comments