ali-sdk / ali-rds

Aliyun RDS client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

hangge666 opened this issue · comments

image
image

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

代码示例:

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

代码示例:

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

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

代码示例:

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