Skip to content

Commit bef96b7

Browse files
committed
♻️ refactor: refactor codebase #2
1 parent 1f3f889 commit bef96b7

16 files changed

+93
-94
lines changed

README.md

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
# unify4go
1+
# unify4g
22

3-
**unify4go** is a comprehensive Go library designed to enhance productivity by providing a suite of utilities for string manipulation, time handling, type conversions, and more. It aims to facilitate cleaner and more maintainable code.
3+
**unify4g** is a comprehensive Go library designed to enhance productivity by providing a suite of utilities for string manipulation, time handling, type conversions, and more. It aims to facilitate cleaner and more maintainable code.
44

55
## Features
66

77
- **String Utilities**: Enhance and manipulate strings efficiently.
8-
- **Time Handling**: Simplify date and time operations.
98
- **Type Conversions**: Convert between various data types effortlessly.
109
- **Miscellaneous Utilities**: A collection of tools to enhance your Go development experience.
1110

@@ -20,12 +19,12 @@ To install, you can use the following commands based on your preference:
2019
- For a specific version:
2120

2221
```bash
23-
go get github.com/sivaosorg/unify4go[email protected]
22+
go get github.com/sivaosorg/unify4g[email protected]
2423
```
2524

2625
- For the latest version:
2726
```bash
28-
go get -u github.com/sivaosorg/unify4go.git@latest
27+
go get -u github.com/sivaosorg/unify4g.git@latest
2928
```
3029

3130
### Contributing
@@ -35,13 +34,13 @@ To contribute to project, follow these steps:
3534
1. Clone the repository:
3635

3736
```bash
38-
git clone --depth 1 https://github.com/sivaosorg/unify4go.git
37+
git clone --depth 1 https://github.com/sivaosorg/unify4g.git
3938
```
4039

4140
2. Navigate to the project directory:
4241

4342
```bash
44-
cd unify4go
43+
cd unify4g
4544
```
4645

4746
3. Prepare the project environment:

const.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package unify4go
1+
package unify4g
22

