feat(db): migrate from MySQL to PostgreSQL
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Replace MySQL driver with pgx/v5 and pgxpool: - Update sqlc to use postgresql engine - Convert query.sql to PostgreSQL syntax ($1 params, CASE WHEN, ANY() arrays) - Replace sql.DB with pgxpool.Pool throughout - Change nullable types from sql.Null* to pgtype.* - Update ID types from uint32 to int64 for PostgreSQL compatibility - Delete MySQL-specific dynamic_connect.go - Add opentelemetry.gowrap template for tracing
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// Code generated by gowrap. DO NOT EDIT.
|
||||
// template: https://raw.githubusercontent.com/hexdigest/gowrap/6bd1bc023b4d2a619f30020924f258b8ff665a7a/templates/opentelemetry
|
||||
// template: opentelemetry.gowrap
|
||||
// gowrap: http://github.com/hexdigest/gowrap
|
||||
|
||||
package ntpdb
|
||||
@@ -7,10 +7,11 @@ package ntpdb
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
|
||||
"go.opentelemetry.io/otel"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
_codes "go.opentelemetry.io/otel/codes"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
)
|
||||
|
||||
// QuerierTxWithTracing implements QuerierTx interface instrumented with open telemetry spans
|
||||
@@ -104,7 +105,7 @@ func (_d QuerierTxWithTracing) GetMonitorByNameAndIPVersion(ctx context.Context,
|
||||
}
|
||||
|
||||
// GetMonitorsByID implements QuerierTx
|
||||
func (_d QuerierTxWithTracing) GetMonitorsByID(ctx context.Context, monitorids []uint32) (ma1 []Monitor, err error) {
|
||||
func (_d QuerierTxWithTracing) GetMonitorsByID(ctx context.Context, monitorids []int64) (ma1 []Monitor, err error) {
|
||||
ctx, _span := otel.Tracer(_d._instance).Start(ctx, "QuerierTx.GetMonitorsByID")
|
||||
defer func() {
|
||||
if _d._spanDecorator != nil {
|
||||
@@ -128,7 +129,7 @@ func (_d QuerierTxWithTracing) GetMonitorsByID(ctx context.Context, monitorids [
|
||||
}
|
||||
|
||||
// GetServerByID implements QuerierTx
|
||||
func (_d QuerierTxWithTracing) GetServerByID(ctx context.Context, id uint32) (s1 Server, err error) {
|
||||
func (_d QuerierTxWithTracing) GetServerByID(ctx context.Context, id int64) (s1 Server, err error) {
|
||||
ctx, _span := otel.Tracer(_d._instance).Start(ctx, "QuerierTx.GetServerByID")
|
||||
defer func() {
|
||||
if _d._spanDecorator != nil {
|
||||
@@ -224,14 +225,14 @@ func (_d QuerierTxWithTracing) GetServerLogScoresByMonitorID(ctx context.Context
|
||||
}
|
||||
|
||||
// GetServerNetspeed implements QuerierTx
|
||||
func (_d QuerierTxWithTracing) GetServerNetspeed(ctx context.Context, ip string) (u1 uint32, err error) {
|
||||
func (_d QuerierTxWithTracing) GetServerNetspeed(ctx context.Context, ip string) (i1 int64, err error) {
|
||||
ctx, _span := otel.Tracer(_d._instance).Start(ctx, "QuerierTx.GetServerNetspeed")
|
||||
defer func() {
|
||||
if _d._spanDecorator != nil {
|
||||
_d._spanDecorator(_span, map[string]interface{}{
|
||||
"ctx": ctx,
|
||||
"ip": ip}, map[string]interface{}{
|
||||
"u1": u1,
|
||||
"i1": i1,
|
||||
"err": err})
|
||||
} else if err != nil {
|
||||
_span.RecordError(err)
|
||||
@@ -296,7 +297,7 @@ func (_d QuerierTxWithTracing) GetZoneByName(ctx context.Context, name string) (
|
||||
}
|
||||
|
||||
// GetZoneCounts implements QuerierTx
|
||||
func (_d QuerierTxWithTracing) GetZoneCounts(ctx context.Context, zoneID uint32) (za1 []ZoneServerCount, err error) {
|
||||
func (_d QuerierTxWithTracing) GetZoneCounts(ctx context.Context, zoneID int64) (za1 []ZoneServerCount, err error) {
|
||||
ctx, _span := otel.Tracer(_d._instance).Start(ctx, "QuerierTx.GetZoneCounts")
|
||||
defer func() {
|
||||
if _d._spanDecorator != nil {
|
||||
|
||||
Reference in New Issue
Block a user