File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
crates/cli/src/subcommands/generate Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -1113,6 +1113,37 @@ fn autogen_csharp_access_funcs_for_struct(
11131113 . unwrap ( ) ;
11141114 }
11151115 writeln ! ( output, "}}" ) . unwrap ( ) ;
1116+ writeln ! ( output) . unwrap ( ) ;
1117+
1118+ writeln ! (
1119+ output,
1120+ "public static SpacetimeDB.SATS.AlgebraicValue GetPrimaryKeyValue(SpacetimeDB.SATS.AlgebraicValue v)"
1121+ )
1122+ . unwrap ( ) ;
1123+ writeln ! ( output, "{{" ) . unwrap ( ) ;
1124+ {
1125+ indent_scope ! ( output) ;
1126+ writeln ! ( output, "return v.AsProductValue().elements[{}];" , primary_col_index) . unwrap ( ) ;
1127+ }
1128+ writeln ! ( output, "}}" ) . unwrap ( ) ;
1129+ writeln ! ( output) . unwrap ( ) ;
1130+
1131+ writeln ! (
1132+ output,
1133+ "public static SpacetimeDB.SATS.AlgebraicType GetPrimaryKeyType(SpacetimeDB.SATS.AlgebraicType t)"
1134+ )
1135+ . unwrap ( ) ;
1136+ writeln ! ( output, "{{" ) . unwrap ( ) ;
1137+ {
1138+ indent_scope ! ( output) ;
1139+ writeln ! (
1140+ output,
1141+ "return t.product.elements[{}].algebraicType;" ,
1142+ primary_col_index
1143+ )
1144+ . unwrap ( ) ;
1145+ }
1146+ writeln ! ( output, "}}" ) . unwrap ( ) ;
11161147 } else {
11171148 writeln ! (
11181149 output,
You can’t perform that action at this time.
0 commit comments