diff --git a/CHANGELOG.md b/CHANGELOG.md index cd3354b..e0619e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Changed +- bump `go-tarantool` dependency to `v2` (#6). + ## [0.1.0] - 2023-09-08 ### Changed diff --git a/converter.go b/converter.go index 71b1c65..37fb065 100644 --- a/converter.go +++ b/converter.go @@ -9,8 +9,8 @@ import ( "time" "github.com/google/uuid" - "github.com/tarantool/go-tarantool/datetime" - "github.com/tarantool/go-tarantool/decimal" + "github.com/tarantool/go-tarantool/v2/datetime" + "github.com/tarantool/go-tarantool/v2/decimal" ) // Converter is a converter from S to T. @@ -33,8 +33,8 @@ var ( _ Converter[string, any] = (*IdentityConverter[string])(nil) _ Converter[string, any] = (*StringToIntervalConverter)(nil) - _ Converter[*datetime.Datetime, string] = (*DatetimeToStringConverter)(nil) - _ Converter[datetime.Interval, string] = (*IntervalToStringConverter)(nil) + _ Converter[datetime.Datetime, string] = (*DatetimeToStringConverter)(nil) + _ Converter[datetime.Interval, string] = (*IntervalToStringConverter)(nil) ) // IdentityConverter is a converter from S to any, that doesn't change the input. @@ -164,7 +164,7 @@ func MakeStringToDecimalConverter(ignoreChars, decSeparators string) StringToDec func (conv StringToDecimalConverter) Convert(src string) (any, error) { src = replaceCharacters(src, conv.ignoreChars, "") src = replaceCharacters(src, conv.decSeparators, ".") - return decimal.NewDecimalFromString(src) + return decimal.MakeDecimalFromString(src) } // StringToUUIDConverter is a converter from string to UUID. @@ -206,7 +206,7 @@ func (StringToDatetimeConverter) Convert(src string) (any, error) { } _, offset := tm.Zone() tm = tm.In(time.FixedZone(datetime.NoTimezone, offset)) - return datetime.NewDatetime(tm) + return datetime.MakeDatetime(tm) } loc, err := time.LoadLocation(tzName) if err != nil { @@ -216,7 +216,7 @@ func (StringToDatetimeConverter) Convert(src string) (any, error) { if err != nil { return nil, err } - return datetime.NewDatetime(tm) + return datetime.MakeDatetime(tm) } // StringToMapConverter is a converter from string to map. @@ -341,9 +341,9 @@ func MakeDatetimeToStringConverter() DatetimeToStringConverter { return DatetimeToStringConverter{} } -// Convert is the implementation of Converter[*datetime.Datetime, string] +// Convert is the implementation of Converter[datetime.Datetime, string] // for DatetimeToStringConverter. -func (DatetimeToStringConverter) Convert(datetime *datetime.Datetime) (string, error) { +func (DatetimeToStringConverter) Convert(datetime datetime.Datetime) (string, error) { tm := datetime.ToTime() zone := tm.Location().String() if zone != "" { diff --git a/converter_test.go b/converter_test.go index 27bacc5..4fe95ab 100644 --- a/converter_test.go +++ b/converter_test.go @@ -10,8 +10,8 @@ import ( dec "github.com/shopspring/decimal" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/tarantool/go-tarantool/datetime" - "github.com/tarantool/go-tarantool/decimal" + "github.com/tarantool/go-tarantool/v2/datetime" + "github.com/tarantool/go-tarantool/v2/decimal" "github.com/tarantool/go-tupleconv" ) @@ -38,8 +38,8 @@ func HelperTestConverter[S any, T any]( } } -func getDatetimeWithValidate(t *testing.T, tm time.Time) *datetime.Datetime { - dt, err := datetime.NewDatetime(tm) +func getDatetimeWithValidate(t *testing.T, tm time.Time) datetime.Datetime { + dt, err := datetime.MakeDatetime(tm) require.NoError(t, err) return dt } @@ -247,35 +247,35 @@ func TestConverters(t *testing.T) { tupleconv.MakeStringToDecimalConverter(thSeparators, decSeparators): { { value: "0", - expected: &decimal.Decimal{Decimal: dec.NewFromBigInt(big.NewInt(0), 0)}, + expected: decimal.Decimal{Decimal: dec.NewFromBigInt(big.NewInt(0), 0)}, }, { value: "1", - expected: &decimal.Decimal{Decimal: dec.NewFromBigInt(big.NewInt(1), 0)}, + expected: decimal.Decimal{Decimal: dec.NewFromBigInt(big.NewInt(1), 0)}, }, { value: "-1", - expected: &decimal.Decimal{Decimal: dec.NewFromBigInt(big.NewInt(-1), 0)}, + expected: decimal.Decimal{Decimal: dec.NewFromBigInt(big.NewInt(-1), 0)}, }, { value: "43904329", - expected: &decimal.Decimal{ + expected: decimal.Decimal{ Decimal: dec.NewFromBigInt(big.NewInt(43904329), 0), }, }, { value: "-9223372036854775808", - expected: &decimal.Decimal{ + expected: decimal.Decimal{ Decimal: dec.NewFromBigInt(big.NewInt(int64(-9223372036854775808)), 0), }, }, { value: "1.447e+44", - expected: &decimal.Decimal{Decimal: dec.NewFromBigInt(big.NewInt(1447), 41)}, + expected: decimal.Decimal{Decimal: dec.NewFromBigInt(big.NewInt(1447), 41)}, }, { value: "1*5", - expected: &decimal.Decimal{Decimal: dec.NewFromBigInt(big.NewInt(15), -1)}, + expected: decimal.Decimal{Decimal: dec.NewFromBigInt(big.NewInt(15), -1)}, }, // Error. @@ -320,7 +320,7 @@ func TestMakeDatetimeToStringConverter(t *testing.T) { parisLoc) time3 := time.Date(2020, 9, 14, 12, 12, 12, 0, time.UTC) - cases := []convCase[*datetime.Datetime, string]{ + cases := []convCase[datetime.Datetime, string]{ { value: getDatetimeWithValidate(t, time1), expected: "2023-08-30T12:06:05.123456789+0400", @@ -335,7 +335,7 @@ func TestMakeDatetimeToStringConverter(t *testing.T) { }, } converter := tupleconv.MakeDatetimeToStringConverter() - HelperTestConverter[*datetime.Datetime, string](t, converter, cases) + HelperTestConverter[datetime.Datetime, string](t, converter, cases) } func TestMakeIntervalToStringConverter(t *testing.T) { diff --git a/example_test.go b/example_test.go index 0da1b44..c7f378a 100644 --- a/example_test.go +++ b/example_test.go @@ -1,17 +1,19 @@ package tupleconv_test import ( + "context" "errors" "fmt" - "github.com/tarantool/go-tarantool" - "github.com/tarantool/go-tarantool/datetime" - "github.com/tarantool/go-tarantool/test_helpers" - "github.com/tarantool/go-tupleconv" "strconv" "strings" "time" - _ "github.com/tarantool/go-tarantool/uuid" + "github.com/tarantool/go-tarantool/v2" + "github.com/tarantool/go-tarantool/v2/datetime" + "github.com/tarantool/go-tarantool/v2/test_helpers" + "github.com/tarantool/go-tupleconv" + + _ "github.com/tarantool/go-tarantool/v2/uuid" ) type filterIntConverter struct { @@ -180,13 +182,21 @@ func ExampleTTConvFactory_custom() { const workDir = "work_dir" const server = "127.0.0.1:3014" +var dialer = tarantool.NetDialer{ + Address: server, + User: "test", + Password: "password", +} +var opts = tarantool.Opts{ + Timeout: 5 * time.Second, +} + func upTarantool() (func(), error) { inst, err := test_helpers.StartTarantool(test_helpers.StartOpts{ + Dialer: dialer, InitScript: "testdata/config.lua", Listen: server, WorkDir: workDir, - User: "test", - Pass: "password", WaitStart: 100 * time.Millisecond, ConnectRetry: 3, RetryTimeout: 500 * time.Millisecond, @@ -207,7 +217,7 @@ func makeTtEncoder() func(any) (string, error) { return func(src any) (string, error) { switch src := src.(type) { case datetime.Datetime: - return datetimeConverter.Convert(&src) + return datetimeConverter.Convert(src) default: return fmt.Sprint(src), nil } @@ -225,10 +235,9 @@ func ExampleMap_insertMappedTuples() { } defer cleanupTarantool() - conn, _ := tarantool.Connect(server, tarantool.Opts{ - User: "test", - Pass: "password", - }) + conn, _ := tarantool.Connect(context.Background(), dialer, opts) + defer conn.Close() + var spaceFmtResp [][]tupleconv.SpaceField req := tarantool.NewCallRequest("get_test_space_fmt") if err := conn.Do(req).GetTyped(&spaceFmtResp); err != nil { @@ -264,22 +273,34 @@ func ExampleMap_insertMappedTuples() { return } insertReq := tarantool.NewInsertRequest("test_space").Tuple(mapped) - resp, err := conn.Do(insertReq).Get() + resp, err := conn.Do(insertReq).GetResponse() if err != nil { fmt.Println(err) return } - fmt.Println("insert response code =", resp.Code) + _, err = resp.Decode() + if err != nil { + fmt.Printf("Error while decoding: %s", err) + return + } + if resp.Header().Error != tarantool.ErrorNo { + fmt.Println("insert response error =", resp.Header().Error) + } } selectReq := tarantool.NewSelectRequest("test_space") - resp, err := conn.Do(selectReq).Get() + resp, err := conn.Do(selectReq).GetResponse() + if err != nil { + fmt.Println(err) + return + } + data, err := resp.Decode() if err != nil { fmt.Println(err) return } - tuple0, _ := resp.Data[0].([]any) + tuple0, _ := data[0].([]any) encoder := tupleconv.MakeMapper[any, string]([]tupleconv.Converter[any, string]{}). WithDefaultConverter(tupleconv.MakeFuncConverter(makeTtEncoder())) @@ -288,9 +309,6 @@ func ExampleMap_insertMappedTuples() { // Output: // [{0 id unsigned false} {0 boolean boolean false} {0 number number false}] - // insert response code = 0 - // insert response code = 0 - // insert response code = 0 // [1 true 12 143.5 2020-08-22T11:27:43.123456789-0200 str [1 2 3] 190 ] } @@ -308,10 +326,9 @@ func Example_ttEncoder() { tupleEncoder := tupleconv.MakeMapper([]tupleconv.Converter[any, string]{}). WithDefaultConverter(converter) - conn, _ := tarantool.Connect(server, tarantool.Opts{ - User: "test", - Pass: "password", - }) + conn, _ := tarantool.Connect(context.Background(), dialer, opts) + defer conn.Close() + req := tarantool.NewSelectRequest("finances") var tuples [][]any diff --git a/go.mod b/go.mod index b1ac039..2613f29 100644 --- a/go.mod +++ b/go.mod @@ -6,21 +6,14 @@ require ( github.com/google/uuid v1.3.0 github.com/shopspring/decimal v1.3.1 github.com/stretchr/testify v1.7.1 - github.com/tarantool/go-tarantool v1.11.0 + github.com/tarantool/go-tarantool/v2 v2.1.0 ) require ( github.com/davecgh/go-spew v1.1.0 // indirect - github.com/golang/protobuf v1.3.1 // indirect - github.com/mattn/go-pointer v0.0.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 // indirect - github.com/tarantool/go-openssl v0.0.8-0.20230307065445-720eeb389195 // indirect + github.com/tarantool/go-iproto v1.0.0 // indirect github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect - golang.org/x/net v0.0.0-20201021035429-f5854403a974 // indirect - golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4 // indirect - google.golang.org/appengine v1.6.7 // indirect - gopkg.in/vmihailenco/msgpack.v2 v2.9.2 // indirect gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect ) diff --git a/go.sum b/go.sum index 0ddb50a..0fca50d 100644 --- a/go.sum +++ b/go.sum @@ -1,56 +1,24 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/mattn/go-pointer v0.0.1 h1:n+XhsuGeVO6MEAp7xyEukFINEa+Quek5psIR/ylA6o0= -github.com/mattn/go-pointer v0.0.1/go.mod h1:2zXcozF6qYGgmsG+SeTZz3oAbFLdD3OWqnUbNvJZAlc= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= -github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 h1:RC6RW7j+1+HkWaX/Yh71Ee5ZHaHYt7ZP4sQgUrm6cDU= -github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/tarantool/go-openssl v0.0.8-0.20230307065445-720eeb389195 h1:/AN3eUPsTlvF6W+Ng/8ZjnSU6o7L0H4Wb9GMks6RkzU= -github.com/tarantool/go-openssl v0.0.8-0.20230307065445-720eeb389195/go.mod h1:M7H4xYSbzqpW/ZRBMyH0eyqQBsnhAMfsYk5mv0yid7A= -github.com/tarantool/go-tarantool v1.11.0 h1:iLw8kYDQNFA3c3VHhBJJajXKUJPaz0StY/CdrutDn6s= -github.com/tarantool/go-tarantool v1.11.0/go.mod h1:QRiXv0jnxwgxHtr9ZmifSr/eRba76gTUBgp69pDMX1U= +github.com/tarantool/go-iproto v1.0.0 h1:quC4hdFhCuFYaCqOFgUxH2foRkhAy+TlEy7gQLhdVjw= +github.com/tarantool/go-iproto v1.0.0/go.mod h1:LNCtdyZxojUed8SbOiYHoc3v9NvaZTB7p96hUySMlIo= +github.com/tarantool/go-tarantool/v2 v2.1.0 h1:IY33WoS8Kqb+TxNnKbzu/7yVkiCNZGhbG5Gw0/tMfSk= +github.com/tarantool/go-tarantool/v2 v2.1.0/go.mod h1:cpjGW5FHAXIMf0PKZte70pMOeadw1MA/hrDv1LblWk4= github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9znI5mJU= github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4 h1:myAQVi0cGEoqQVR5POX+8RR2mrocKqNN1hmeMqhX27k= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= -google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU= -gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/vmihailenco/msgpack.v2 v2.9.2 h1:gjPqo9orRVlSAH/065qw3MsFCDpH7fa1KpiizXyllY4= -gopkg.in/vmihailenco/msgpack.v2 v2.9.2/go.mod h1:/3Dn1Npt9+MYyLpYYXjInO/5jvMLamn+AEGwNEOatn8= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/tt_test.go b/tt_test.go index 00bf03a..5b3ec37 100644 --- a/tt_test.go +++ b/tt_test.go @@ -2,16 +2,17 @@ package tupleconv_test import ( "fmt" + "math/big" + "testing" + "time" + "github.com/google/uuid" dec "github.com/shopspring/decimal" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/tarantool/go-tarantool/datetime" - "github.com/tarantool/go-tarantool/decimal" + "github.com/tarantool/go-tarantool/v2/datetime" + "github.com/tarantool/go-tarantool/v2/decimal" "github.com/tarantool/go-tupleconv" - "math/big" - "testing" - "time" ) func TestStringToTTConvFactory(t *testing.T) { @@ -328,19 +329,19 @@ func TestStringToTTConvFactory(t *testing.T) { tupleconv.TypeDecimal: { { value: "12`13`144", - expected: &decimal.Decimal{ + expected: decimal.Decimal{ Decimal: dec.NewFromBigInt(big.NewInt(1213144), 0), }, }, { value: "111`22e333", - expected: &decimal.Decimal{ + expected: decimal.Decimal{ Decimal: dec.NewFromBigInt(big.NewInt(11122), 333), }, }, { value: "11,12", - expected: &decimal.Decimal{ + expected: decimal.Decimal{ Decimal: dec.NewFromBigInt(big.NewInt(1112), -2), }, },