I have two structure (New
and DailyPrediction
) with DailyPrediction
structure as one of the entity of New
structure:
type New struct {
Id string
DailyPrediction
}
type DailyPrediction struct {
Prediction string
}
I am unable to read (or) write the structure new in the datastore. It would be helpful if someone can help me on this.
It is unclear to me from your question what exactly you are doing with the struct, and in what way it is failing. However, while you are embedding the DailyPrediction struct in your new struct by not giving it a name, it still needs to be initialized. You can see details of how to do that here: http://golang.org/doc/effective_go.html#embedding
For example, in order to initialize your New struct, you may use a line like this:
n := New{"foo", DailyPrediction{"bar"}}
Could that be what was missing?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With