diff --git a/box/box.go b/box/box.go index bb4260ae..9f0d2855 100644 --- a/box/box.go +++ b/box/box.go @@ -10,8 +10,8 @@ type Box struct { conn tarantool.Doer // Connection interface for interacting with Tarantool. } -// By returns a new instance of the box structure, which implements the Box interface. -func New(conn tarantool.Doer) Box { +// New returns a new instance of the box structure, which implements the Box interface. +func New(conn tarantool.Doer) *Box { return &Box{ conn: conn, // Assigns the provided Tarantool connection. } @@ -19,7 +19,7 @@ func New(conn tarantool.Doer) Box { // Info retrieves the current information of the Tarantool instance. // It calls the "box.info" function and parses the result into the Info structure. -func (b *box) Info() (Info, error) { +func (b *Box) Info() (Info, error) { var infoResp InfoResponse // Call "box.info" to get instance information from Tarantool. diff --git a/box/box_test.go b/box/box_test.go index 93f4f404..db7b73a4 100644 --- a/box/box_test.go +++ b/box/box_test.go @@ -7,7 +7,7 @@ import ( "github.com/tarantool/go-tarantool/v2/box" ) -func TestBy(t *testing.T) { +func TestNew(t *testing.T) { // We expect a panic because we are passing a nil connection (nil Doer) to the By function. // The library does not control this zone, and the nil connection would cause a runtime error // when we attempt to call methods (like Info) on it. @@ -15,7 +15,7 @@ func TestBy(t *testing.T) { // as it's outside the library's responsibility. require.Panics(t, func() { // Create a box instance with a nil connection. This should lead to a panic later. - b := box.By(nil) + b := box.New(nil) // Ensure the box instance is not nil (which it shouldn't be), but this is not meaningful // since we will panic when we call the Info method with the nil connection. diff --git a/box/tarantool_test.go b/box/tarantool_test.go index 01e5b954..3d638b5b 100644 --- a/box/tarantool_test.go +++ b/box/tarantool_test.go @@ -39,7 +39,7 @@ func TestBox_Sugar_Info(t *testing.T) { conn, err := tarantool.Connect(ctx, dialer, tarantool.Opts{}) require.NoError(t, err) - info, err := box.By(conn).Info() + info, err := box.New(conn).Info() require.NoError(t, err) validateInfo(t, info)