Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

无法使用mysql吗?看代码固定了数据库类型 #5

Open
datangkang123 opened this issue Sep 14, 2024 · 0 comments
Open

无法使用mysql吗?看代码固定了数据库类型 #5

datangkang123 opened this issue Sep 14, 2024 · 0 comments

Comments

@datangkang123
Copy link

`package config

import (
"go-app/lib/util"

"github.com/sakirsensoy/genv"

)

type DBTYPE uint16

const (
_ DBTYPE = iota
DBTYPE_MYSQL
DBTYPE_MSSQL
DBTYPE_POSTGRES
)

type dbConf struct {
DSN string
DB_TYPE DBTYPE
}

var DB_APP = &dbConf{
DSN: util.PostgresDSN(
genv.Key("DB_APP_HOST").Default("postgres").String(),
genv.Key("DB_APP_USER").Default("root").String(),
genv.Key("DB_APP_PASS").Default("111222").String(),
genv.Key("DB_APP_PORT").Default("5432").String(),
genv.Key("DB_APP_DBNAME").Default("go_admin").String(),
),
DB_TYPE: DBTYPE_POSTGRES,
}
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant