aa
This commit is contained in:
20
dao/config_dao.go
Normal file
20
dao/config_dao.go
Normal file
@@ -0,0 +1,20 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user