From 5784abdad21724b1813bf54e0838ca0935cd1c01 Mon Sep 17 00:00:00 2001 From: crupest Date: Thu, 22 Dec 2022 19:05:24 +0800 Subject: Develop secret api. v59 --- .../crupest-api/CrupestApi/CrupestApi.Commons/Crud/ColumnInfo.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'docker/crupest-api/CrupestApi/CrupestApi.Commons/Crud/ColumnInfo.cs') diff --git a/docker/crupest-api/CrupestApi/CrupestApi.Commons/Crud/ColumnInfo.cs b/docker/crupest-api/CrupestApi/CrupestApi.Commons/Crud/ColumnInfo.cs index 7f1782b..30b75af 100644 --- a/docker/crupest-api/CrupestApi/CrupestApi.Commons/Crud/ColumnInfo.cs +++ b/docker/crupest-api/CrupestApi/CrupestApi.Commons/Crud/ColumnInfo.cs @@ -60,9 +60,9 @@ public class ColumnInfo public bool IsPrimaryKey => Metadata.GetValueOrDefault(ColumnMetadataKeys.IsPrimaryKey) is true; public bool IsAutoIncrement => Metadata.GetValueOrDefault(ColumnMetadataKeys.IsAutoIncrement) is true; public bool IsNotNull => IsPrimaryKey || Metadata.GetValueOrDefault(ColumnMetadataKeys.NotNull) is true; - public bool IsGenerated => Metadata.GetValueOrDefault(ColumnMetadataKeys.Generated) is true; + public bool IsOnlyGenerated => Metadata.GetValueOrDefault(ColumnMetadataKeys.OnlyGenerated) is true; public bool IsNoUpdate => Metadata.GetValueOrDefault(ColumnMetadataKeys.NoUpdate) is true; - public bool CanBeGenerated => (bool?)Metadata.GetValueOrDefault(ColumnMetadataKeys.CanBeGenerated) ?? (DefaultValueGeneratorMethod is not null || IsAutoIncrement); + public object? DefaultValue => Metadata.GetValueOrDefault(ColumnMetadataKeys.DefaultValue); /// /// This only returns metadata value. It doesn't not fall back to primary column. If you want to get the real key column, go to table info. /// @@ -71,6 +71,11 @@ public class ColumnInfo public bool IsSpecifiedAsKey => Metadata.GetValueOrDefault(ColumnMetadataKeys.ActAsKey) is true; public ColumnIndexType Index => Metadata.GetValueOrDefault(ColumnMetadataKeys.Index) ?? ColumnIndexType.None; + /// + /// Whether the column value can be generated, which means the column has a default value or a default value generator or is AUTOINCREMENT. + /// + public bool CanBeGenerated => DefaultValue is not null || DefaultValueGeneratorMethod is not null || IsAutoIncrement; + /// /// The real column name. Maybe set in metadata or just the property name. /// -- cgit v1.2.3