我正在使用knex生成我的 SQL 查询。在knex文档中,它显示了这一点
knex('users').where('columnName', 'like', '%rowlikeme%')
Run Code Online (Sandbox Code Playgroud)
现在在我的应用程序中,我这样做了:
function search(term) {
term = "%" + term + "%";
knex('table').where('description', 'like', term);
// ...
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能逃脱,%以便它也%作为术语的一部分进行搜索?
谢谢。
我需要为每个传输使用不同类型的格式化程序.
例
logger = new (winston.Logger)({
transports: [
new (winston.transports.LogstashUDP)({
// some config here. Do noting on formatting
}),
new (winston.transports.Mail)({
// do formatting one way
}),
new (winston.transports.File)({
// write to file as json (maybe format it here)
}),
new (winston.transports.Console)({
// do another formatting
})
]
});
Run Code Online (Sandbox Code Playgroud)
正如我从winston transports 文档中看到的那样,只有Console支持自定义格式化程序.
我正在使用winston-mailer模块邮件和winston-logstash-upd
有没有办法用Winston解决这个问题?或者也许如何围绕其中一个模块创建包装以支持格式化?