1. gorm操作mysql: 1.1 安装gorm gorm官网: https://gorm.io/zh_CN/docs/connecting_to_the_database.html gorm的github地址:https://github.com/go-gorm/gorm go get -u gorm.io/gorm 1.2 安装mysql驱动 go get -u gorm.io/driver/mysql 2. 连接Mysql.自动迁移生成数据表.基本的增删改查 package main
一.JSON类型 答案是不可以 为Json类型建索引会报错 mysql)); ERROR (): JSON column 'card_pay_data' cannot be used in key specification. 二.text类型 答案是可以的,但是需要指定长度 mysql> CREATE INDEX idx2 ON user (tests); ERROR (): BLOB/TEXT column 'tests' used in key specification without