Skip to content

Commit 0444763

Browse files
author
maksim.konovalov
committed
use pointer instead interface & rname signature
1 parent 6e2c73d commit 0444763

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

box/box.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ type Box struct {
1010
conn tarantool.Doer // Connection interface for interacting with Tarantool.
1111
}
1212

13-
// By returns a new instance of the box structure, which implements the Box interface.
14-
func New(conn tarantool.Doer) Box {
13+
// New returns a new instance of the box structure, which implements the Box interface.
14+
func New(conn tarantool.Doer) *Box {
1515
return &Box{
1616
conn: conn, // Assigns the provided Tarantool connection.
1717
}
1818
}
1919

2020
// Info retrieves the current information of the Tarantool instance.
2121
// It calls the "box.info" function and parses the result into the Info structure.
22-
func (b *box) Info() (Info, error) {
22+
func (b *Box) Info() (Info, error) {
2323
var infoResp InfoResponse
2424

2525
// Call "box.info" to get instance information from Tarantool.

box/box_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ import (
77
"github.com/tarantool/go-tarantool/v2/box"
88
)
99

10-
func TestBy(t *testing.T) {
10+
func TestNew(t *testing.T) {
1111
// We expect a panic because we are passing a nil connection (nil Doer) to the By function.
1212
// The library does not control this zone, and the nil connection would cause a runtime error
1313
// when we attempt to call methods (like Info) on it.
1414
// This test ensures that such an invalid state is correctly handled by causing a panic,
1515
// as it's outside the library's responsibility.
1616
require.Panics(t, func() {
1717
// Create a box instance with a nil connection. This should lead to a panic later.
18-
b := box.By(nil)
18+
b := box.New(nil)
1919

2020
// Ensure the box instance is not nil (which it shouldn't be), but this is not meaningful
2121
// since we will panic when we call the Info method with the nil connection.

box/tarantool_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func TestBox_Sugar_Info(t *testing.T) {
3939
conn, err := tarantool.Connect(ctx, dialer, tarantool.Opts{})
4040
require.NoError(t, err)
4141

42-
info, err := box.By(conn).Info()
42+
info, err := box.New(conn).Info()
4343
require.NoError(t, err)
4444

4545
validateInfo(t, info)

0 commit comments

Comments
 (0)