Skip to content

Commit 0719030

Browse files
committed
omniconv
1 parent 7d55ecf commit 0719030

File tree

8 files changed

+15
-15
lines changed

8 files changed

+15
-15
lines changed

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Converter
1+
# OmniConv
22

3-
[ci]: https://github.com/olegdayo/converter/actions/workflows/ci.yaml/badge.svg
3+
[ci]: https://github.com/olegdayo/omniconv/actions/workflows/ci.yaml/badge.svg
44

55
![CI][ci]
66

@@ -13,14 +13,14 @@ A simple, somewhat declarative type conversion library
1313
```go
1414
func ExampleNumber() {
1515
ints := []int{1, 2, 3, 4}
16-
floats := converter.ConvertSlice(ints, converter.NumberConverter[int, float64])
16+
floats := omniconv.ConvertSlice(ints, omniconv.NumberConverter[int, float64])
1717
fmt.Printf("%#v\n", floats)
1818
// Output: []float64{1, 2, 3, 4}
1919
}
2020

2121
func ExampleString() {
2222
strings := map[int]string{5: "6", 7: "8", 9: "silly"}
23-
uints := converter.ConvertMap(strings, converter.StringToIntConverter[int])
23+
uints := omniconv.ConvertMap(strings, omniconv.StringToIntConverter[int])
2424
fmt.Printf("%#v\n", uints)
2525
// Output: map[int]int{5:6, 7:8, 9:0}
2626
}
@@ -61,7 +61,7 @@ func ExampleCustom() {
6161
Name: sql.NullString{},
6262
},
6363
}
64-
logics := converter.ConvertSlice(repositories, RepositoryToLogicConverter)
64+
logics := omniconv.ConvertSlice(repositories, RepositoryToLogicConverter)
6565
fmt.Printf("%#v\n", logics)
6666
// Output: []examples.ModelLogic{examples.ModelLogic{ID:123, Name:"smth"}, examples.ModelLogic{ID:456, Name:""}}
6767
}

converter.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package converter
1+
package omniconv
22

33
// ConvertSlice converts slice of type F to slice of type T
44
func ConvertSlice[F any, T any](from []F, f func(F) T) (to []T) {

examples/base_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@ package examples
33
import (
44
"fmt"
55

6-
"github.com/olegdayo/converter"
6+
"github.com/olegdayo/omniconv"
77
)
88

99
func ExampleNumber() {
1010
ints := []int{1, 2, 3, 4}
11-
floats := converter.ConvertSlice(ints, converter.NumberConverter[int, float64])
11+
floats := omniconv.ConvertSlice(ints, omniconv.NumberConverter[int, float64])
1212
fmt.Printf("%#v\n", floats)
1313
// Output: []float64{1, 2, 3, 4}
1414
}
1515

1616
func ExampleString() {
1717
strings := map[int]string{5: "6", 7: "8", 9: "silly"}
18-
uints := converter.ConvertMap(strings, converter.StringToIntConverter[int])
18+
uints := omniconv.ConvertMap(strings, omniconv.StringToIntConverter[int])
1919
fmt.Printf("%#v\n", uints)
2020
// Output: map[int]int{5:6, 7:8, 9:0}
2121
}

examples/custom_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"database/sql"
55
"fmt"
66

7-
"github.com/olegdayo/converter"
7+
"github.com/olegdayo/omniconv"
88
)
99

1010
type ModelLogic struct {
@@ -39,7 +39,7 @@ func ExampleCustom() {
3939
Name: sql.NullString{},
4040
},
4141
}
42-
logics := converter.ConvertSlice(repositories, RepositoryToLogicConverter)
42+
logics := omniconv.ConvertSlice(repositories, RepositoryToLogicConverter)
4343
fmt.Printf("%#v\n", logics)
4444
// Output: []examples.ModelLogic{examples.ModelLogic{ID:123, Name:"smth"}, examples.ModelLogic{ID:456, Name:""}}
4545
}

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
module github.com/olegdayo/converter
1+
module github.com/olegdayo/omniconv
22

33
go 1.22

number.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package converter
1+
package omniconv
22

33
type SignedInt interface {
44
~int | ~int8 | ~int16 | ~int32 | ~int64

number_text.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package converter
1+
package omniconv
22

33
import (
44
"fmt"

text.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package converter
1+
package omniconv
22

33
type Text interface {
44
[]byte | string

0 commit comments

Comments
 (0)