【优化】不对没有注释的类或者字段生成注释代码

main
walon 2021-08-12 19:03:14 +08:00
parent 6bd3b14596
commit 9b7e5848e4
16 changed files with 186 additions and 10 deletions

View File

@ -40,9 +40,11 @@ namespace Luban.Job.Cfg.Generate
hierarchy_export_fields = x.hierarchy_export_fields
}}
{{~if x.comment != '' ~}}
/**
{{x.comment}}
* {{x.comment}}
*/
{{~end~}}
class {{name}} : public {{if parent_def_type}} {{parent_def_type.cpp_full_name}} {{else}} bright::CfgBean {{end}}
{
public:
@ -71,9 +73,11 @@ class {{name}} : public {{if parent_def_type}} {{parent_def_type.cpp_full_name}}
bool deserialize(ByteBuf& _buf);
{{~ for field in export_fields ~}}
{{~if field.comment != '' ~}}
/**
{{field.comment}}
* {{field.comment}}
*/
{{~end~}}
{{cpp_define_type field.ctype}} {{field.cpp_style_name}};
{{~if field.index_field~}}
::bright::HashMap<{{cpp_define_type field.index_field.ctype}}, {{cpp_define_type field.ctype.element_type}}> {{field.cpp_style_name}}_Index;
@ -115,9 +119,11 @@ class {{name}} : public {{if parent_def_type}} {{parent_def_type.cpp_full_name}}
value_type = x.value_ttype
~}}
{{~if x.comment != '' ~}}
/**
{{x.comment}}
* {{x.comment}}
*/
{{~end~}}
class {{name}}
{
{{~if x.is_map_table ~}}
@ -185,9 +191,11 @@ class {{name}}
}
{{~ for field in value_type.bean.hierarchy_export_fields ~}}
{{~if field.comment != '' ~}}
/**
{{field.comment}}
* {{field.comment}}
*/
{{~end~}}
{{cpp_define_type field.ctype}}& {{field.cpp_getter_name}}() const { return _data->{{field.cpp_style_name}}; }
{{~end~}}
{{~end~}}
@ -208,9 +216,11 @@ class {{name}}
{
public:
{{~for table in tables ~}}
{{~if table.comment != '' ~}}
/**
{{table.comment}}
*/
{{~end~}}
{{table.cpp_full_name}} {{table.name}};
{{~end~}}

View File

@ -26,9 +26,11 @@ using System.Collections.Generic;
namespace {{x.namespace_with_top_module}}
{
{{~if x.comment != '' ~}}
/// <summary>
/// {{x.comment}}
/// </summary>
{{~end~}}
public {{x.cs_class_modifier}} partial class {{name}} : {{if parent_def_type}} {{x.parent}} {{else}} Bright.Config.BeanBase {{end}}
{
public {{name}}(ByteBuf _buf) {{if parent_def_type}} : base(_buf) {{end}}
@ -73,9 +75,11 @@ public {{x.cs_class_modifier}} partial class {{name}} : {{if parent_def_type}} {
}
{{~ for field in export_fields ~}}
{{~if field.comment != '' ~}}
/// <summary>
/// {{field.comment}}
/// </summary>
{{~end~}}
public readonly {{cs_define_type field.ctype}} {{field.cs_style_name}};
{{~if field.index_field~}}
public readonly Dictionary<{{cs_define_type field.index_field.ctype}}, {{cs_define_type field.ctype.element_type}}> {{field.cs_style_name}}_Index = new Dictionary<{{cs_define_type field.index_field.ctype}}, {{cs_define_type field.ctype.element_type}}>();
@ -142,9 +146,11 @@ namespace {{x.namespace_with_top_module}}
key_type2 = x.key_ttype2
value_type = x.value_ttype
}}
{{~if x.comment != '' ~}}
/// <summary>
/// {{x.comment}}
/// </summary>
{{~end~}}
public sealed partial class {{name}}
{
{{~if x.is_map_table ~}}
@ -198,9 +204,11 @@ public sealed partial class {{name}}
{{~ for field in value_type.bean.hierarchy_export_fields ~}}
{{~if field.comment != '' ~}}
/// <summary>
/// {{field.comment}}
/// </summary>
{{~end~}}
public {{cs_define_type field.ctype}} {{field.cs_style_name}} => _data.{{field.cs_style_name}};
{{~if field.ref~}}
public {{field.cs_ref_type_name}} {{field.cs_ref_var_name}} => _data.{{field.cs_ref_var_name}};
@ -244,9 +252,11 @@ namespace {{namespace}}
public sealed class {{name}}
{
{{~for table in tables ~}}
{{~if table.comment != '' ~}}
/// <summary>
/// {{table.comment}}
/// </summary>
{{~end~}}
public {{table.full_name}} {{table.name}} {get; }
{{~end~}}

View File

@ -27,9 +27,11 @@ using System.Text.Json;
namespace {{x.namespace_with_top_module}}
{
{{~if x.comment != '' ~}}
/// <summary>
/// {{x.comment}}
/// </summary>
{{~end~}}
public {{x.cs_class_modifier}} partial class {{name}} : {{if parent_def_type}} {{parent}} {{else}} Bright.Config.BeanBase {{end}}
{
public {{name}}(JsonElement _json) {{if parent_def_type}} : base(_json) {{end}}
@ -68,9 +70,11 @@ public {{x.cs_class_modifier}} partial class {{name}} : {{if parent_def_type}} {
}
{{~ for field in export_fields ~}}
{{~if field.comment != '' ~}}
/// <summary>
/// {{field.comment}}
/// </summary>
{{~end~}}
public readonly {{cs_define_type field.ctype}} {{field.cs_style_name}};
{{~if field.index_field~}}
public readonly Dictionary<{{cs_define_type field.index_field.ctype}}, {{cs_define_type field.ctype.element_type}}> {{field.cs_style_name}}_Index = new Dictionary<{{cs_define_type field.index_field.ctype}}, {{cs_define_type field.ctype.element_type}}>();
@ -139,9 +143,11 @@ using System.Text.Json;
namespace {{x.namespace_with_top_module}}
{
{{~if x.comment != '' ~}}
/// <summary>
/// {{x.comment}}
/// </summary>
{{~end~}}
public sealed partial class {{name}}
{
{{~if x.is_map_table ~}}
@ -193,9 +199,11 @@ public sealed partial class {{name}}
}
{{~ for field in value_type.bean.hierarchy_export_fields ~}}
{{~if field.comment != '' ~}}
/// <summary>
/// {{field.comment}}
/// </summary>
{{~end~}}
public {{cs_define_type field.ctype}} {{field.cs_style_name}} => _data.{{field.cs_style_name}};
{{~if field.ref~}}
public {{field.cs_ref_type_name}} {{field.cs_ref_var_name}} => _data.{{field.cs_ref_var_name}};
@ -239,9 +247,11 @@ namespace {{namespace}}
public sealed partial class {{name}}
{
{{~for table in tables ~}}
{{~if table.comment != '' ~}}
/// <summary>
/// {{table.comment}}
/// </summary>
{{~end~}}
public {{table.full_name}} {{table.name}} {get; }
{{~end~}}

View File

@ -27,9 +27,11 @@ using SimpleJSON;
namespace {{x.namespace_with_top_module}}
{
{{~if x.comment != '' ~}}
/// <summary>
/// {{x.comment}}
/// </summary>
{{~end~}}
public {{x.cs_class_modifier}} partial class {{name}} : {{if parent_def_type}} {{parent}} {{else}} Bright.Config.BeanBase {{end}}
{
public {{name}}(JSONNode _json) {{if parent_def_type}} : base(_json) {{end}}
@ -69,9 +71,11 @@ public {{x.cs_class_modifier}} partial class {{name}} : {{if parent_def_type}} {
}
{{~ for field in export_fields ~}}
{{~if field.comment != '' ~}}
/// <summary>
/// {{field.comment}}
/// </summary>
{{~end~}}
public readonly {{cs_define_type field.ctype}} {{field.cs_style_name}};
{{~if field.index_field~}}
public readonly Dictionary<{{cs_define_type field.index_field.ctype}}, {{cs_define_type field.ctype.element_type}}> {{field.cs_style_name}}_Index = new Dictionary<{{cs_define_type field.index_field.ctype}}, {{cs_define_type field.ctype.element_type}}>();
@ -140,9 +144,11 @@ using SimpleJSON;
namespace {{x.namespace_with_top_module}}
{
{{~if x.comment != '' ~}}
/// <summary>
/// {{x.comment}}
/// </summary>
{{~end~}}
public sealed partial class {{name}}
{
{{~if x.is_map_table ~}}
@ -197,9 +203,11 @@ public sealed partial class {{name}}
}
{{~ for field in value_type.bean.hierarchy_export_fields ~}}
{{~if field.comment != '' ~}}
/// <summary>
/// {{field.comment}}
/// </summary>
{{~end~}}
public {{cs_define_type field.ctype}} {{field.cs_style_name}} => _data.{{field.cs_style_name}};
{{~if field.ref~}}
public {{field.cs_ref_type_name}} {{field.cs_ref_var_name}} => _data.{{field.cs_ref_var_name}};
@ -243,9 +251,11 @@ namespace {{namespace}}
public sealed partial class {{name}}
{
{{~for table in tables ~}}
{{~if table.comment != '' ~}}
/// <summary>
/// {{table.comment}}
/// </summary>
{{~end~}}
public {{table.full_name}} {{table.name}} {get; }
{{~end~}}

View File

@ -26,9 +26,11 @@ import bright.serialization.*;
hierarchy_export_fields = x.hierarchy_export_fields
}}
{{~if x.comment != '' ~}}
/**
* {{x.comment}}
*/
{{~end~}}
public {{x.java_class_modifier}} class {{name}} extends {{if parent_def_type}} {{x.parent_def_type.full_name_with_top_module}} {{else}} bright.serialization.AbstractBean {{end}}
{
public {{name}}(ByteBuf _buf)
@ -79,9 +81,11 @@ public {{x.java_class_modifier}} class {{name}} extends {{if parent_def_type}} {
}
{{~ for field in export_fields ~}}
{{~if field.comment != '' ~}}
/**
* {{field.comment}}
*/
{{~end~}}
public final {{java_define_type field.ctype}} {{field.java_style_name}};
{{~if field.index_field~}}
public final java.util.HashMap<{{java_box_define_type field.index_field.ctype}}, {{java_box_define_type field.ctype.element_type}}> {{field.java_style_name}}_Index = new java.util.HashMap<>();
@ -158,9 +162,11 @@ import bright.serialization.*;
value_type = x.value_ttype
~}}
{{~if x.comment != '' ~}}
/**
* {{x.comment}}
*/
{{~end~}}
public final class {{name}}
{
{{~if x.is_map_table ~}}
@ -212,9 +218,11 @@ public final class {{name}}
{{~ for field in value_type.bean.hierarchy_export_fields ~}}
{{~if field.comment != '' ~}}
/**
* {{field.comment}}
*/
{{~end~}}
public {{java_define_type field.ctype}} {{field.java_getter_name}}() { return _data.{{field.java_style_name}}; }
{{~end~}}
@ -247,9 +255,11 @@ public final class {{name}}
}
{{~for table in tables ~}}
{{~if table.comment != '' ~}}
/**
* {{table.comment}}
*/
{{~end~}}
public final {{table.full_name_with_top_module}} {{table.name}};
{{~end~}}

View File

@ -23,9 +23,11 @@ namespace Luban.Job.Cfg.Generate
hierarchy_export_fields = x.hierarchy_export_fields
}}
{{~if x.comment != '' ~}}
'''
{{x.comment}}
'''
{{~end~}}
class {{name}} {{if parent_def_type}}({{parent_def_type.py_full_name}}){{end}}:
{{~if x.is_abstract_type~}}
_childrenTypes = None
@ -78,9 +80,11 @@ class {{name}} {{if parent_def_type}}({{parent_def_type.py_full_name}}){{end}}:
key_type2 = x.key_ttype2
value_type = x.value_ttype
}}
{{~if x.comment != '' ~}}
'''
{{x.comment}}
'''
{{~end~}}
class {{name}}:
{{~if x.is_map_table ~}}
@ -107,9 +111,11 @@ class {{name}}:
def getData(self) : return self._data
{{~ for field in value_type.bean.hierarchy_export_fields ~}}
{{~if field.comment != '' ~}}
'''
{{field.comment}}
'''
{{~end~}}
def {{field.py_style_name}}(self) : return self._data.{{field.py_style_name}}
{{~end~}}
{{~end~}}

View File

@ -101,9 +101,11 @@ class {{name}}:
def getData(self) : return self._data
{{~ for field in value_type.bean.hierarchy_export_fields ~}}
{{~if field.comment != '' ~}}
'''
{{field.comment}}
'''
{{~end~}}
def {{field.py_style_name}}(self) : return self._data.{{field.py_style_name}}
{{~end~}}
{{~end~}}

View File

@ -21,14 +21,18 @@ namespace Luban.Job.Cfg.Generate
var template = t_tsConstRender ??= Template.Parse(@"
{{~if x.comment != '' ~}}
'''
{{x.comment}}
'''
{{~end~}}
class {{x.py_full_name}}:
{{~ for item in x.items ~}}
{{~if item.comment != '' ~}}
'''
{{item.comment}}
'''
{{~end~}}
{{item.name}} = {{py_const_value item.ctype item.value}}
{{~end~}}
{{~if (x.items == empty)~}}
@ -46,14 +50,18 @@ class {{x.py_full_name}}:
public override string Render(DefEnum e)
{
var template = t_tsEnumRender ??= Template.Parse(@"
{{~if comment != '' ~}}
'''
{{comment}}
'''
{{~end~}}
class {{py_full_name}}:
{{~ for item in items ~}}
{{~if item.comment != '' ~}}
'''
{{item.comment}}
'''
{{~end~}}
{{item.name}} = {{item.value}}
{{~end~}}
{{~if (items == empty)~}}

View File

@ -23,9 +23,11 @@ namespace Luban.Job.Cfg.Generate
}}
{{x.typescript_namespace_begin}}
{{~if x.comment != '' ~}}
/**
* {{x.comment}}
*/
{{~end~}}
export {{if x.is_abstract_type}} abstract {{end}} class {{name}} {{if parent_def_type}} extends {{x.parent}}{{end}} {
{{~if x.is_abstract_type~}}
static constructorFrom(_buf_: ByteBuf): {{name}} {
@ -48,9 +50,11 @@ export {{if x.is_abstract_type}} abstract {{end}} class {{name}} {{if parent_def
}
{{~ for field in export_fields ~}}
{{~if field.comment != '' ~}}
/**
* {{field.comment}}
*/
{{~end~}}
readonly {{field.ts_style_name}}{{if field.is_nullable}}?{{end}}: {{ts_define_type field.ctype}}
{{~if field.gen_ref~}}
{{field.ts_ref_validator_define}}
@ -91,9 +95,11 @@ export {{if x.is_abstract_type}} abstract {{end}} class {{name}} {{if parent_def
value_type = x.value_ttype
}}
{{x.typescript_namespace_begin}}
{{~if x.comment != '' ~}}
/**
* {{x.comment}}
*/
{{~end~}}
export class {{name}} {
{{~if x.is_map_table ~}}
private _dataMap: Map<{{ts_define_type key_type}}, {{ts_define_type value_type}}>
@ -134,9 +140,11 @@ export class {{name}} {
getData(): {{ts_define_type value_type}} { return this._data }
{{~ for field in value_type.bean.hierarchy_export_fields ~}}
{{~if field.comment != '' ~}}
/**
* {{field.comment}}
*/
{{~end~}}
get {{field.ts_style_name}}(): {{ts_define_type field.ctype}} { return this._data.{{field.ts_style_name}} }
{{~end~}}
@ -170,9 +178,11 @@ type ByteBufLoader = (file: string) => ByteBuf
export class {{name}} {
{{~ for table in tables ~}}
private _{{table.name}}: {{table.full_name}}
{{~if table.comment != '' ~}}
/**
* {{table.comment}}
*/
{{~end~}}
get {{table.name}}(): {{table.full_name}} { return this._{{table.name}}}
{{~end~}}

View File

@ -23,9 +23,11 @@ namespace Luban.Job.Cfg.Generate
}}
{{x.typescript_namespace_begin}}
{{~if x.comment != '' ~}}
/**
* {{x.comment}}
*/
{{~end~}}
export {{if x.is_abstract_type}} abstract {{end}} class {{name}} {{if parent_def_type}} extends {{x.parent}}{{end}} {
{{~if x.is_abstract_type~}}
static constructorFrom(_json_: any): {{name}} {
@ -51,9 +53,11 @@ export {{if x.is_abstract_type}} abstract {{end}} class {{name}} {{if parent_def
}
{{~ for field in export_fields ~}}
{{~if field.comment != '' ~}}
/**
* {{field.comment}}
*/
{{~end~}}
readonly {{field.ts_style_name}}{{if field.is_nullable}}?{{end}}: {{ts_define_type field.ctype}}
{{~if field.gen_ref~}}
{{field.ts_ref_validator_define}}
@ -94,9 +98,11 @@ export {{if x.is_abstract_type}} abstract {{end}} class {{name}} {{if parent_def
value_type = x.value_ttype
}}
{{x.typescript_namespace_begin}}
{{~if x.comment != '' ~}}
/**
* {{x.comment}}
*/
{{~end~}}
export class {{name}}{
{{~if x.is_map_table ~}}
private _dataMap: Map<{{ts_define_type key_type}}, {{ts_define_type value_type}}>
@ -134,9 +140,11 @@ export class {{name}}{
getData(): {{ts_define_type value_type}} { return this._data; }
{{~ for field in value_type.bean.hierarchy_export_fields ~}}
{{~if field.comment != '' ~}}
/**
* {{field.comment}}
*/
{{~end~}}
get {{field.ts_style_name}}(): {{ts_define_type field.ctype}} { return this._data.{{field.ts_style_name}}; }
{{~end~}}
@ -170,9 +178,11 @@ type JsonLoader = (file: string) => any
export class {{name}} {
{{~ for table in tables ~}}
private _{{table.name}}: {{table.full_name}}
{{~if table.comment != '' ~}}
/**
* {{table.comment}}
*/
{{~end~}}
get {{table.name}}(): {{table.full_name}} { return this._{{table.name}};}
{{~end~}}

View File

@ -21,15 +21,19 @@ namespace Luban.Job.Common.Utils
var template = t_constRender ??= Template.Parse(@"
namespace {{x.namespace_with_top_module}}
{
{{~if x.comment != '' ~}}
/// <summary>
/// {{x.comment}}
/// </summary>
{{~end~}}
public sealed class {{x.name}}
{
{{~ for item in x.items ~}}
{{~if item.comment != '' ~}}
/// <summary>
/// {{item.comment}}
/// </summary>
{{~end~}}
public const {{cs_define_type item.ctype}} {{item.name}} = {{cs_const_value item.ctype item.value}};
{{~end~}}
}
@ -48,18 +52,22 @@ namespace {{x.namespace_with_top_module}}
var template = t_enumRender ??= Template.Parse(@"
namespace {{namespace_with_top_module}}
{
{{~if comment != '' ~}}
/// <summary>
/// {{comment}}
/// </summary>
{{~end~}}
{{~if is_flags~}}
[System.Flags]
{{~end~}}
public enum {{name}}
{
{{~ for item in items ~}}
{{~if item.comment != '' ~}}
/// <summary>
/// {{item.comment}}
/// </summary>
{{~end~}}
{{item.name}} = {{item.value}},
{{~end~}}
}
@ -87,15 +95,19 @@ namespace {{namespace_with_top_module}}
var template = t_javaConstRender ??= Template.Parse(@"
package {{x.namespace_with_top_module}};
{{~if x.comment != '' ~}}
/**
* {{x.comment}}
*/
{{~end~}}
public final class {{x.name}}
{
{{~ for item in x.items ~}}
{{~if item.comment != '' ~}}
/**
* {{item.comment}}
*/
{{~end~}}
public static final {{java_define_type item.ctype}} {{item.name}} = {{java_const_value item.ctype item.value}};
{{~end~}}
}
@ -113,15 +125,19 @@ public final class {{x.name}}
{
var template = t_javaEnumRender ??= Template.Parse(@"
package {{namespace_with_top_module}};
{{~if comment != '' ~}}
/**
* {{comment}}
*/
{{~end~}}
public enum {{name}}
{
{{~ for item in items ~}}
{{~if item.comment != '' ~}}
/**
* {{item.comment}}
*/
{{~end~}}
{{item.name}}({{item.value}}),
{{~end~}}
;
@ -163,15 +179,19 @@ public enum {{name}}
var template = t_cppConstRender ??= Template.Parse(@"
{{x.cpp_namespace_begin}}
{{~if comment != '' ~}}
/**
{{x.comment}}
* {{comment}}
*/
{{~end~}}
struct {{x.name}}
{
{{~ for item in x.items ~}}
{{~if item.comment != '' ~}}
/**
{{item.comment}}
* {{item.comment}}
*/
{{~end~}}
static constexpr {{cpp_define_type item.ctype}} {{item.name}} = {{cpp_const_value item.ctype item.value}};
{{~end~}}
};
@ -189,15 +209,19 @@ struct {{x.name}}
{
var template = t_cppEnumRender ??= Template.Parse(@"
{{cpp_namespace_begin}}
{{~if comment != '' ~}}
/**
{{comment}}
* {{comment}}
*/
{{~end~}}
enum class {{name}}
{
{{~ for item in items ~}}
{{~if item.comment != '' ~}}
/**
{{item.comment}}
* {{item.comment}}
*/
{{~end~}}
{{item.name}} = {{item.value}},
{{~end~}}
};
@ -223,14 +247,18 @@ enum class {{name}}
var template = t_tsConstRender ??= Template.Parse(@"
{{x.typescript_namespace_begin}}
{{~if x.comment != '' ~}}
/**
* {{x.comment}}
*/
{{~end~}}
export class {{x.name}} {
{{~ for item in x.items ~}}
{{~if item.comment != '' ~}}
/**
* {{item.comment}}
*/
{{~end~}}
static {{item.name}} = {{ts_const_value item.ctype item.value}};
{{~end~}}
}
@ -248,14 +276,18 @@ export class {{x.name}} {
{
var template = t_tsEnumRender ??= Template.Parse(@"
{{typescript_namespace_begin}}
{{~if comment != '' ~}}
/**
* {{comment}}
*/
{{~end~}}
export enum {{name}} {
{{~for item in items ~}}
{{~if item.comment != '' ~}}
/**
* {{item.comment}}
*/
{{~end~}}
{{item.name}} = {{item.value}},
{{~end~}}
}

View File

@ -50,9 +50,11 @@ using Bright.Serialization;
namespace {{x.namespace_with_top_module}}
{
{{~if x.comment != '' ~}}
/// <summary>
/// {{x.comment}}
/// </summary>
{{~end~}}
public interface {{readonly_name}} {{if parent_def_type}}: IReadOnly{{x.parent_def_type.name}} {{end}}
{
{{~ for field in fields~}}
@ -60,9 +62,11 @@ public interface {{readonly_name}} {{if parent_def_type}}: IReadOnly{{x.parent_d
{{~end~}}
}
{{~if x.comment != '' ~}}
/// <summary>
/// {{x.comment}}
/// </summary>
{{~end~}}
public {{x.cs_class_modifier}} class {{name}} : {{if parent_def_type}} {{x.parent}} {{else}} Bright.Transaction.TxnBeanBase {{end}}, {{readonly_name}}
{
{{~ for field in fields~}}
@ -97,9 +101,11 @@ public {{x.cs_class_modifier}} class {{name}} : {{if parent_def_type}} {{x.paren
}
}
{{~if field.comment != '' ~}}
/// <summary>
/// {{field.comment}}
/// </summary>
{{~end~}}
public {{db_cs_define_type ctype}} {{field.cs_style_name}}
{
get
@ -136,21 +142,27 @@ public {{x.cs_class_modifier}} class {{name}} : {{if parent_def_type}} {{x.paren
}
}
{{~else~}}
{{~if field.comment != '' ~}}
/// <summary>
/// {{field.comment}}
/// </summary>
{{~end~}}
public {{db_cs_define_type ctype}} {{field.cs_style_name}} => {{field.internal_name}};
{{~end~}}
{{~if ctype.bean || ctype.element_type ~}}
{{~if field.comment != '' ~}}
/// <summary>
/// {{field.comment}}
/// </summary>
{{~end~}}
{{db_cs_readonly_define_type ctype}} {{readonly_name}}.{{field.cs_style_name}} => {{field.internal_name}};
{{~else if ctype.is_map~}}
{{~if field.comment != '' ~}}
/// <summary>
/// {{field.comment}}
/// </summary>
{{~end~}}
{{db_cs_readonly_define_type ctype}} {{readonly_name}}.{{field.cs_style_name}} => new Bright.Transaction.Collections.PReadOnlyMap<{{db_cs_readonly_define_type ctype.key_type}}, {{db_cs_readonly_define_type ctype.value_type}}, {{db_cs_define_type ctype.value_type}}>({{field.internal_name}});
{{~end~}}
{{~end~}}
@ -249,9 +261,11 @@ using System.Threading.Tasks;
namespace {{x.namespace_with_top_module}}
{
{{~if x.comment != '' ~}}
/// <summary>
/// {{x.comment}}
/// </summary>
{{~end~}}
public sealed class {{name}}
{
public static {{base_table_type}} Table { get; } = new {{internal_table_type}}();

View File

@ -50,9 +50,11 @@ using Bright.Serialization;
namespace {{x.namespace_with_top_module}}
{
{{~if x.comment != '' ~}}
/// <summary>
/// {{x.comment}}
/// </summary>
{{~end~}}
public interface {{readonly_name}} {{if parent_def_type}}: IReadOnly{{x.parent_def_type.name}} {{end}}
{
{{~ for field in fields~}}
@ -60,9 +62,11 @@ public interface {{readonly_name}} {{if parent_def_type}}: IReadOnly{{x.parent_d
{{~end~}}
}
{{~if x.comment != '' ~}}
/// <summary>
/// {{x.comment}}
/// </summary>
{{~end~}}
public {{x.cs_class_modifier}} class {{name}} : {{if parent_def_type}} {{x.parent}} {{else}} Bright.Transaction.TxnBeanBase {{end}}, {{readonly_name}}
{
{{~ for field in fields~}}
@ -97,9 +101,11 @@ public {{x.cs_class_modifier}} class {{name}} : {{if parent_def_type}} {{x.paren
}
}
{{~if field.comment != '' ~}}
/// <summary>
/// {{field.comment}}
/// </summary>
{{~end~}}
public {{db_cs_define_type ctype}} {{field.cs_style_name}}
{
get
@ -136,21 +142,27 @@ public {{x.cs_class_modifier}} class {{name}} : {{if parent_def_type}} {{x.paren
}
}
{{~else~}}
{{~if field.comment != '' ~}}
/// <summary>
/// {{field.comment}}
/// </summary>
{{~end~}}
public {{db_cs_define_type ctype}} {{field.cs_style_name}} => {{field.internal_name}};
{{~end~}}
{{~if ctype.bean || ctype.element_type ~}}
{{~if field.comment != '' ~}}
/// <summary>
/// {{field.comment}}
/// </summary>
{{~end~}}
{{db_cs_readonly_define_type ctype}} {{readonly_name}}.{{field.cs_style_name}} => {{field.internal_name}};
{{~else if ctype.is_map~}}
{{~if field.comment != '' ~}}
/// <summary>
/// {{field.comment}}
/// </summary>
{{~end~}}
{{db_cs_readonly_define_type ctype}} {{readonly_name}}.{{field.cs_style_name}} => new Bright.Transaction.Collections.PReadOnlyMap<{{db_cs_readonly_define_type ctype.key_type}}, {{db_cs_readonly_define_type ctype.value_type}}, {{db_cs_define_type ctype.value_type}}>({{field.internal_name}});
{{~end~}}
{{~end~}}
@ -249,9 +261,11 @@ using System.Threading.Tasks;
namespace {{x.namespace_with_top_module}}
{
{{~if x.comment != '' ~}}
/// <summary>
/// {{x.comment}}
/// </summary>
{{~end~}}
public sealed class {{name}}
{
public static {{base_table_type}} Table { get; } = new {{internal_table_type}}();

View File

@ -49,14 +49,18 @@ namespace Luban.Job.Db.Generate
}}
{{x.typescript_namespace_begin}}
{{~if x.comment != '' ~}}
/**
* {{x.comment}}
*/
{{~end~}}
export {{x.ts_class_modifier}} class {{name}} extends {{if parent_def_type}} {{x.parent}} {{else}} TxnBeanBase {{end}}{
{{~ for field in fields~}}
{{~if field.comment != '' ~}}
/**
* {{field.comment}}
*/
{{~end~}}
{{if is_abstract_type}}protected{{else}}private{{end}} {{field.internal_name}}: {{db_ts_define_type field.ctype}}
{{~end}}
@ -84,9 +88,11 @@ export {{x.ts_class_modifier}} class {{name}} extends {{if parent_def_type}} {{x
}
}
{{~if field.comment != '' ~}}
/**
* {{field.comment}}
*/
{{~end~}}
get {{field.ts_style_name}}(): {{db_ts_define_type ctype}} {
if (this.isManaged) {
var txn = TransactionContext.current
@ -98,9 +104,11 @@ export {{x.ts_class_modifier}} class {{name}} extends {{if parent_def_type}} {{x
}
}
{{~if field.comment != '' ~}}
/**
* {{field.comment}}
*/
{{~end~}}
set {{field.ts_style_name}}(value: {{db_ts_define_type ctype}}) {
{{~if db_field_cannot_null~}}
if (value == null) throw new Error()
@ -117,9 +125,11 @@ export {{x.ts_class_modifier}} class {{name}} extends {{if parent_def_type}} {{x
}
{{~else~}}
{{~if field.comment != '' ~}}
/**
* {{field.comment}}
*/
{{~end~}}
get {{field.ts_style_name}}(): {{db_ts_define_type ctype}} { return {{field.internal_name_with_this}} }
{{~end~}}
{{~end~}}
@ -231,9 +241,11 @@ export {{x.ts_class_modifier}} class {{name}} extends {{if parent_def_type}} {{x
}
}
{{~if x.comment != '' ~}}
/**
* {{x.comment}}
*/
{{~end~}}
export class {{name}} {
static readonly _table = new {{internal_table_type}}();
static get table(): TxnTableGeneric<{{db_ts_define_type key_ttype}},{{db_ts_define_type value_ttype}}> { return this._table }

View File

@ -53,9 +53,11 @@ using Bright.Serialization;
namespace {{x.namespace_with_top_module}}
{
{{~if x.comment != '' ~}}
/// <summary>
/// {{x.comment}}
/// </summary>
{{~end~}}
public {{if is_value_type}}struct{{else}}{{x.cs_class_modifier}} class{{end}} {{name}} : {{if parent_def_type}} {{parent}} {{else}} Bright.Serialization.BeanBase {{end}}
{
{{~if !is_value_type~}}
@ -113,9 +115,11 @@ namespace {{x.namespace_with_top_module}}
}
{{~ for field in fields ~}}
{{~if field.comment != '' ~}}
/// <summary>
/// {{field.comment}}
/// </summary>
{{~end~}}
public {{cs_define_type field.ctype}} {{field.cs_style_name}};
{{~end~}}
@ -172,15 +176,19 @@ using Bright.Serialization;
namespace {{x.namespace_with_top_module}}
{
{{~if x.comment != '' ~}}
/// <summary>
/// {{x.comment}}
/// </summary>
{{~end~}}
public sealed class {{name}} : Bright.Net.Codecs.Protocol
{
{{~ for field in fields ~}}
{{~if field.comment != '' ~}}
/// <summary>
/// {{field.comment}}
/// </summary>
{{~end~}}
public {{cs_define_type field.ctype}} {{field.cs_style_name}};
{{~end~}}
@ -264,9 +272,11 @@ using Bright.Serialization;
namespace {{x.namespace_with_top_module}}
{
{{~if x.comment != '' ~}}
/// <summary>
/// {{x.comment}}
/// </summary>
{{~end~}}
public sealed class {{name}} : Bright.Net.Codecs.Rpc<{{cs_define_type targ_type}}, {{cs_define_type tres_type}}>
{
public {{name}}()

View File

@ -55,9 +55,11 @@ namespace Luban.Job.Proto.Generate
{{x.typescript_namespace_begin}}
{{~if x.comment != '' ~}}
/**
* {{x.comment}}
*/
{{~end~}}
export {{if x.is_abstract_type}} abstract {{end}} class {{name}} extends {{if parent_def_type}}{{x.parent}}{{else}}BeanBase{{end}} {
{{~if x.is_abstract_type~}}
static serializeTo(_buf_ : ByteBuf, _bean_ : {{name}}) {
@ -84,9 +86,11 @@ export {{if x.is_abstract_type}} abstract {{end}} class {{name}} extends {{if pa
{{~ for field in fields ~}}
{{~if field.comment != '' ~}}
/**
* {{field.comment}}
*/
{{~end~}}
{{field.ts_style_name}}{{if field.is_nullable}}?{{end}} : {{ts_define_type field.ctype}}
{{~end~}}
@ -144,18 +148,22 @@ export {{if x.is_abstract_type}} abstract {{end}} class {{name}} extends {{if pa
}}
{{x.typescript_namespace_begin}}
{{~if x.comment != '' ~}}
/**
* {{x.comment}}
*/
{{~end~}}
export class {{name}} extends Protocol {
static readonly ID = {{x.id}}
getTypeId() { return {{name}}.ID }
{{~ for field in fields ~}}
{{~if field.comment != '' ~}}
/**
* {{field.comment}}
*/
{{~end~}}
{{field.ts_style_name}}{{if field.is_nullable}}?{{end}} : {{ts_define_type field.ctype}}
{{~end~}}