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

Prepare all database Stmts at startup? #40

Open
alexander-bauer opened this issue Jun 18, 2013 · 1 comment
Open

Prepare all database Stmts at startup? #40

alexander-bauer opened this issue Jun 18, 2013 · 1 comment

Comments

@alexander-bauer
Copy link
Member

No description provided.

@alexander-bauer
Copy link
Member Author

This could be simplified greatly by a simple DB.MustPrepare() wrapper to DB.Prepare():

func (db DB) MustPrepare(query string) *sql.Stmt {
    stmt, err := db.Prepare(query)
    if err != nil {
        panic("Could not prepare SQL: " + err.Error())
    }
    return stmt
}

This would somehow have to happen after the Db variable has been set, which may present a problem.

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

No branches or pull requests

1 participant