rename side to kind

This commit is contained in:
2026-05-16 14:21:14 +01:00
parent d371aca767
commit 5cdccfcdb1
9 changed files with 146 additions and 142 deletions

View File

@@ -9,28 +9,28 @@ import (
)
type testRecord struct {
symbol string
nature internal.Nature
symbol string
nature internal.Nature
brokerCountry int64
assetCountry int64
side internal.Side
price decimal.Decimal
quantity decimal.Decimal
timestamp time.Time
fees decimal.Decimal
taxes decimal.Decimal
assetCountry int64
side internal.Kind
price decimal.Decimal
quantity decimal.Decimal
timestamp time.Time
fees decimal.Decimal
taxes decimal.Decimal
}
func (m testRecord) Symbol() string { return m.symbol }
func (m testRecord) Nature() internal.Nature { return m.nature }
func (m testRecord) BrokerCountry() int64 { return m.brokerCountry }
func (m testRecord) AssetCountry() int64 { return m.assetCountry }
func (m testRecord) Side() internal.Side { return m.side }
func (m testRecord) Price() decimal.Decimal { return m.price }
func (m testRecord) Quantity() decimal.Decimal { return m.quantity }
func (m testRecord) Timestamp() time.Time { return m.timestamp }
func (m testRecord) Fees() decimal.Decimal { return m.fees }
func (m testRecord) Taxes() decimal.Decimal { return m.taxes }
func (m testRecord) Symbol() string { return m.symbol }
func (m testRecord) Nature() internal.Nature { return m.nature }
func (m testRecord) BrokerCountry() int64 { return m.brokerCountry }
func (m testRecord) AssetCountry() int64 { return m.assetCountry }
func (m testRecord) Kind() internal.Kind { return m.side }
func (m testRecord) Price() decimal.Decimal { return m.price }
func (m testRecord) Quantity() decimal.Decimal { return m.quantity }
func (m testRecord) Timestamp() time.Time { return m.timestamp }
func (m testRecord) Fees() decimal.Decimal { return m.fees }
func (m testRecord) Taxes() decimal.Decimal { return m.taxes }
func TestAny(t *testing.T) {
selector := internal.Any()
@@ -43,9 +43,9 @@ func TestAny(t *testing.T) {
{
name: "returns true for any record",
record: testRecord{
symbol: "AAPL",
nature: internal.NatureG01,
assetCountry: 1,
symbol: "AAPL",
nature: internal.NatureG01,
assetCountry: 1,
},
want: true,
},
@@ -59,7 +59,7 @@ func TestAny(t *testing.T) {
want: true,
},
{
name: "returns true for empty record",
name: "returns true for empty record",
record: testRecord{},
want: true,
},
@@ -77,10 +77,10 @@ func TestAny(t *testing.T) {
func TestOnlyNature(t *testing.T) {
tests := []struct {
name string
nature internal.Nature
record internal.Record
want bool
name string
nature internal.Nature
record internal.Record
want bool
}{
{
name: "matches G01 nature",
@@ -133,10 +133,10 @@ func TestOnlyNature(t *testing.T) {
func TestOnlyAssetCountry(t *testing.T) {
tests := []struct {
name string
country int64
record internal.Record
want bool
name string
country int64
record internal.Record
want bool
}{
{
name: "matches asset country",