33
import (
44
"regexp"

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module github.com/sivaosorg/unify4go
1+
module github.com/sivaosorg/unify4g
22

33
go 1.23.1
44

hashmap.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package unify4go
1+
package unify4g
22

33
// HashMap is a generic hash map data structure that maps keys of type `K` to values of type `V`.
44
// `K` and `V` must be comparable types, meaning that they support comparison operators (like == and !=).

hashset.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package unify4go
1+
package unify4g
22

33
import "fmt"
44

json.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package unify4go
1+
package unify4g
22

33
import (
44
jsonI "github.com/json-iterator/go"

normalization.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package unify4go
1+
package unify4g
22

33
// normalize_rune takes a rune as input and returns its normalized string representation.
44
//

random.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package unify4go
1+
package unify4g
22

33
import (
44
"math/rand"

reflect.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package unify4go
1+
package unify4g
22

33
import "reflect"
44

stack.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package unify4go
1+
package unify4g
22

33
// Stack is a generic stack data structure that stores elements of type `T`.
44
// It provides basic stack operations like push, pop, and peek.

strings.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package unify4go
1+
package unify4g
22

33
import (
44
"crypto/sha256"
@@ -783,10 +783,10 @@ func RemoveAccents(s string) string {
783783
//
784784
// Example:
785785
//
786-
// unify4go.Slugify("'We löve Motörhead'") //Output: we-love-motorhead
786+
// unify4g.Slugify("'We löve Motörhead'") //Output: we-love-motorhead
787787
//
788-
// Normalzation is done with unify4go.ReplaceAccents function using a rune replacement map
789-
// You can use the following code for better normalization before unify4go.Slugify()
788+
// Normalzation is done with unify4g.ReplaceAccents function using a rune replacement map
789+
// You can use the following code for better normalization before unify4g.Slugify()
790790
//
791791
// str := "'We löve Motörhead'"
792792
// t := transform.Chain(norm.NFD, runes.Remove(runes.In(unicode.Mn)), norm.NFC)
@@ -800,7 +800,7 @@ func RemoveAccents(s string) string {
800800
// import "github.com/rainycape/unidecode"
801801
//
802802
// str := unidecode.Unidecode("你好, world!")
803-
// unify4go.Slugify(str) //Output: ni-hao-world
803+
// unify4g.Slugify(str) //Output: ni-hao-world
804804
func Slugify(s string) string {
805805
return SlugifySpecial(s, "-")
806806
}
@@ -811,7 +811,7 @@ func Slugify(s string) string {
811811
//
812812
// Example:
813813
//
814-
// unify4go.SlugifySpecial("'We löve Motörhead'", "-") //Output: we-love-motorhead
814+
// unify4g.SlugifySpecial("'We löve Motörhead'", "-") //Output: we-love-motorhead
815815
//
816816
// SlugifySpecial doesn't support transliteration. You should use a transliteration
817817
// library before SlugifySpecial like github.com/rainycape/unidecode
@@ -821,7 +821,7 @@ func Slugify(s string) string {
821821
// import "github.com/rainycape/unidecode"
822822
//
823823
// str := unidecode.Unidecode("你好, world!")
824-
// unify4go.SlugifySpecial(str, "-") //Output: ni-hao-world
824+
// unify4g.SlugifySpecial(str, "-") //Output: ni-hao-world
825825
func SlugifySpecial(str string, delimiter string) string {
826826
str = RemoveAccents(str)
827827
delBytes := []byte(delimiter)

test/hashmap_test.go

+16-16
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@ package example_test
33
import (
44
"testing"
55

6-
"github.com/sivaosorg/unify4go"
6+
"github.com/sivaosorg/unify4g"
77
)
88

99
func TestNewHashMap(t *testing.T) {
10-
hashMap := unify4go.NewHashMap[int, string]()
10+
hashMap := unify4g.NewHashMap[int, string]()
1111
if hashMap == nil {
1212
t.Errorf("Hashmap is nil")
1313
return
1414
}
1515
}
1616

1717
func TestPut(t *testing.T) {
18-
hashMap := unify4go.NewHashMap[int, string]()
18+
hashMap := unify4g.NewHashMap[int, string]()
1919
if hashMap == nil {
2020
t.Errorf("Hashmap is nil")
2121
return
@@ -38,7 +38,7 @@ func TestPut(t *testing.T) {
3838
}
3939

4040
func TestGet(t *testing.T) {
41-
hashMap := unify4go.NewHashMap[int, string]()
41+
hashMap := unify4g.NewHashMap[int, string]()
4242
if hashMap == nil {
4343
t.Errorf("Hashmap is nil")
4444
return
@@ -57,7 +57,7 @@ func TestGet(t *testing.T) {
5757
}
5858

5959
func TestRemove(t *testing.T) {
60-
hashMap := unify4go.NewHashMap[int, string]()
60+
hashMap := unify4g.NewHashMap[int, string]()
6161
if hashMap == nil {
6262
t.Errorf("Hashmap is nil")
6363
return
@@ -78,7 +78,7 @@ func TestRemove(t *testing.T) {
7878
}
7979

8080
func TestClear(t *testing.T) {
81-
hashMap := unify4go.NewHashMap[int, string]()
81+
hashMap := unify4g.NewHashMap[int, string]()
8282
if hashMap == nil {
8383
t.Errorf("Hashmap is nil")
8484
return
@@ -95,7 +95,7 @@ func TestClear(t *testing.T) {
9595
}
9696

9797
func TestKeySet(t *testing.T) {
98-
hashMap := unify4go.NewHashMap[int, string]()
98+
hashMap := unify4g.NewHashMap[int, string]()
9999
if hashMap == nil {
100100
t.Errorf("Hashmap is nil")
101101
return
@@ -112,7 +112,7 @@ func TestKeySet(t *testing.T) {
112112
}
113113

114114
func BenchmarkHashMapPut100(b *testing.B) {
115-
hashMap := unify4go.NewHashMap[int, string]()
115+
hashMap := unify4g.NewHashMap[int, string]()
116116
b.StopTimer()
117117
b.StartTimer()
118118
for i := 0; i < b.N; i++ {
@@ -123,7 +123,7 @@ func BenchmarkHashMapPut100(b *testing.B) {
123123
}
124124

125125
func BenchmarkHashMapPut10000(b *testing.B) {
126-
hashMap := unify4go.NewHashMap[int, string]()
126+
hashMap := unify4g.NewHashMap[int, string]()
127127
b.StopTimer()
128128
b.StartTimer()
129129
for i := 0; i < b.N; i++ {
@@ -134,7 +134,7 @@ func BenchmarkHashMapPut10000(b *testing.B) {
134134
}
135135

136136
func BenchmarkHashMapPut1000000(b *testing.B) {
137-
hashMap := unify4go.NewHashMap[int, string]()
137+
hashMap := unify4g.NewHashMap[int, string]()
138138
b.StopTimer()
139139
b.StartTimer()
140140
for i := 0; i < b.N; i++ {
@@ -145,7 +145,7 @@ func BenchmarkHashMapPut1000000(b *testing.B) {
145145
}
146146

147147
func BenchmarkHashMapRemove100(b *testing.B) {
148-
hashMap := unify4go.NewHashMap[int, string]()
148+
hashMap := unify4g.NewHashMap[int, string]()
149149

150150
for i := 0; i < b.N; i++ {
151151
b.StopTimer()
@@ -160,7 +160,7 @@ func BenchmarkHashMapRemove100(b *testing.B) {
160160
}
161161

162162
func BenchmarkHashMapRemove10000(b *testing.B) {
163-
hashMap := unify4go.NewHashMap[int, string]()
163+
hashMap := unify4g.NewHashMap[int, string]()
164164

165165
for i := 0; i < b.N; i++ {
166166
b.StopTimer()
@@ -175,7 +175,7 @@ func BenchmarkHashMapRemove10000(b *testing.B) {
175175
}
176176

177177
func BenchmarkHashMapRemove1000000(b *testing.B) {
178-
hashMap := unify4go.NewHashMap[int, string]()
178+
hashMap := unify4g.NewHashMap[int, string]()
179179

180180
for i := 0; i < b.N; i++ {
181181
b.StopTimer()
@@ -190,7 +190,7 @@ func BenchmarkHashMapRemove1000000(b *testing.B) {
190190
}
191191

192192
func BenchmarkHashMapContains100(b *testing.B) {
193-
hashMap := unify4go.NewHashMap[int, string]()
193+
hashMap := unify4g.NewHashMap[int, string]()
194194
for j := 0; j < 100; j++ {
195195
hashMap.Put(j, "test")
196196
}
@@ -202,7 +202,7 @@ func BenchmarkHashMapContains100(b *testing.B) {
202202
}
203203

204204
func BenchmarkHashMapContains10000(b *testing.B) {
205-
hashMap := unify4go.NewHashMap[int, string]()
205+
hashMap := unify4g.NewHashMap[int, string]()
206206
for j := 0; j < 10000; j++ {
207207
hashMap.Put(j, "test")
208208
}
@@ -214,7 +214,7 @@ func BenchmarkHashMapContains10000(b *testing.B) {
214214
}
215215

216216
func BenchmarkHashMapContains1000000(b *testing.B) {
217-
hashMap := unify4go.NewHashMap[int, string]()
217+
hashMap := unify4g.NewHashMap[int, string]()
218218
for j := 0; j < 1000000; j++ {
219219
hashMap.Put(j, "test")
220220
}

0 commit comments

Comments
 (0)