# README
数据库组件(mysql)
如何引用
- 代码
import (
_ "github.com/GuoxinL/gcomponent/components/mysql-gorm"
)
- 配置文件(application.yaml)
components:
mysql:
dataSources:
- name: test1
url: 127.0.0.1:3306
database: test1
username: mysql
password: mysql
MaxIdleConns: 100
MaxOpenConns: 10
ConnMaxLifetime: 60
- name: test
url: 127.0.0.1:3306
database: test
username: root
password: mysql
MaxIdleConns: 100
MaxOpenConns: 10
ConnMaxLifetime: 60
如何使用
- func GetInstance(name string) *gorm.DB
注释:通过该方法获得
gorm.DB
对象 参数:name与配置文件中components.mysql.dataSources.name
字段对应 返回值:*gorm.DB
# Functions
GetInstance 通过该方法获得*gorm.DB对象.
GetInstance0 通过该方法获得*gorm.DB对象.
No description provided by the author
# Variables
No description provided by the author
# Structs
No description provided by the author