package
0.0.2
Repository: https://github.com/guoxinl/gcomponent.git
Documentation: pkg.go.dev

# README

数据库组件(mysql)

如何引用

  1. 代码
import (
    _ "github.com/GuoxinL/gcomponent/components/mysql-gorm"
)
  1. 配置文件(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

如何使用

  1. 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