![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Go之ORM
go的orm使用
来自万古的忧伤
努力,勿让自己继续活在后悔中
展开
-
Gorm-CRUD(2)
package mainimport ( "fmt" _ "github.com/jinzhu/gorm/dialects/mysql" "github.com/jinzhu/gorm" "time")var ( //变量db 通过init直接初始化 db *gorm.DB err error dbinfo string)const ( //定义db的连接信息 dbuser string = "root" dbpassword = "123456" dbip =原创 2020-06-27 23:19:06 · 231 阅读 · 0 评论 -
Gorm-CRUD(1)
package mainimport ( "fmt" _ "github.com/jinzhu/gorm/dialects/mysql" "github.com/jinzhu/gorm" "time")var ( //变量db 通过init直接初始化 db *gorm.DB err error dbinfo string)const ( //定义db的连接信息 dbuser string = "root" dbpassword = "123456" dbip =原创 2020-06-27 23:18:03 · 312 阅读 · 0 评论 -
Gorm(表的操作以及索引的操作)
package mainimport ( "fmt" _ "github.com/jinzhu/gorm/dialects/mysql" "github.com/jinzhu/gorm" "time")var ( //变量db 通过init直接初始化 db *gorm.DB err error dbinfo string)const ( //定义db的连接信息 dbuser string = "root" dbpassword = "123456" dbip =原创 2020-06-26 16:27:17 · 4720 阅读 · 0 评论 -
Gorm(简介)
ORMObject Relation Mapping(关系对象映射)把对象模型表示的对象映射到基于S Q L 的关系模型数据库结构中在具体的操作实体对象的时候,不需要直接与复杂的 SQL语句打交道,只需简单的操作实体对象的属性和方法Gorm是使用go语言开发的ORM库地址: github.com/jinzhu/gorm驱动:github.com/go-sql-driver/mysql导入:github.com/jinzhu/gorm/dialects/mysql连接设置username原创 2020-06-26 16:26:07 · 5939 阅读 · 0 评论