diff --git a/column.go b/column.go index 8656d4f6..34223de8 100644 --- a/column.go +++ b/column.go @@ -27,6 +27,7 @@ type Column struct { MapType int IsCreated bool IsUpdated bool + IsDeleted bool IsCascade bool IsVersion bool fieldPath []string @@ -50,6 +51,7 @@ func NewColumn(name, fieldName string, sqlType SQLType, len1, len2 int, nullable MapType: TWOSIDES, IsCreated: false, IsUpdated: false, + IsDeleted: false, IsCascade: false, IsVersion: false, fieldPath: nil, diff --git a/table.go b/table.go index 78eeacf9..f7c9d464 100644 --- a/table.go +++ b/table.go @@ -17,6 +17,7 @@ type Table struct { AutoIncrement string Created map[string]bool Updated string + Deleted string Version string Cacher Cacher StoreEngine string @@ -83,6 +84,10 @@ func (table *Table) UpdatedColumn() *Column { return table.GetColumn(table.Updated) } +func (table *Table) DeletedColumn() *Column { + return table.GetColumn(table.Deleted) +} + // add a column to table func (table *Table) AddColumn(col *Column) { table.columnsSeq = append(table.columnsSeq, col.Name) @@ -106,6 +111,9 @@ func (table *Table) AddColumn(col *Column) { if col.IsUpdated { table.Updated = col.Name } + if col.IsDeleted { + table.Deleted = col.Name + } if col.IsVersion { table.Version = col.Name }