-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Xin Hao
committed
Jan 8, 2024
1 parent
911d8f5
commit fd13b92
Showing
7 changed files
with
69 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,9 @@ | ||
module github.com/vesoft-inc/nebula-go/v3 | ||
|
||
go 1.18 | ||
go 1.16 | ||
|
||
require ( | ||
github.com/samber/lo v1.39.0 | ||
github.com/stretchr/testify v1.7.0 | ||
github.com/vesoft-inc/fbthrift v0.0.0-20230214024353-fa2f34755b28 | ||
golang.org/x/net v0.17.0 | ||
) | ||
|
||
require ( | ||
github.com/davecgh/go-spew v1.1.0 // indirect | ||
github.com/pmezard/go-difflib v1.0.0 // indirect | ||
golang.org/x/exp v0.0.0-20220303212507-bbda1eaf7a17 // indirect | ||
golang.org/x/text v0.13.0 // indirect | ||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package nebula_go | ||
|
||
func IndexOf(collection []string, element string) int { | ||
for i, item := range collection { | ||
if item == element { | ||
return i | ||
} | ||
} | ||
|
||
return -1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package nebula_go | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestUtil_IndexOf(t *testing.T) { | ||
collection := []string{"a", "b", "c"} | ||
assert.Equal(t, IndexOf(collection, "a"), 0) | ||
assert.Equal(t, IndexOf(collection, "b"), 1) | ||
assert.Equal(t, IndexOf(collection, "c"), 2) | ||
assert.Equal(t, IndexOf(collection, "d"), -1) | ||
} |