Skip to content

Is there a clean way to implement query analytics into an application using sqlboiler? #1188

Answered by stephenafamo
parnic asked this question in Q&A
Discussion options

You must be logged in to vote

I'd say the easiest way is to wrap the top level sql.DB and collect your metrics when the methods are called.

For example:

type MyDB struct {
    db *sql.DB
}

func (m MyDB) QueryContext(..) (...) {
    // collect analytics
    m.db.QueryContext(...)
}

// Other methods

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@parnic
Comment options

Answer selected by parnic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants