Skip to content

Commit

Permalink
Rename package to rawconv
Browse files Browse the repository at this point in the history
  • Loading branch information
roeldev committed Sep 24, 2023
1 parent 1081b1d commit f428f66
Show file tree
Hide file tree
Showing 20 changed files with 42 additions and 42 deletions.
6 changes: 3 additions & 3 deletions .run/go test.run.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="go test" type="GoTestRunConfiguration" factoryName="Go Test">
<module name="parseval" />
<module name="rawconv" />
<working_directory value="$PROJECT_DIR$" />
<go_parameters value="-race" />
<EXTENSION ID="net.ashald.envfile">
Expand All @@ -14,10 +14,10 @@
</ENTRIES>
</EXTENSION>
<kind value="DIRECTORY" />
<package value="github.com/go-pogo/parseval" />
<package value="github.com/go-pogo/rawconv" />
<directory value="$PROJECT_DIR$" />
<filePath value="$PROJECT_DIR$" />
<framework value="gotest" />
<method v="2" />
</configuration>
</component>
</component>
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
parseval
========
rawconv
=======
[![Latest release][latest-release-img]][latest-release-url]
[![Build status][build-status-img]][build-status-url]
[![Go Report Card][report-img]][report-url]
[![Documentation][doc-img]][doc-url]

[latest-release-img]: https://img.shields.io/github/release/go-pogo/parseval.svg?label=latest
[latest-release-img]: https://img.shields.io/github/release/go-pogo/rawconv.svg?label=latest

[latest-release-url]: https://github.com/go-pogo/parseval/releases
[latest-release-url]: https://github.com/go-pogo/rawconv/releases

[build-status-img]: https://github.com/go-pogo/parseval/actions/workflows/test.yml/badge.svg
[build-status-img]: https://github.com/go-pogo/rawconv/actions/workflows/test.yml/badge.svg

[build-status-url]: https://github.com/go-pogo/parseval/actions/workflows/test.yml
[build-status-url]: https://github.com/go-pogo/rawconv/actions/workflows/test.yml

[report-img]: https://goreportcard.com/badge/github.com/go-pogo/parseval
[report-img]: https://goreportcard.com/badge/github.com/go-pogo/rawconv

[report-url]: https://goreportcard.com/report/github.com/go-pogo/parseval
[report-url]: https://goreportcard.com/report/github.com/go-pogo/rawconv

[doc-img]: https://godoc.org/github.com/go-pogo/parseval?status.svg
[doc-img]: https://godoc.org/github.com/go-pogo/rawconv?status.svg

[doc-url]: https://pkg.go.dev/github.com/go-pogo/parseval
[doc-url]: https://pkg.go.dev/github.com/go-pogo/rawconv


Package `parseval` contains everything needed to create (custom) types which
Package `rawconv` contains everything needed to create (custom) types which
can unmarshal raw string values to any type in Go.

```sh
go get github.com/go-pogo/parseval
go get github.com/go-pogo/rawconv
```

```go
import "github.com/go-pogo/parseval"
import "github.com/go-pogo/rawconv"
```

## Documentation
Expand Down
2 changes: 1 addition & 1 deletion decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package parseval
package rawconv

import (
"github.com/go-pogo/errors"
Expand Down
2 changes: 1 addition & 1 deletion decode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package parseval
package rawconv

import (
"github.com/stretchr/testify/assert"
Expand Down
2 changes: 1 addition & 1 deletion encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package parseval
package rawconv

import (
"github.com/go-pogo/errors"
Expand Down
2 changes: 1 addition & 1 deletion encode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package parseval
package rawconv

import (
"github.com/go-pogo/errors"
Expand Down
2 changes: 1 addition & 1 deletion error.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package parseval
package rawconv

import (
"github.com/go-pogo/errors"
Expand Down
4 changes: 2 additions & 2 deletions examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package parseval
package rawconv

import (
"fmt"
Expand Down Expand Up @@ -75,7 +75,7 @@ func ExampleUnmarshaler_Register() {

spew.Dump(target)
// Output:
// (parseval.myType) {
// (rawconv.myType) {
// something: (string) (len=10) "some value"
// }
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/go-pogo/parseval
module github.com/go-pogo/rawconv

go 1.18

Expand Down
6 changes: 3 additions & 3 deletions register.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package parseval
package rawconv

import (
"encoding"
Expand Down Expand Up @@ -55,7 +55,7 @@ type register[T interface{ MarshalFunc | UnmarshalFunc }] struct {

func (r *register[T]) initialized() bool { return r.types != nil && r.funcs != nil }

const panicUnsupportedKind = "parseval: unsupported kind"
const panicUnsupportedKind = "rawconv: unsupported kind"

func (r *register[T]) add(typ reflect.Type, fn T) {
k := typ.Kind()
Expand Down Expand Up @@ -127,7 +127,7 @@ func (r *register[T]) getFromImpl(typ reflect.Type) T {
return nil
}

const panicInvalidFuncIndex = "parseval: invalid index, func must exist!"
const panicInvalidFuncIndex = "rawconv: invalid index, func must exist!"

func (r *register[T]) getFromIndex(i int) T {
if i >= len(r.funcs) {
Expand Down
2 changes: 1 addition & 1 deletion register_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package parseval
package rawconv

import (
"github.com/stretchr/testify/assert"
Expand Down
2 changes: 1 addition & 1 deletion val_bool.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package parseval
package rawconv

import (
"strconv"
Expand Down
2 changes: 1 addition & 1 deletion val_complex.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package parseval
package rawconv

import (
"strconv"
Expand Down
2 changes: 1 addition & 1 deletion val_duration.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package parseval
package rawconv

import (
"github.com/go-pogo/errors"
Expand Down
2 changes: 1 addition & 1 deletion val_float.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package parseval
package rawconv

import (
"strconv"
Expand Down
2 changes: 1 addition & 1 deletion val_int.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package parseval
package rawconv

import (
"strconv"
Expand Down
2 changes: 1 addition & 1 deletion val_uint.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package parseval
package rawconv

import (
"strconv"
Expand Down
2 changes: 1 addition & 1 deletion val_url.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package parseval
package rawconv

import (
"github.com/go-pogo/errors"
Expand Down
6 changes: 3 additions & 3 deletions value.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package parseval
package rawconv

// Value is a textual representation of a raw value which is able to cast itself
// to any of the supported types using its corresponding method.
//
// boolVal, err := parseval.Value("true").Bool()
// boolVal, err := rawconv.Value("true").Bool()
type Value string

// IsEmpty indicates if Value is an empty string.
func (v Value) IsEmpty() bool { return string(v) == "" }

func (v Value) GoString() string { return `parseval.Value("` + v.String() + `")` }
func (v Value) GoString() string { return `rawconv.Value("` + v.String() + `")` }

// String returns Value as a raw string.
func (v Value) String() string { return string(v) }
Expand Down
8 changes: 4 additions & 4 deletions value_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package parseval
package rawconv

import (
"github.com/go-pogo/errors"
Expand Down Expand Up @@ -266,7 +266,7 @@ func TestValue_IsEmpty(t *testing.T) {
}

func TestValue_GoString(t *testing.T) {
assert.Equal(t, `parseval.Value("")`, Value("").GoString())
assert.Equal(t, `parseval.Value("0")`, Value("0").GoString())
assert.Equal(t, `parseval.Value("just some value")`, Value("just some value").GoString())
assert.Equal(t, `rawconv.Value("")`, Value("").GoString())
assert.Equal(t, `rawconv.Value("0")`, Value("0").GoString())
assert.Equal(t, `rawconv.Value("just some value")`, Value("just some value").GoString())
}

0 comments on commit f428f66

Please sign in to comment.