
分类:xorm

2020
12-22
12-22
golang xorm及time.Time自定义解决json日期格式的问题

2020
12-22
12-22
golang xorm日志写入文件中的操作
golang访问数据库记录SQL语句:使用的包为:1:github.com/arthurkiller/rollingwriter//写入日志包2:github.com/go-xorm/xorm//xorm包具体实现为:packagemainimport("time""github.com/arthurkiller/rollingwriter"_"github.com/go-sql-driver/mysql""github.com/go-xorm/xorm")funcmain(){varconnstring="root:123456@tcp(127.0.0.1)/logsdemo?charset=utf-8"Engine,err:=xorm.NewEngine("mysql",...
继续阅读 >
2020
12-22
12-22
xorm根据数据库生成go model文件的操作
你懂的,手工翻译表定义到go结构体是很枯燥的。so,用xorm搞定。gogetgithub.com/go-xorm/cmd/xorm安装以下依赖,用到哪个装哪个。github.com/go-xorm/xorm驱动Mysql:github.com/go-sql-driver/mysqlPostgres:github.com/lib/pqSQLite:github.com/mattn/go-sqlite3MSSQL:github.com/denisenkom/go-mssqldb逆向生成Reverse命令可以转换数据库到所有支持的语言的数据结构,安装以后可以用xormhelpreverse查看帮助。例子:c...
继续阅读 >