Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

type **time.Time has no field or method #160

Open
jgautheron opened this issue Aug 24, 2017 · 0 comments
Open

type **time.Time has no field or method #160

jgautheron opened this issue Aug 24, 2017 · 0 comments

Comments

@jgautheron
Copy link

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:

// 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

// 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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant