-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add/link api #13
Add/link api #13
Conversation
return senPostRequest(url, JSON.stringify(body)) | ||
} | ||
|
||
async updateLinkConfig (oldLinkName, config) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this async and others are not?
let connectorName | ||
let jdbcDriver | ||
let connectionString | ||
let fetchSize = linkConfig.hasOwnProperty('fetchSize') ? linkConfig['fetchSize'] : 1000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
linkConfig('fetchSize') || 1000
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same below
const port = linkConfig.hasOwnProperty('port') ? linkConfig['port'] : 3306 | ||
connectorName = 'generic-jdbc-connector' | ||
jdbcDriver = 'com.mysql.jdbc.Driver' | ||
connectionString = 'jdbc:mysql://' + linkConfig['host'] + ':' + port + '/' + linkConfig['databaseName'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use back tick to do string interpolation
throw new Error('linkType must be mysql') | ||
} | ||
return { | ||
'links': [{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is all this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是说除了mysql还有什么吗,还是mysql那个的配置是什么含义。前者的话,除了mysql,还有oracle, generic,sftp,kite,kafka,ftp,hdfs。mysql属于generic。我再加个hdfs。
'username': 'root', | ||
'password': '12343456', | ||
} | ||
await sqoopClient.updateLinkConfig(oldLinkName, config) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the return value of this update?
2 similar comments
const linkName = 'test_link_2' | ||
await sqoopClient.updateLinkEnable(linkName) | ||
const data = await sqoopClient.getLinkByLinkName(linkName) | ||
expect(data['links'][0]['enabled'].toString()).to.equal('true') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't need toString
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comments
async deleteLinkAll () { | ||
const data = await this.getLinkAll() | ||
const deleteList = data['links'].map(link => this.deleteLink(link['name'])) | ||
return await deleteList |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should await Promise.all(a list of promise)
not await a list of promise
the latter does not work
…ad of mysql string
} | ||
] | ||
} | ||
} else if (linkConfig['linkType'] === linkType.hdfs) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tear up this into two smaller functions
} | ||
|
||
export function setCreateLinkRequestBody (linkConfig) { | ||
if (linkConfig['linkType'] === linkType.mysql) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use two separate functions for mysql and hdfs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comment
@@ -21,7 +30,7 @@ export class Hasoop { | |||
} | |||
|
|||
formatUrl ([basicPath, queryObject = {}], ...otherPath) { | |||
queryObject['user.name'] = this.userName | |||
_.set(queryObject, ['user.name'], this.userName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i guess ['user.name']
can be user.name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
在lodash里面,它是以.
分割的,如果直接写user.name
的话,就会是user=
,而不是user.name=<userName>
No description provided.