fix(eventstore): use decimal, correct mirror (#9903)

back port #9812, #9878, #9881, #9884

---------

Co-authored-by: Livio Spring <livio.a@gmail.com>
Co-authored-by: Stefan Benz <46600784+stebenz@users.noreply.github.com>
This commit is contained in:
Silvan
2025-05-20 12:21:29 +02:00
committed by GitHub
parent dcd9b8eb6e
commit 2221498a08
62 changed files with 562 additions and 343 deletions

View File

@@ -6,6 +6,7 @@ import (
"fmt"
"reflect"
pgxdecimal "github.com/jackc/pgx-shopspring-decimal"
"github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/pgtype"
)
@@ -47,7 +48,12 @@ func (c *ConnectionConfig) takeRatio(ratio float64) (*ConnectionConfig, error) {
return out, nil
}
var afterConnectFuncs []func(ctx context.Context, c *pgx.Conn) error
var afterConnectFuncs = []func(ctx context.Context, c *pgx.Conn) error{
func(ctx context.Context, c *pgx.Conn) error {
pgxdecimal.Register(c.TypeMap())
return nil
},
}
func RegisterAfterConnect(f func(ctx context.Context, c *pgx.Conn) error) {
afterConnectFuncs = append(afterConnectFuncs, f)

View File

@@ -169,6 +169,7 @@ func TestNewConnectionConfig(t *testing.T) {
want: &ConnectionConfig{
MaxOpenConns: 1,
MaxIdleConns: 1,
AfterConnect: afterConnectFuncs,
},
},
{
@@ -183,6 +184,7 @@ func TestNewConnectionConfig(t *testing.T) {
want: &ConnectionConfig{
MaxOpenConns: 1,
MaxIdleConns: 1,
AfterConnect: afterConnectFuncs,
},
},
{
@@ -197,6 +199,7 @@ func TestNewConnectionConfig(t *testing.T) {
want: &ConnectionConfig{
MaxOpenConns: 1,
MaxIdleConns: 1,
AfterConnect: afterConnectFuncs,
},
},
{
@@ -211,6 +214,7 @@ func TestNewConnectionConfig(t *testing.T) {
want: &ConnectionConfig{
MaxOpenConns: 6,
MaxIdleConns: 3,
AfterConnect: afterConnectFuncs,
},
},
{
@@ -225,6 +229,7 @@ func TestNewConnectionConfig(t *testing.T) {
want: &ConnectionConfig{
MaxOpenConns: 2,
MaxIdleConns: 1,
AfterConnect: afterConnectFuncs,
},
},
{
@@ -239,6 +244,7 @@ func TestNewConnectionConfig(t *testing.T) {
want: &ConnectionConfig{
MaxOpenConns: 2,
MaxIdleConns: 1,
AfterConnect: afterConnectFuncs,
},
},
}