v2.0.3 released
Pre-release
Pre-release
add table helper, table struct don't need to write duplicate get,find,update etc method
usage:
type TestTable struct{
// implements mysql.TableFactory and set the xorm tag to -
mysql.TableFactory `xorm:"-" json:"-"`
Id int `xorm:"not null pk autoincr INT(11)"`
Value string `xorm:"not null VARCHAR(20)"`
}
// this is must needed
type(tt *TestTable) self() *TestTable {
return tt
}
// You must need to use this method to create a struct, do not use create a instance by &TestTable{} direct!!!!
func NewTestTable() * TestTable {
tt := &TestTable{}
// this step is needed!!!!
tt.myself=tt.self
return tt
}
// usage, more example see table_test.go pls
tt := NewTestTable()
tt.Id = 1
if _,err := tt.Get();err != nil {
fmt.Println(err.Error())
}