Skip to content

Commit

Permalink
Merge pull request #4 from scofieldpeng/dev
Browse files Browse the repository at this point in the history
add table.SetMyself method
  • Loading branch information
scofieldpeng authored Nov 25, 2018
2 parents 68fdeda + 1cba85a commit fa960dc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ require (
github.com/go-xorm/core v0.6.0
github.com/go-xorm/xorm v0.7.1
github.com/scofieldpeng/config v0.0.0-20180529180040-2470942ddc14
github.com/scofieldpeng/config-go v0.0.0-20180904140723-f66897e4003d // indirect
github.com/scofieldpeng/config-go v0.0.0-20180904140723-f66897e4003d
github.com/vaughan0/go-ini v0.0.0-20130923145212-a98ad7ee00ec
)
6 changes: 5 additions & 1 deletion table.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type Table interface {

type TableFactory struct {
tableNode string `json:"-" xorm:"-" xml:"-"`
myself func() interface{}
myself func() interface{} `json:"-" xorm:"-"`
}

func (tf TableFactory) checkNode() error {
Expand All @@ -33,6 +33,10 @@ func (tf TableFactory) check() error {
return nil
}

func (tf *TableFactory) SetMyself(self func() interface{}) {
tf.myself = self
}

func (tf TableFactory) TableNode() string {
return tf.tableNode
}
Expand Down
2 changes: 1 addition & 1 deletion table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (t testTable) TableNode() string {
func newTestTable() *testTable {
t := &testTable{}
t.tableNode = "default"
t.myself = t.self
t.SetMyself(t.self)
return t
}

Expand Down

0 comments on commit fa960dc

Please sign in to comment.