Skip to content

Commit

Permalink
transfer to org
Browse files Browse the repository at this point in the history
  • Loading branch information
RangelReale committed Oct 16, 2023
1 parent 7dd3db1 commit 161bc58
Show file tree
Hide file tree
Showing 17 changed files with 34 additions and 34 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# InReq - Golang http request to struct
[![GoDoc](https://godoc.org/github.com/RangelReale/inreq?status.png)](https://godoc.org/github.com/RangelReale/inreq)
[![GoDoc](https://godoc.org/github.com/rrgmc/inreq?status.png)](https://godoc.org/github.com/rrgmc/inreq)

InReq is a Golang library to extract information from `*http.Request` into structs. It does this using
struct tags and/or a configuration map.
Expand All @@ -21,7 +21,7 @@ import (
"net/http"
"strings"

"github.com/RangelReale/inreq"
"github.com/rrgmc/inreq"
)

type InputBody struct {
Expand Down Expand Up @@ -55,7 +55,7 @@ func main() {
data := &Input{}

err = inreq.Decode(r, data,
// usually this will be a framework-specific implementation, like "github.com/RangelReale/inreq-path/gorillamux".
// usually this will be a framework-specific implementation, like "github.com/rrgmc/inreq-path/gorillamux".
inreq.WithPathValue(inreq.PathValueFunc(func(r *http.Request, name string) (found bool, value any, err error) {
if name == "deviceid" {
return true, "12345", err
Expand Down Expand Up @@ -92,7 +92,7 @@ import (
"net/http"
"strings"

"github.com/RangelReale/inreq"
"github.com/rrgmc/inreq"
)

type InputTypeBody struct {
Expand Down Expand Up @@ -124,7 +124,7 @@ func main() {
r.Form.Add("devicename", "form-device-name")

data, err := inreq.DecodeType[InputType](r,
// usually this will be a framework-specific implementation, like "github.com/RangelReale/inreq-path/gorillamux".
// usually this will be a framework-specific implementation, like "github.com/rrgmc/inreq-path/gorillamux".
inreq.WithPathValue(inreq.PathValueFunc(func(r *http.Request, name string) (found bool, value any, err error) {
if name == "deviceid" {
return true, "12345", err
Expand Down Expand Up @@ -184,7 +184,7 @@ func main() {

A path isn't an HTTP concept, but usually http frameworks have a concept of `routes` which can contain path variables,
a framework-specific function should be set using `WithPathValue`. Some of these are available a
[https://github.com/RangelReale/inreq-path](https://github.com/RangelReale/inreq-path).
[https://github.com/rrgmc/inreq-path](https://github.com/rrgmc/inreq-path).

- name: the path var name to get from `PathValue.GetRequestPath`. Default uses `FieldNameMapper`, which by default uses `strings.ToLower`.
- required: whether the path var is required to exist. Default is true.
Expand Down Expand Up @@ -213,7 +213,7 @@ This tag makes the field be ignored.

## Author

The code is based on my other library, [InStruct](https://github.com/RangelReale/instruct), a generic library for
The code is based on my other library, [InStruct](https://github.com/rrgmc/instruct), a generic library for
mapping any data into structs.

Rangel Reale (rangelreale@gmail.com)
4 changes: 2 additions & 2 deletions alias.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package inreq

import (
"github.com/RangelReale/instruct"
"github.com/RangelReale/instruct/types"
"github.com/rrgmc/instruct"
"github.com/rrgmc/instruct/types"
)

// error.go
Expand Down
2 changes: 1 addition & 1 deletion ctx.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package inreq

import "github.com/RangelReale/instruct"
import "github.com/rrgmc/instruct"

// DecodeContext is the context sent to DecodeOperation.
type DecodeContext interface {
Expand Down
4 changes: 2 additions & 2 deletions decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package inreq
import (
"net/http"

"github.com/RangelReale/instruct"
inoptions "github.com/RangelReale/instruct/options"
"github.com/rrgmc/instruct"
inoptions "github.com/rrgmc/instruct/options"
)

// Decoder decodes http requests to structs.
Expand Down
4 changes: 2 additions & 2 deletions decode_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package inreq
import (
"net/http"

"github.com/RangelReale/instruct"
inoptions "github.com/RangelReale/instruct/options"
"github.com/rrgmc/instruct"
inoptions "github.com/rrgmc/instruct/options"
)

// TypeDecoder decodes http requests to structs.
Expand Down
4 changes: 2 additions & 2 deletions example_decode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"net/http"
"strings"

"github.com/RangelReale/inreq"
"github.com/rrgmc/inreq"
)

type InputBody struct {
Expand Down Expand Up @@ -39,7 +39,7 @@ func ExampleDecode() {
data := &Input{}

err = inreq.Decode(r, data,
// usually this will be a framework-specific implementation, like "github.com/RangelReale/inreq-path/gorillamux".
// usually this will be a framework-specific implementation, like "github.com/rrgmc/inreq-path/gorillamux".
inreq.WithPathValue(inreq.PathValueFunc(func(r *http.Request, name string) (found bool, value any, err error) {
if name == "deviceid" {
return true, "12345", err
Expand Down
4 changes: 2 additions & 2 deletions example_decoder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"net/http"
"strings"

"github.com/RangelReale/inreq"
"github.com/rrgmc/inreq"
)

type InputDecoderBody struct {
Expand Down Expand Up @@ -39,7 +39,7 @@ func ExampleNewDecoder() {
data := &Input{}

decoder := inreq.NewDecoder(
// usually this will be a framework-specific implementation, like "github.com/RangelReale/inreq-path/gorillamux".
// usually this will be a framework-specific implementation, like "github.com/rrgmc/inreq-path/gorillamux".
inreq.WithPathValue(inreq.PathValueFunc(func(r *http.Request, name string) (found bool, value any, err error) {
if name == "deviceid" {
return true, "12345", err
Expand Down
4 changes: 2 additions & 2 deletions example_decodetype_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"net/http"
"strings"

"github.com/RangelReale/inreq"
"github.com/rrgmc/inreq"
)

type InputTypeBody struct {
Expand Down Expand Up @@ -37,7 +37,7 @@ func ExampleDecodeType() {
r.Form.Add("devicename", "form-device-name")

data, err := inreq.DecodeType[InputType](r,
// usually this will be a framework-specific implementation, like "github.com/RangelReale/inreq-path/gorillamux".
// usually this will be a framework-specific implementation, like "github.com/rrgmc/inreq-path/gorillamux".
inreq.WithPathValue(inreq.PathValueFunc(func(r *http.Request, name string) (found bool, value any, err error) {
if name == "deviceid" {
return true, "12345", err
Expand Down
4 changes: 2 additions & 2 deletions example_typedecoder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"net/http"
"strings"

"github.com/RangelReale/inreq"
"github.com/rrgmc/inreq"
)

type InputTypeDecoderBody struct {
Expand Down Expand Up @@ -37,7 +37,7 @@ func ExampleNewTypeDecoder() {
r.Form.Add("devicename", "form-device-name")

decoder := inreq.NewTypeDecoder[InputTypeDecoder](
// usually this will be a framework-specific implementation, like "github.com/RangelReale/inreq-path/gorillamux".
// usually this will be a framework-specific implementation, like "github.com/rrgmc/inreq-path/gorillamux".
inreq.WithPathValue(inreq.PathValueFunc(func(r *http.Request, name string) (found bool, value any, err error) {
if name == "deviceid" {
return true, "12345", err
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module github.com/RangelReale/inreq
module github.com/rrgmc/inreq

go 1.20

require (
github.com/RangelReale/instruct v0.17.0
github.com/rrgmc/instruct v0.17.0
github.com/stretchr/testify v1.8.4
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/RangelReale/instruct v0.17.0 h1:+oprPS5QNbgGR6VfdSqfLhJOPAIa2IuSN5vWbr9Odjg=
github.com/RangelReale/instruct v0.17.0/go.mod h1:IKuAbSEzfM7ucw8sMYKLvOj4cVd+wDpaQ0uQj2pYN7w=
github.com/rrgmc/instruct v0.17.0 h1:+oprPS5QNbgGR6VfdSqfLhJOPAIa2IuSN5vWbr9Odjg=
github.com/rrgmc/instruct v0.17.0/go.mod h1:IKuAbSEzfM7ucw8sMYKLvOj4cVd+wDpaQ0uQj2pYN7w=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
Expand Down
2 changes: 1 addition & 1 deletion operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package inreq
import (
"net/http"

"github.com/RangelReale/instruct"
"github.com/rrgmc/instruct"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions option.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package inreq
import (
"net/http"

"github.com/RangelReale/instruct"
"github.com/RangelReale/instruct/options"
"github.com/rrgmc/instruct"
"github.com/rrgmc/instruct/options"
)

type (
Expand Down
4 changes: 2 additions & 2 deletions option_internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package inreq
import (
"net/http"

"github.com/RangelReale/instruct"
"github.com/RangelReale/instruct/options"
"github.com/rrgmc/instruct"
"github.com/rrgmc/instruct/options"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion options.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"net/http"
"reflect"

"github.com/RangelReale/instruct"
"github.com/rrgmc/instruct"
)

// WithTagName sets the tag name to check on structs. The default is "inreq".
Expand Down
2 changes: 1 addition & 1 deletion resolver/resolver.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package resolver

import (
"github.com/RangelReale/instruct/resolver"
"github.com/rrgmc/instruct/resolver"
)

// Resolver is the default Resolver.
Expand Down
2 changes: 1 addition & 1 deletion resolver/resolver_value.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package resolver

import (
"github.com/RangelReale/instruct/resolver"
"github.com/rrgmc/instruct/resolver"
)

// ValueResolver resolves simple types for a Resolver.
Expand Down

0 comments on commit 161bc58

Please sign in to comment.