云溪的 blog
  • Archive
  • Media
  • Search
  • Tags
  • About
Home

Posts

swoft openWhere使用指南

open/close where 理解 openWhere 为where条件的左边括号即( closeWhere 为where条件的右边括号即) 实例 //默认连接符为AND Query::table("order")->openWhere()->where('id','1')->where('state', 3)->closeWhere()->openWhere()->where('id', 3)->where('state', 2)->closeWhere()->one()->getResult(); //执行结果为: SELECT * FROM `order_1` WHERE ( `id` = '1' AND `state` = '3') AND ( `id` = '3' AND `state` = '2') LIMIT 0,1 //设置连接符为or Query::table("order")->openWhere()->where('id','1')->where('state', 3)->closeWhere()->openWhere(QueryBuilder::LOGICAL_OR)->where('id', 3)->where('state', 2)->closeWhere()->one()->getResult(); //执行结果 SELECT * FROM `order_1` WHERE ( `id` = '1' AND `state` = '3') OR ( `id` = '3' AND `state` = '2') LIMIT 0,1

November 15, 2018 · 1 min · 云溪

Sqlite3 stdlib.h: No such file or directory

sqlite3/backup.go:14:20: fatal error: stdlib.h: No such file or directory 错误提示 # github.com/mattn/go-sqlite3 ../../../.go/src/github.com/mattn/go-sqlite3/backup.go:14:20: fatal error: stdlib.h: No such file or directory compilation terminated. 解决方法 sudo apt-get install g++ 参考链接 mattn/go-sqlite3/issues

September 23, 2018 · 1 min · 云溪

xorm将表生成实体

xorm 工具 xorm 是一组数据库操作命令行工具。 源码安装 go get github.com/go-xorm/cmd/xorm 使用 使用帮助 查看帮助命令: xorm help reverse 帮助详情 usage: xorm reverse [-s] driverName datasourceName tmplPath [generatedPath] [tableFilterReg] according database's tables and columns to generate codes for Go, C++ and etc. -s Generated one go file for every table driverName Database driver name, now supported four: mysql mymysql sqlite3 postgres datasourceName Database connection uri, for detail infomation please visit driver's project page tmplPath Template dir for generated. the default templates dir has provide 1 template generatedPath This parameter is optional, if blank, the default value is models, then will generated all codes in models dir tableFilterReg Table name filter regexp 使用实例(以mysql为例) 切换项目目录cd project1 讲模板配置文件移动到项目目录cp $GOPATH/src/github.com/go-xorm/cmd/xorm/templates ./template 执行生成实体命令xorm reverse mysql root:root@tcp\(127.0.0.1:3306\)/test\?charset=utf8 templates/goxorm ls models实体生成成功 常见问题 no matches found: root:root@tcp(127.0.0.1:3306)/test?charset=utf8 解决方法:将mysql 链接中的()和?转义,正确链接为 root:root@tcp\(127.0.0.1:3306\)/nideshop\?charset=utf8 ...

September 16, 2018 · 1 min · 云溪

docker mysql启动报错

错误信息 2018-09-15T08:11:26.620005077Z 2018-09-15T08:11:26.619857Z 0 [ERROR] [FATAL] InnoDB: Table flags are 0 in the data dictionary but the flags in file ./ibdata1 are 0x4800! 2018-09-15T08:11:26.620023933Z 2018-09-15 08:11:26 0x7f7203c4b740 InnoDB: Assertion failure in thread 140127666222912 in file ut0ut.cc line 942 解决方法 原因是宿主机data目录不为空照成; 删除默认data目录:/var/lib/mysql

September 15, 2018 · 1 min · 云溪

nodejs常见问题

错误1 npm ERR! Linux 4.15.0-34-generic npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "--no-bin-links" npm ERR! node v8.10.0 npm ERR! npm v3.5.2 npm ERR! code EMISSINGARG npm ERR! typeerror Error: Missing required argument #1 npm ERR! typeerror at andLogAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:31:3) npm ERR! typeerror at fetchPackageMetadata (/usr/share/npm/lib/fetch-package-metadata.js:51:22) npm ERR! typeerror at resolveWithNewModule (/usr/share/npm/lib/install/deps.js:456:12) npm ERR! typeerror at /usr/share/npm/lib/install/deps.js:457:7 npm ERR! typeerror at /usr/share/npm/node_modules/iferr/index.js:13:50 npm ERR! typeerror at /usr/share/npm/lib/fetch-package-metadata.js:37:12 npm ERR! typeerror at addRequestedAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:82:5) npm ERR! typeerror at returnAndAddMetadata (/usr/share/npm/lib/fetch-package-metadata.js:117:7) npm ERR! typeerror at pickVersionFromRegistryDocument (/usr/share/npm/lib/fetch-package-metadata.js:134:20) npm ERR! typeerror at /usr/share/npm/node_modules/iferr/index.js:13:50 npm ERR! typeerror This is an error with npm itself. Please report this error at: npm ERR! typeerror <http://github.com/npm/npm/issues> npm ERR! Linux 4.15.0-34-generic npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "--no-bin-links" npm ERR! node v8.10.0 npm ERR! npm v3.5.2 npm ERR! code EMISSINGARG 解决方法 npm install -g npm@latest 参考链接:https://github.com/npm/npm/issues/7308 ...

September 15, 2018 · 1 min · 云溪
« Prev  Next  »
© 2025 云溪的 blog