mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
minor postgres fix (#392)
This commit is contained in:
committed by
Travis Reeder
parent
f7f1015e4d
commit
7183c440d9
@@ -205,10 +205,6 @@ func scanApp(scanner rowScanner, app *models.App) error {
|
|||||||
&configStr,
|
&configStr,
|
||||||
)
|
)
|
||||||
|
|
||||||
if configStr == "" {
|
|
||||||
return models.ErrAppsNotFound
|
|
||||||
}
|
|
||||||
|
|
||||||
json.Unmarshal([]byte(configStr), &app.Config)
|
json.Unmarshal([]byte(configStr), &app.Config)
|
||||||
|
|
||||||
return err
|
return err
|
||||||
@@ -536,7 +532,7 @@ func (ds *PostgresDatastore) Put(ctx context.Context, key, value []byte) error {
|
|||||||
VALUES ($1, $2)
|
VALUES ($1, $2)
|
||||||
ON CONFLICT (key) DO UPDATE SET
|
ON CONFLICT (key) DO UPDATE SET
|
||||||
value = $1;
|
value = $1;
|
||||||
`, value)
|
`, string(key), string(value))
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -548,7 +544,7 @@ func (ds *PostgresDatastore) Put(ctx context.Context, key, value []byte) error {
|
|||||||
func (ds *PostgresDatastore) Get(ctx context.Context, key []byte) ([]byte, error) {
|
func (ds *PostgresDatastore) Get(ctx context.Context, key []byte) ([]byte, error) {
|
||||||
row := ds.db.QueryRow("SELECT value FROM extras WHERE key=$1", key)
|
row := ds.db.QueryRow("SELECT value FROM extras WHERE key=$1", key)
|
||||||
|
|
||||||
var value []byte
|
var value string
|
||||||
err := row.Scan(&value)
|
err := row.Scan(&value)
|
||||||
if err == sql.ErrNoRows {
|
if err == sql.ErrNoRows {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
@@ -556,5 +552,5 @@ func (ds *PostgresDatastore) Get(ctx context.Context, key []byte) ([]byte, error
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return value, nil
|
return []byte(value), nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user