Categorygithub.com/aereal/go-sql-caller-annotation
repository
0.0.0-20230528134203-a9563577e2bf
Repository: https://github.com/aereal/go-sql-caller-annotation.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

CI PkgGoDev

go-sql-caller-annotation

Provides an new sql.*DB connection that injects caller information to the query

go get github.com/aereal/go-sql-caller-annotation

Usage

package main

import (
  "github.com/aereal/go-sql-caller-annotation/sqlcaller"
)

func main() {
  db, _ := sqlcaller.WithAnnotation("mysql", "..." /* DSN */)
  db.Exec("SELECT version()") // runs `/* main.main (/path/to/file.go:9) */ SELECT version()` query
}

License

See LICENSE file.