-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I am trying to create an index for the column that maps to the upstream relation.
- Loading branch information
Showing
28 changed files
with
653 additions
and
557 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,74 @@ | ||
namespace Carbunql.Annotations; | ||
|
||
/// <summary> | ||
/// Attribute used to define metadata for a column in a database table. | ||
/// </summary> | ||
[AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = false)] | ||
public class ColumnAttribute : Attribute | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the ColumnAttribute class. | ||
/// </summary> | ||
public ColumnAttribute() | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the ColumnAttribute class with the specified column type. | ||
/// </summary> | ||
/// <param name="columnType">The type of the column.</param> | ||
public ColumnAttribute(string columnType) | ||
{ | ||
ColumnType = columnType; | ||
} | ||
|
||
/// <summary> | ||
/// Gets or sets the name of the column. | ||
/// </summary> | ||
public string ColumnName { get; set; } = string.Empty; | ||
|
||
/// <summary> | ||
/// Gets or sets the type of the column. | ||
/// </summary> | ||
public string ColumnType { get; set; } = string.Empty; | ||
|
||
/// <summary> | ||
/// Gets or sets the type of the related column, if any. | ||
/// </summary> | ||
public string RelationColumnType { get; set; } = string.Empty; | ||
|
||
/// <summary> | ||
/// Gets or sets a value indicating whether the column is auto-incremented. | ||
/// </summary> | ||
public bool IsAutoNumber { get; set; } = false; | ||
|
||
/// <summary> | ||
/// Gets or sets a value indicating whether the column allows null values. | ||
/// </summary> | ||
public bool IsNullable { get; set; } = false; | ||
|
||
/// <summary> | ||
/// Gets or sets the definition for the auto-incremented column. | ||
/// </summary> | ||
public string AutoNumberDefinition { get; set; } = string.Empty; | ||
|
||
/// <summary> | ||
/// Gets or sets the default value for the column. | ||
/// </summary> | ||
public string DefaultValue { get; set; } = string.Empty; | ||
|
||
/// <summary> | ||
/// Gets or sets the comment associated with the column. | ||
/// </summary> | ||
public string Comment { get; set; } = string.Empty; | ||
|
||
/// <summary> | ||
/// Gets or sets the command to retrieve a timestamp value. | ||
/// </summary> | ||
public string TimestampCommand { get; set; } = string.Empty; | ||
|
||
/// <summary> | ||
/// Gets or sets the special type of the column, if any. | ||
/// </summary> | ||
public SpecialColumn SpecialColumn { get; set; } = SpecialColumn.None; | ||
|
||
//public PropertyColumnDefinition ToDefinition(ITable t, PropertyInfo prop) | ||
//{ | ||
// var columnName = (!string.IsNullOrEmpty(ColumnName)) ? ColumnName : prop.Name.ToSnakeCase(); | ||
// var columnType = (!string.IsNullOrEmpty(ColumnType)) ? ColumnType : DbmsConfiguration.ToDbType(prop.PropertyType); | ||
// var relationColumnType = (!string.IsNullOrEmpty(RelationColumnType)) ? RelationColumnType : DbmsConfiguration.ToDbType(prop.PropertyType); | ||
|
||
// var c = new PropertyColumnDefinition(t, columnName, columnType, prop.Name) | ||
// { | ||
// RelationColumnType = relationColumnType, | ||
// Comment = Comment, | ||
// IsAutoNumber = IsAutoNumber, | ||
// SpecialColumn = SpecialColumn, | ||
// IsNullable = prop.IsNullable(), | ||
// }; | ||
|
||
// if (IsAutoNumber && !string.IsNullOrEmpty(AutoNumberDefinition)) | ||
// { | ||
// c.DefaultValue = ValueParser.Parse(AutoNumberDefinition); | ||
// } | ||
// if (!string.IsNullOrEmpty(DefaultValue)) | ||
// { | ||
// c.DefaultValue = ValueParser.Parse(DefaultValue); | ||
// } | ||
// return c; | ||
//} | ||
} |
Oops, something went wrong.