Add structured coroutines and explicit error handling
This commit is contained in:
parent
de1262b4cf
commit
fe62e81152
31 changed files with 1701 additions and 325 deletions
|
|
@ -47,6 +47,11 @@ func splitSQLChain(expr Expr) (CallExpr, string, []sqlCallStep, bool) {
|
|||
}
|
||||
|
||||
func (g *goGenerator) lowerSQLQuery(expr Expr) (string, bool, error) {
|
||||
if call, ok := expr.(CallExpr); ok {
|
||||
if selector, ok := call.Callee.(SelectorExpr); ok && (selector.Name == "unwrap" || selector.Name == "unwrapOr") {
|
||||
return "", false, nil
|
||||
}
|
||||
}
|
||||
root, operation, steps, ok := splitSQLChain(expr)
|
||||
if !ok {
|
||||
return "", false, nil
|
||||
|
|
@ -166,11 +171,11 @@ func sqlChainResultType(expr Expr) (string, bool) {
|
|||
}
|
||||
switch terminal {
|
||||
case "fetch":
|
||||
return "List<*" + resultType + ">", true
|
||||
return "Result<List<*" + resultType + ">, Error>", true
|
||||
case "single":
|
||||
return "*" + resultType, true
|
||||
return "Result<*" + resultType + ", Error>", true
|
||||
case "iterator":
|
||||
return "GotlinSQLIterator<" + resultType + ">", true
|
||||
return "Result<GotlinSQLIterator<" + resultType + ">, Error>", true
|
||||
default:
|
||||
return "", false
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue