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

Feature request: Pass db object as a configuration #38

Closed
nguyendangminh opened this issue Sep 16, 2016 · 1 comment
Closed

Feature request: Pass db object as a configuration #38

nguyendangminh opened this issue Sep 16, 2016 · 1 comment

Comments

@nguyendangminh
Copy link
Contributor

Hi,

The db object is passed repetitively, for example:

err = p1.Insert(db)
pilot, err := models.PilotFind(db, 1)
pilot, err := models.Pilots(db, qm.Where("name=?", "Tim")).One()

Why we don't just pass the db object to the models package as a configuration?

@nullbio
Copy link
Member

nullbio commented Sep 16, 2016

Hi @nguyendangminh, you can do this already. Use boil.SetDB(db), and then you can use the G variant of the functions (like models.PilotsG() for example). The G variant do not take a db as a first parameter and use the global. See here: https://github.com/vattle/sqlboiler#function-variations

@nullbio nullbio closed this as completed Sep 16, 2016
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

2 participants