volatiletech / sqlboiler

Generate a Go ORM tailored to your database schema.
BSD 3-Clause "New" or "Revised" License
6.73k stars 544 forks source link

models undefined #348

Closed alishaagupta closed 6 years ago

alishaagupta commented 6 years ago

If you're having a generation problem please answer these questions before submitting your issue. Thanks!

What version of SQLBoiler are you using (sqlboiler --version)?

SQLBoiler v2.7.3

If this happened at generation time what was the full SQLBoiler command you used to generate your models? (if not applicable leave blank)

go generate

If this happened at runtime what code produced the issue? (if not applicable leave blank)

models.DatabaseName(db)

models is not defined

What is the output of the command above with the -d flag added to it? (Provided you are comfortable sharing this, it contains a blueprint of your schema)

Please provide a relevant database schema so we can replicate your issue (Provided you are comfortable sharing this)

Further information. What did you do, what did you expect?

aarondl commented 6 years ago

Hey there. Hard to tell from the bug report what's going on. go generate cannot possibly produce the error models is not defined as far as I can tell?

It sounds like you did a go generate and then attempted to write a program with models.DatabaseName(db), there's no method named that unless that's one of your tables, and it might have a different name. You should also double check that you're importing the correct models package in your Go program.