【问题标题】:Inheritance mapping in beego?beego中的继承映射?
【发布时间】:2015-03-17 07:20:36
【问题描述】:

beego中像hibernate的继承映射是什么? https://docs.jboss.org/hibernate/orm/3.5/reference/en-US/html/inheritance.html

beego doc(http://beego.me/docs/mvc/model/orm.md)中没有文档。

这样的类:

学生扩展人

教师扩展人

【问题讨论】:

    标签: hibernate inheritance orm beego


    【解决方案1】:

    我认为beego orm 还不支持。 https://github.com/astaxie/beego/issues/1389 这是一个更简单的问题。

    【讨论】:

      【解决方案2】:

      Beego ORM 还不支持。如果你真的需要它。你可以试试 GORM http://jinzhu.me/gorm/ .

      【讨论】:

        【解决方案3】:

        There is no features like this yet there is an alternative solution
        where you can import your controller into another controller.
        ex - In ControllerA
        type ControllerA struct {
        	ControllerB
        }
        func (this *ControllerA) Test() {
            res := this.DoSomething("Asdasd")
            fmt.Println(res)
        }
        
        In Controller B
        type ControllerB struct {
        	beego.Controller
        }
        func (this *ControllerB) DoSomething(name string) string{
            return name
        }

        【讨论】:

          猜你喜欢
          • 2015-06-07
          • 1970-01-01
          • 1970-01-01
          • 2017-12-07
          • 2011-11-22
          • 2010-11-25
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多