type **time.Time has no field or method
- Dominant language
- Go
- Stars
- 141
- Forks
- 35
- PR merge metrics
- No merged PRs in 30d
Description
With the code generated from the setup below, I'm getting the following error:
```
models/survey_helper.go:48: tmp1.EndsAtToEndsAt undefined (type **time.Time has no field or method EndsAtToEndsAt)
models/survey_helper.go:52: tmp2.StartsAtToStartsAt undefined (type *time.Time has no field or method StartsAtToStartsAt)
```
Here's the relevant generated part from `models/survey_helper.go`:
```go
// SurveyToSurvey loads a Survey and builds the default view of media type Survey.
func (m *Survey) SurveyToSurvey() *app.Survey {
survey := &app.Survey{}
tmp1 := &m.EndsAt
survey.EndsAt = tmp1.EndsAtToEndsAt() // %!s(MISSING)
survey.ID = m.ID
survey.Name = m.Name
tmp2 := &m.StartsAt
survey.StartsAt = tmp2.StartsAtToStartsAt() // %!s(MISSING)
survey.Status = m.Status
return survey
}
```
### Setup
```go
// models.go
// extract from StorageGroup
Model("Survey", func() {
BuildsFrom(func() {
Payload("survey", "create")
Payload("survey", "update")
})
RendersTo(SurveyMedia)
HasMany("Questions", "Question")
Field("id", gorma.UUID, func() {
PrimaryKey()
})
})
// payload.go
var SurveyPayload = Type("SurveyPayload", func() {
Reference(SurveyMedia)
Attribute("name")
Attribute("startsAt")
Attribute("endsAt")
Attribute("status")
Required("name")
})
// media_types.go
var SurveyMedia = MediaType("application/vnd.survey+json", func() {
Description("A survey")
Attributes(func() {
Attribute("id", UUID, "Unique survey ID")
Attribute("name", String, "Name of survey")
Attribute("startsAt", DateTime, "Start date")
Attribute("endsAt", DateTime, "End date")
// ...
})
})
```
Any idea what might be wrong?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.