Skip to content

Commit 3ec114b

Browse files
committed
[js][data_repository][04_explicit_arguments] Use explicit arguments
1 parent 8e478dd commit 3ec114b

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

examples/js/js-data_repository-04_explicit_arguments/src/Container.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ export class Container {
88
mysqlDatabase = "super_project";
99
mysqlPort = 3306;
1010

11-
mysqlUserRepository = new MySqlUserRepository(this);
11+
mysqlUserRepository = new MySqlUserRepository(
12+
this.mysqlHost,
13+
this.mysqlUser,
14+
this.mysqlPassword,
15+
this.mysqlDatabase,
16+
this.mysqlPort
17+
);
1218
usersSearcher = new UsersSearcher(this.mysqlUserRepository);
1319
}

examples/js/js-data_repository-04_explicit_arguments/src/MySqlUserRepository.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
export class MySqlUserRepository {
2-
constructor(container) {
2+
constructor(mysqlHost, mysqlUser, mysqlPassword, mysqlDatabase, mysqlPort) {
33
const Mysql = require('sync-mysql');
44
this.connection = new Mysql({
5-
host: container.mysqlHost,
6-
user: container.mysqlUser,
7-
password: container.mysqlPassword,
8-
database: container.mysqlDatabase,
9-
port: container.mysqlPort
5+
host: mysqlHost,
6+
user: mysqlUser,
7+
password: mysqlPassword,
8+
database: mysqlDatabase,
9+
port: mysqlPort
1010
});
1111
}
1212

0 commit comments

Comments
 (0)