Skip to content

Commit

Permalink
Remove end returns
Browse files Browse the repository at this point in the history
  • Loading branch information
lispyclouds committed Dec 31, 2020
1 parent 7b94227 commit 0f5e1de
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ func encodeResult(result sql.Result) (ExecResult, error) {
return nil, err
}
lastInsertedId, err := result.LastInsertId()

if err != nil {
return nil, err
}
Expand All @@ -75,6 +74,7 @@ func encodeResult(result sql.Result) (ExecResult, error) {
transit.Keyword("rows-affected"): rowsAffected,
transit.Keyword("last-inserted-id"): lastInsertedId,
}

return res, nil
}

Expand Down Expand Up @@ -168,9 +168,9 @@ func processMessage(message *babashka.Message) {
babashka.WriteErrorResponse(message, err)
return
}

if json, err := encodeResult(res); err != nil {
babashka.WriteErrorResponse(message, err)
return
} else {
respond(message, json)
}
Expand All @@ -183,17 +183,14 @@ func processMessage(message *babashka.Message) {

if json, err := encodeRows(res); err != nil {
babashka.WriteErrorResponse(message, err)
return
} else {
respond(message, json)
}
default:
babashka.WriteErrorResponse(message, fmt.Errorf("Unknown var %s", message.Var))
return
}
default:
babashka.WriteErrorResponse(message, fmt.Errorf("Unknown op %s", message.Op))
return
}
}

Expand Down

0 comments on commit 0f5e1de

Please sign in to comment.