-module(galchemy@examples@returning_example). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]). -define(FILEPATH, "src\\galchemy\\examples\\returning_example.gleam"). -export([build_insert/0, build_update/0, main/0]). -file("src\\galchemy\\examples\\returning_example.gleam", 10). -spec users_table() -> galchemy@ast@schema:table(). users_table() -> galchemy@dsl@table:table(<<"users"/utf8>>). -file("src\\galchemy\\examples\\returning_example.gleam", 14). -spec users_id() -> galchemy@ast@schema:column(integer()). users_id() -> galchemy@dsl@table:int(users_table(), <<"id"/utf8>>). -file("src\\galchemy\\examples\\returning_example.gleam", 18). -spec users_name() -> galchemy@ast@schema:column(binary()). users_name() -> galchemy@dsl@table:text(users_table(), <<"name"/utf8>>). -file("src\\galchemy\\examples\\returning_example.gleam", 22). -spec build_insert() -> galchemy@ast@query:insert_query(). build_insert() -> _pipe = galchemy@dsl@insert:insert_into(users_table()), _pipe@1 = galchemy@dsl@insert:value( _pipe, users_name(), galchemy@dsl@expr:text(<<"Ann"/utf8>>) ), galchemy@dsl@insert:returning( _pipe@1, [galchemy@dsl@expr:item(galchemy@dsl@expr:col(users_id())), galchemy@dsl@expr:item(galchemy@dsl@expr:col(users_name()))] ). -file("src\\galchemy\\examples\\returning_example.gleam", 31). -spec build_update() -> galchemy@ast@query:update_query(). build_update() -> _pipe = galchemy@dsl@update:update(users_table()), _pipe@1 = galchemy@dsl@update:set( _pipe, users_name(), galchemy@dsl@expr:text(<<"Bob"/utf8>>) ), galchemy@dsl@update:returning( _pipe@1, [galchemy@dsl@expr:item(galchemy@dsl@expr:col(users_id())), galchemy@dsl@expr:item(galchemy@dsl@expr:col(users_name()))] ). -file("src\\galchemy\\examples\\returning_example.gleam", 40). -spec main() -> nil. main() -> gleam_stdlib:println(<<"Returning example"/utf8>>), gleam_stdlib:println( gleam@string:inspect(galchemy:compile({insert, build_insert()})) ), gleam_stdlib:println( gleam@string:inspect(galchemy:compile({update, build_update()})) ).