@@ -4,6 +4,8 @@ namespace SpacetimeDB.Internal;
44using System . Runtime . InteropServices ;
55using SpacetimeDB ;
66using SpacetimeDB . BSATN ;
7+ using System . Collections . Generic ;
8+ using System . Text ;
79
810partial class RawModuleDefV9
911{
@@ -38,7 +40,15 @@ internal AlgebraicType.Ref RegisterType<T>(Func<AlgebraicType.Ref, AlgebraicType
3840
3941 internal void RegisterRowLevelSecurity ( RawRowLevelSecurityDefV9 rls ) =>
4042 RowLevelSecurity . Add ( rls ) ;
41-
43+
44+ internal void RegisterTableDefaultValue ( string table , ushort colId , string value ) {
45+ var byteArray = Encoding . UTF8 . GetBytes ( value ) ;
46+ var byteList = new List < byte > ( byteArray ) ;
47+ MiscExports . Add ( new RawMiscModuleExportV9 . ColumnDefaultValue (
48+ new RawColumnDefaultValueV9 ( table , colId , byteList )
49+ ) ) ;
50+ }
51+
4252}
4353
4454public static class Module
@@ -94,10 +104,7 @@ public static void RegisterReducer<R>()
94104
95105 public static void RegisterTable < T , View > ( )
96106 where T : IStructuralReadWrite , new ( )
97- where View : ITableView < View , T > , new ( )
98- {
99- moduleDef . RegisterTable ( View . MakeTableDesc ( typeRegistrar ) ) ;
100- }
107+ where View : ITableView < View , T > , new ( ) => moduleDef . RegisterTable ( View . MakeTableDesc ( typeRegistrar ) ) ;
101108
102109 public static void RegisterClientVisibilityFilter ( Filter rlsFilter )
103110 {
@@ -111,6 +118,8 @@ public static void RegisterClientVisibilityFilter(Filter rlsFilter)
111118 }
112119 }
113120
121+ public static void RegisterTableDefaultValue ( string table , ushort colId , string value ) => moduleDef . RegisterTableDefaultValue ( table , colId , value ) ;
122+
114123 private static byte [ ] Consume ( this BytesSource source )
115124 {
116125 if ( source == BytesSource . INVALID )
0 commit comments