-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
32 changed files
with
177 additions
and
405 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,46 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/gogf/gf/container/garray" | ||
) | ||
|
||
func main() { | ||
// Create a int array, which is concurrent-unsafe in default. | ||
a := garray.NewIntArray() | ||
|
||
// Appending items. | ||
for i := 0; i < 10; i++ { | ||
a.Append(i) | ||
} | ||
|
||
// Get the length of the array. | ||
fmt.Println(a.Len()) | ||
|
||
// Get the slice of the array. | ||
fmt.Println(a.Slice()) | ||
|
||
// Get the item of specified index. | ||
fmt.Println(a.Get(6)) | ||
|
||
// Insert after/before specified index. | ||
a.InsertAfter(9, 11) | ||
a.InsertBefore(10, 10) | ||
fmt.Println(a.Slice()) | ||
|
||
a.Set(0, 100) | ||
fmt.Println(a.Slice()) | ||
|
||
// Searching the item and returning the index. | ||
fmt.Println(a.Search(5)) | ||
|
||
// Remove item of specified index. | ||
a.Remove(0) | ||
fmt.Println(a.Slice()) | ||
|
||
// Clearing the array. | ||
fmt.Println(a.Slice()) | ||
a.Clear() | ||
fmt.Println(a.Slice()) | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
25 changes: 14 additions & 11 deletions
25
.../container/garray/sorted_string_array1.go → ...e/container/garray/sorted_string_array.go
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,20 +1,23 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/gogf/gf/container/garray" | ||
"github.com/gogf/gf/frame/g" | ||
) | ||
|
||
func main() { | ||
array := garray.NewSortedStringArray() | ||
array.Add("1") | ||
array.Add("2") | ||
array.Add("3") | ||
array.Add("4") | ||
array.Add("5") | ||
array.Add("6") | ||
array.Add("7") | ||
array.Add("8") | ||
array := garray.NewSortedStrArray() | ||
array.Add("9") | ||
g.Dump(array.Slice()) | ||
array.Add("8") | ||
array.Add("7") | ||
array.Add("6") | ||
array.Add("5") | ||
array.Add("4") | ||
array.Add("3") | ||
array.Add("2") | ||
array.Add("1") | ||
fmt.Println(array.Slice()) | ||
// output: | ||
// [1 2 3 4 5 6 7 8 9] | ||
} |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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,26 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/gogf/gf/container/gmap" | ||
"github.com/gogf/gf/frame/g" | ||
) | ||
|
||
func main() { | ||
m1 := gmap.New() | ||
m1.Set("1", "1") | ||
|
||
m2 := m1.Map() | ||
m2["2"] = "2" | ||
|
||
g.Dump(m1.Clone()) | ||
g.Dump(m2) | ||
//output: | ||
//{ | ||
// "1": "1" | ||
//} | ||
// | ||
//{ | ||
// "1": "1", | ||
// "2": "2" | ||
//} | ||
} |
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -30,8 +30,4 @@ func main() { | |
s := new(Score) | ||
v.Struct(s) | ||
fmt.Println(s) | ||
|
||
// 只读接口 | ||
r := v.ReadOnly() | ||
fmt.Println(r.String()) | ||
} |
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
Oops, something went wrong.