database: initial import for dsn parsing
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
		
							
								
								
									
										15
									
								
								database/dsn_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								database/dsn_test.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,15 @@ | ||||
| package database | ||||
|  | ||||
| import ( | ||||
| 	"testing" | ||||
| ) | ||||
|  | ||||
| func TestParseDSN(t *testing.T) { | ||||
| 	cfg, err := ParseDSN("postgres://username:p@ssword#@host:12345/dbname?key1=val2&key2=val2") | ||||
| 	if err != nil { | ||||
| 		t.Fatal(err) | ||||
| 	} | ||||
| 	if cfg.Password != "p@ssword#" { | ||||
| 		t.Fatalf("parsing error") | ||||
| 	} | ||||
| } | ||||
		Reference in New Issue
	
	Block a user