Skip to content

Instantly share code, notes, and snippets.

OK, but we went through this whole fire-drill some time ago to describe the difference in the syntax (which we document and give examples of) because sometimes the where clause is wrapped in {where: ... } and sometimes not.
The docs say:
For query methods such as find(), findOrCreate(), or findOne(), use {where: {property: value}}
and
... for methods that update and delete (and count()), don't wrap the where clause in a { where : ... }, ... so use {property: value}
I just tested that myself and it seems to be accurate.
https://press.one/p/address/v?s=c2e3c687c90835e3ef1f55c9ed0929a75812f60e9803f90f1a431c100b31f9682285e40c90531d69132bb062077ac4fc9043bb9828990a03776fcff69aefb9bd1&h=1aeddc4a3531c3414a17ce0ced9c56cee6ab50d40c16ea509e5fd6c325d58000&a=7e4c00d9b537ff016aa99b0a8e6233da817fbc4c&f=P1&v=2
@greyhawk
greyhawk / vim-surround使用指南.MD
Created October 24, 2018 23:38 — forked from wilon/vim-surround使用指南.MD
vim-surround使用指南,vim-surround如何使用

普通模式

命令 说明 + 示例
ds 删除括号
ds " "Hello world!" =>
Hello world!
cs 替换括号
cs "( "Hello world!" =>
(Hello world!)
cS 替换括号,括号内文本做新一行
cS "{ "Hello world!" => {     Hello world! }
@greyhawk
greyhawk / config.py
Created June 24, 2019 06:43 — forked from catermelon/config.py
Flask-SQLAlchemy - separating reads and writes
# This is not used unless SQLALCHEMY_BINDS is not present
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://{username}:{password}@{hostname}/{database}?charset=utf8'
SQLALCHEMY_BINDS = {
'master': 'mysql+pymysql://{username}:{password}@{hostname}/{database}?charset=utf8',
'slave': 'mysql+pymysql://{username}:{password}@{hostname}/{database}?charset=utf8'
}
function tmc() {
before=$(df -hl / |awk '{print $3}' |tail -n1)
count=0
for snapshot in $(tmutil listlocalsnapshots /|awk -F. '{print $4}');do
let 'count++'
echo "delete snapshot $snapshot"
tmutil deletelocalsnapshots $snapshot;
done
after=$(df -hl / |awk '{print $3}' |tail -n1)
if [[ $count -ne 0 ]]; then