(key string, configtype string, transaction *sqlx.Tx)
| 176 | } |
| 177 | |
| 178 | func (configStore *ConfigStore) GetConfigValueFor(key string, configtype string, transaction *sqlx.Tx) (string, error) { |
| 179 | var val interface{} |
| 180 | |
| 181 | s, v, err := statementbuilder.Squirrel.Select("value"). |
| 182 | From(settingsTableName).Prepared(true). |
| 183 | Where(goqu.Ex{"name": key}). |
| 184 | Where(goqu.Ex{"configstate": "enabled"}). |
| 185 | Where(goqu.Ex{"configenv": configStore.defaultEnv}). |
| 186 | Where(goqu.Ex{"configtype": configtype}).ToSQL() |
| 187 | |
| 188 | CheckErr(err, "[180] failed to create config select query") |
| 189 | |
| 190 | stmt1, err := transaction.Preparex(s) |
| 191 | if err != nil { |
| 192 | log.Errorf("[186] failed to prepare statment [%s]: %v", s, err) |
| 193 | return "", err |
| 194 | } |
| 195 | defer stmt1.Close() |
| 196 | err = stmt1.QueryRowx(v...).Scan(&val) |
| 197 | if err != nil { |
| 198 | log.Printf("[198] No config value set for [%v]: %v", key, err) |
| 199 | return "", err |
| 200 | } |
| 201 | return fmt.Sprintf("%s", val), err |
| 202 | } |
| 203 | |
| 204 | func (configStore *ConfigStore) GetConfigValueForWithTransaction(key string, configtype string, transaction *sqlx.Tx) (string, error) { |
| 205 | var val interface{} |
no test coverage detected