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

calcite-avatica-go plugin #69

Open
hogan-chu opened this issue Apr 27, 2023 · 0 comments
Open

calcite-avatica-go plugin #69

hogan-chu opened this issue Apr 27, 2023 · 0 comments

Comments

@hogan-chu
Copy link

hogan-chu commented Apr 27, 2023

I think it's really simple like mssql plugin. Would you add it for 1.3.0 patch. Thanks

package avatica

import (
	"database/sql"
	avatica "github.com/apache/calcite-avatica-go/v5"
	"github.com/pinpoint-apm/pinpoint-go-agent"
)

var dbInfo = pinpoint.DBInfo{
	ParseDSN: parseDSN,
}

func init() {
	dbInfo.DBType = pinpoint.ServiceTypeAvatica
	dbInfo.QueryType = pinpoint.ServiceTypeAvaticaExecuteQuery
	sql.Register("sqlserver-avatica", pinpoint.WrapSQLDriver(&avatica.Driver{}, dbInfo))
}

func parseDSN(info *pinpoint.DBInfo, dsn string) {
	cfg, err := avatica.ParseDSN(dsn)
	if nil != err {
		return
	}

	info.DBName = cfg.Database
	info.DBHost = cfg.Host
}
@hogan-chu hogan-chu changed the title Plugin for calcite-avatica-go plugin for calcite-avatica-go Apr 27, 2023
@hogan-chu hogan-chu changed the title plugin for calcite-avatica-go calcite-avatica-go plugin Apr 27, 2023
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

2 participants