Add structured coroutines and explicit error handling

This commit is contained in:
pavel 2026-08-27 16:26:40 +02:00
commit fe62e81152
31 changed files with 1701 additions and 325 deletions

View file

@ -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
}