go-xorm

Module declared as X but was required as Y

房东的猫 提交于 2020-05-15 06:13:25
问题 I'm trying to use grafana/grafana/pkg/tsdb package in my module. I don't think this problem is specific to grafana but here it goes: $ go get -u github.com/grafana/grafana/pkg/tsdb go: finding github.com/inconshreveable/log15 latest go: finding github.com/go-macaron/session latest go: finding golang.org/x/oauth2 latest go: finding github.com/teris-io/shortid latest go: github.com/grafana/grafana/pkg/tsdb imports github.com/go-xorm/core: github.com/go-xorm/core@v0.6.3: parsing go.mod: module

Store information/reference about structure

大城市里の小女人 提交于 2019-12-31 03:13:13
问题 I am looking for a way to store information which struct a function should use. Each struct corresponds to certain database table. type Record struct { TableName string PrimaryKey string //XormStruct // how can I store User or Post here? XormStruct2 interface{} // see I have tried below XormStruct3 reflect.Type // see I have tried below } var posts []Post var ListOfTables [...]Record { {"User", "id", User}, //{"Post", "post_id", Post}, {"Post", "post_id", posts, reflect.TypeOf([]Post{})}, } /

Store information/reference about structure

别说谁变了你拦得住时间么 提交于 2019-12-02 03:40:40
I am looking for a way to store information which struct a function should use. Each struct corresponds to certain database table. type Record struct { TableName string PrimaryKey string //XormStruct // how can I store User or Post here? XormStruct2 interface{} // see I have tried below XormStruct3 reflect.Type // see I have tried below } var posts []Post var ListOfTables [...]Record { {"User", "id", User}, //{"Post", "post_id", Post}, {"Post", "post_id", posts, reflect.TypeOf([]Post{})}, } // User is xorm struct type User struct { Id int64 Name string } // Post is xorm struct type Post struct