File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -153,7 +153,7 @@ fn (mut g Gen) sql_stmt_line(stmt_line ast.SqlStmtLine, connection_var_name stri
153153fn (mut g Gen) write_orm_connection_init (connection_var_name string , db_expr & ast.Expr) {
154154 db_expr_type := g.get_db_expr_type (db_expr) or { verror ('ORM: unknown db type for ${db_expr }' ) }
155155
156- mut db_ctype_name := g.styp (db_expr_type)
156+ mut db_ctype_name := g.styp (db_expr_type. clear_flag (.shared_f) )
157157 is_pointer := db_ctype_name.ends_with ('*' )
158158 reference_sign := if is_pointer { '' } else { '&' }
159159 db_ctype_name = db_ctype_name.trim_right ('*' )
@@ -166,7 +166,13 @@ fn (mut g Gen) write_orm_connection_init(connection_var_name string, db_expr &as
166166 g.writeln (';' )
167167 } else {
168168 g.write ('(orm__Connection){._${db_ctype_name } = ${reference_sign }' )
169+ if db_expr_type.has_flag (.shared_f) {
170+ g.write ('&' )
171+ }
169172 g.expr (db_expr)
173+ if db_expr_type.has_flag (.shared_f) {
174+ g.write ('->val' )
175+ }
170176 g.writeln (', ._typ = _orm__Connection_${db_ctype_name }_index};' )
171177 }
172178}
You can’t perform that action at this time.
0 commit comments