From aeb4ac638ab98fc3e34c1c41ab349db19603b19e Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Thu, 17 Mar 2022 16:45:26 +0300 Subject: [PATCH] [#170] accounting: Remove `message` sub-string from V2-methods Signed-off-by: Leonard Lyubich --- accounting/decimal.go | 14 +++++++------- accounting/decimal_test.go | 4 ++-- accounting/doc.go | 4 ++-- client/accounting.go | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/accounting/decimal.go b/accounting/decimal.go index 3581542..e4dae06 100644 --- a/accounting/decimal.go +++ b/accounting/decimal.go @@ -5,7 +5,7 @@ import "github.com/nspcc-dev/neofs-api-go/v2/accounting" // Decimal represents decimal number for accounting operations. // // Decimal is mutually compatible with github.com/nspcc-dev/neofs-api-go/v2/accounting.Decimal -// message. See ReadFromMessageV2 / WriteToMessageV2 methods. +// message. See ReadFromV2 / WriteToV2 methods. // // Instances can be created using built-in var declaration. // @@ -13,18 +13,18 @@ import "github.com/nspcc-dev/neofs-api-go/v2/accounting" // _ = Decimal(accounting.Decimal{}) // not recommended type Decimal accounting.Decimal -// ReadFromMessageV2 reads Decimal from the accounting.Decimal message. +// ReadFromV2 reads Decimal from the accounting.Decimal message. // -// See also WriteToMessageV2. -func (d *Decimal) ReadFromMessageV2(m accounting.Decimal) { +// See also WriteToV2. +func (d *Decimal) ReadFromV2(m accounting.Decimal) { *d = Decimal(m) } -// WriteToMessageV2 writes Decimal to the accounting.Decimal message. +// WriteToV2 writes Decimal to the accounting.Decimal message. // The message must not be nil. // -// See also ReadFromMessageV2. -func (d Decimal) WriteToMessageV2(m *accounting.Decimal) { +// See also ReadFromV2. +func (d Decimal) WriteToV2(m *accounting.Decimal) { *m = (accounting.Decimal)(d) } diff --git a/accounting/decimal_test.go b/accounting/decimal_test.go index 1705988..7252b56 100644 --- a/accounting/decimal_test.go +++ b/accounting/decimal_test.go @@ -32,14 +32,14 @@ func TestDecimalMessageV2(t *testing.T) { m.SetValue(7) m.SetPrecision(8) - d.ReadFromMessageV2(m) + d.ReadFromV2(m) require.EqualValues(t, m.GetValue(), d.Value()) require.EqualValues(t, m.GetPrecision(), d.Precision()) var m2 v2accounting.Decimal - d.WriteToMessageV2(&m2) + d.WriteToV2(&m2) require.EqualValues(t, d.Value(), m2.GetValue()) require.EqualValues(t, d.Precision(), m2.GetPrecision()) diff --git a/accounting/doc.go b/accounting/doc.go index 42de312..1f18a00 100644 --- a/accounting/doc.go +++ b/accounting/doc.go @@ -14,7 +14,7 @@ On client side: import "github.com/nspcc-dev/neofs-api-go/v2/accounting" var msg accounting.Decimal - dec.WriteToMessageV2(&msg) + dec.WriteToV2(&msg) // send msg @@ -22,7 +22,7 @@ On server side: // recv msg var dec accounting.Decimal - dec.ReadFromMessageV2(msg) + dec.ReadFromV2(msg) // process dec diff --git a/client/accounting.go b/client/accounting.go index eda81b8..82aec79 100644 --- a/client/accounting.go +++ b/client/accounting.go @@ -95,7 +95,7 @@ func (c *Client) BalanceGet(ctx context.Context, prm PrmBalanceGet) (*ResBalance if bal := resp.GetBody().GetBalance(); bal != nil { var d accounting.Decimal - d.ReadFromMessageV2(*bal) + d.ReadFromV2(*bal) res.setAmount(&d) }