...
|
...
|
@@ -114,42 +114,42 @@ func (table *Table) Update(data map[string]interface{}) error { |
|
|
return nil
|
|
|
}
|
|
|
|
|
|
func (t *Table) Fields(includePK bool) []*Field {
|
|
|
func (table *Table) Fields(includePK bool) []*Field {
|
|
|
var fields []*Field
|
|
|
|
|
|
if includePK && t.PK != nil {
|
|
|
fields = append(fields, t.PK)
|
|
|
if includePK && table.PK != nil {
|
|
|
fields = append(fields, table.PK)
|
|
|
}
|
|
|
fields = append(fields, t.DataFields...)
|
|
|
if t.TableType == SubTable.ToString() {
|
|
|
fields = append(fields, t.ManualFields...)
|
|
|
fields = append(fields, table.DataFields...)
|
|
|
if table.TableType == SubTable.ToString() {
|
|
|
fields = append(fields, table.ManualFields...)
|
|
|
}
|
|
|
t.fields = fields
|
|
|
table.fields = fields
|
|
|
|
|
|
return t.fields
|
|
|
return table.fields
|
|
|
}
|
|
|
|
|
|
func (t *Table) MatchField(field *Field) (*Field, bool) {
|
|
|
if len(t.fields) == 0 {
|
|
|
t.fields = t.Fields(true)
|
|
|
func (table *Table) MatchField(field *Field) (*Field, bool) {
|
|
|
if len(table.fields) == 0 {
|
|
|
table.fields = table.Fields(true)
|
|
|
}
|
|
|
mField := (Fields)(t.fields).ToMap()
|
|
|
mField := (Fields)(table.fields).ToMap()
|
|
|
if v, ok := mField[field.Name]; ok {
|
|
|
return v, true
|
|
|
}
|
|
|
return nil, false
|
|
|
}
|
|
|
|
|
|
func (t *Table) DependencyTables() []int {
|
|
|
if t.TableInfo == nil {
|
|
|
func (table *Table) DependencyTables() []int {
|
|
|
if table.TableInfo == nil {
|
|
|
return []int{}
|
|
|
}
|
|
|
return t.TableInfo.DependencyTables
|
|
|
return table.TableInfo.DependencyTables
|
|
|
}
|
|
|
|
|
|
func (t *Table) AssertTableType(types ...TableType) bool {
|
|
|
func (table *Table) AssertTableType(types ...TableType) bool {
|
|
|
for _, item := range types {
|
|
|
if t.TableType == item.ToString() {
|
|
|
if table.TableType == item.ToString() {
|
|
|
return true
|
|
|
}
|
|
|
}
|
...
|
...
|
|