Files
jx-print/dao/config_dao.go
suyl 09a89bf5b3 aa
2021-07-23 14:34:24 +08:00

21 lines
485 B
Go

package dao
import (
"git.rosy.net.cn/jx-print/model"
"github.com/jmoiron/sqlx"
)
func GetConfig(db *sqlx.DB, configType, key string) (config *model.NewConfig, err error) {
var (
configs []*model.NewConfig
)
sql := `
SELECT * FROM new_config WHERE ` + "`type`" + ` = ? AND ` + "`key`" + ` = ?
`
sqlParams := []interface{}{configType, key}
if err = db.Select(&configs, sql, sqlParams...); err == nil && len(configs) > 0 {
return configs[0], err
}
return config, err
}