Merge pull request #4 from oinume/feature/softdelete

Add softdelete feature
This commit is contained in:
Lunny Xiao 2014-11-05 15:39:11 +08:00
commit 3e0fa232ab
2 changed files with 10 additions and 0 deletions

View File

@ -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,

View File

@ -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
}