Skip to content

Commit fa960dc

Browse files
authored
Merge pull request #4 from scofieldpeng/dev
add table.SetMyself method
2 parents 68fdeda + 1cba85a commit fa960dc

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ require (
55
github.com/go-xorm/core v0.6.0
66
github.com/go-xorm/xorm v0.7.1
77
github.com/scofieldpeng/config v0.0.0-20180529180040-2470942ddc14
8-
github.com/scofieldpeng/config-go v0.0.0-20180904140723-f66897e4003d // indirect
8+
github.com/scofieldpeng/config-go v0.0.0-20180904140723-f66897e4003d
99
github.com/vaughan0/go-ini v0.0.0-20130923145212-a98ad7ee00ec
1010
)

table.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type Table interface {
1313

1414
type TableFactory struct {
1515
tableNode string `json:"-" xorm:"-" xml:"-"`
16-
myself func() interface{}
16+
myself func() interface{} `json:"-" xorm:"-"`
1717
}
1818

1919
func (tf TableFactory) checkNode() error {
@@ -33,6 +33,10 @@ func (tf TableFactory) check() error {
3333
return nil
3434
}
3535

36+
func (tf *TableFactory) SetMyself(self func() interface{}) {
37+
tf.myself = self
38+
}
39+
3640
func (tf TableFactory) TableNode() string {
3741
return tf.tableNode
3842
}

table_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func (t testTable) TableNode() string {
2727
func newTestTable() *testTable {
2828
t := &testTable{}
2929
t.tableNode = "default"
30-
t.myself = t.self
30+
t.SetMyself(t.self)
3131
return t
3232
}
3333

0 commit comments

Comments
 (0)