Open Aviortheking opened 5 years ago
You should give a xorm tag in Planing []Planning
and Designations []Designation
to ignore them. Just like
Planing []Planning `xorm:"-"`
Cascade load only support single object.
oh ok thanks
Sorry to ask back but the issue don't seem to went away with the xom:"-"
type Offer struct {
ID int64 `json:"id"`
Contact contact.Contact `json:"contact" xorm:"int"`
CustomID int64 `json:"custom_id"`
Object string `json:"object"`
Status Status `json:"status"`
Addon string `json:"addon"`
Date time.Time `json:"date"`
RealDate time.Time `json:"real_date"`
Planning []Planning `json:"planning" xorm:"-"`
DbPlanning []string `json:"-"`
Connection string `json:"connection"`
Notes []string `json:"notes"`
Conditions []string `json:"conditions"`
Payement []string `json:"payement"`
Validity Validity `json:"validity" xorm:"extends"`
Designations []Designation `json:"designations" xorm:"-"`
DbDesignations []string `json:"-"`
}
2019-08-21 11:52:49.936 INFO /offres
2019-08-21 11:52:49.937 INFO cascade obj is not exist
2019-08-21 11:52:49.937 INFO <nil>
type offersInjection struct {
Offers []offer.Offer
}
func OffersRoute(w http.ResponseWriter, r *http.Request) {
vars.Logger.Info("/offres")
var injection = new(offersInjection)
logger.Info(engine.Find(&injection.Offers))
logger.Info(util.GetTemplateManager().Run(w, "offers.html", injection))
}
``
You should rename offersInjection
to OffersInjection
.
don't change the result
type OffersInjection struct {
Offers []offer.Offer
}
func OffersRoute(w http.ResponseWriter, r *http.Request) {
vars.Logger.Info("/offres")
var injection = new(OffersInjection)
vars.Logger.Info(vars.Engine.Find(&injection.Offers))
vars.Logger.Info(util.GetTemplateManager().Run(w, "offers.html", injection))
}
2019-08-22 15:48:46.394 INFO /offres
2019-08-22 15:48:46.397 INFO cascade obj is not exist
2019-08-22 15:48:46.398 INFO <nil>
here is the code that return it
My object
I'm lost at the what it mean and what i'm doing wrong