fix: rename Db to DB

This commit is contained in:
Flc゛ 2023-03-28 15:06:01 +08:00
parent 212cf19d05
commit 28e0522993
2 changed files with 4 additions and 4 deletions

6
dsn.go
View File

@ -10,14 +10,14 @@ type DSN struct {
Port int
User string
Pass string
Db string
DB string
Options map[string]string
}
func (d DSN) String() string {
dsn := d.User + ":" + d.Pass + "@tcp(" + d.Host + ":" + strconv.Itoa(d.Port) + ")/" + d.Db
dsn := d.User + ":" + d.Pass + "@tcp(" + d.Host + ":" + strconv.Itoa(d.Port) + ")/" + d.DB
if d.Options != nil {
if d.Options != nil && len(d.Options) > 0 {
value := url.Values{}
for k, v := range d.Options {

View File

@ -8,7 +8,7 @@ func TestDsn(t *testing.T) {
Port: 3306,
User: "root",
Pass: "password",
Db: "gorm",
DB: "gorm",
}
t.Run("dsn string", func(t *testing.T) {