Skip to content
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

请问update更新字段值如何使用表达式 #68

Open
hangge666 opened this issue May 31, 2019 · 3 comments
Open

请问update更新字段值如何使用表达式 #68

hangge666 opened this issue May 31, 2019 · 3 comments

Comments

@hangge666
Copy link

hangge666 commented May 31, 2019

image
image

row想用表达式 但是这样子不行,请问该怎么做

@jerryhu
Copy link

jerryhu commented Jun 6, 2019

代码示例:

await this.app.mysql.update('post_comment', { id: commentId, replies: new Literal('(replies+1)') });
const updateOptions = [];
updateOptions.push({ id: postId, replies: new Literal(`(replies+${replyCount})`) });
await this.app.mysql.updateRows('post_comment', updateOptions);

@hangge666

@hangge666
Copy link
Author

代码示例:

await this.app.mysql.update('post_comment', { id: commentId, replies: new Literal('(replies+1)') });
const updateOptions = [];
updateOptions.push({ id: postId, replies: new Literal(`(replies+${replyCount})`) });
await this.app.mysql.updateRows('post_comment', updateOptions);

@hangge666

学到了 , 不过您是在哪里看到的呢? 总之谢谢您了

@puzzle9
Copy link

puzzle9 commented Dec 5, 2019

代码示例:

await this.app.mysql.update('post_comment', { id: commentId, replies: new Literal('(replies+1)') });
const updateOptions = [];
updateOptions.push({ id: postId, replies: new Literal(`(replies+${replyCount})`) });
await this.app.mysql.updateRows('post_comment', updateOptions);

@hangge666

学到了 , 不过您是在哪里看到的呢? 总之谢谢您了

https://eggjs.org/en/tutorials/mysql.html#literal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants