Skip to content

Commit

Permalink
docs: update project README file
Browse files Browse the repository at this point in the history
  • Loading branch information
rsfreitas committed May 29, 2023
1 parent bb9260d commit 3a41319
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ v := struct {
Name: "John",
}

parsed := Parse(v)
parsed, err := Parse(v)
```

The `parsed` variable will now contain a map with the same fields as the input struct:
Expand All @@ -35,7 +35,7 @@ map[string]interface{}{

The output format of the `Parse` function depends on the input type:

- Struct: the output is a map with the same fields as the input struct. The keys of the map are the field names, and the values are the field types represented as strings.
- Struct: the output is a map with the same fields as the input struct. The keys of the map are the field names (if `json` tags is being used, the name attribute will be the key), and the values are the field types represented as strings.

- Map: the output is a map with the same keys as the input map. The values of the map are the corresponding types of the input map values, represented as strings.

Expand All @@ -50,16 +50,16 @@ Here are some examples of input and output for the `Parse` function:
```go
// Struct
v := struct {
Age int
Age int `json:"age"`
Name string
}{
Age: 30,
Name: "John",
}

parsed := Parse(v)
parsed, err := Parse(v)
// parsed = map[string]interface{}{
// "Age": "int",
// "age": "int",
// "Name": "string",
// }

Expand All @@ -69,7 +69,7 @@ v := map[string]int{
"bar": 69,
}

parsed := Parse(v)
parsed, err := Parse(v)
// parsed = map[string]interface{}{
// "foo": "int",
// "bar": "int",
Expand All @@ -81,7 +81,7 @@ v := []interface{}{
42,
}

parsed := Parse(v)
parsed, err := Parse(v)
// parsed = []interface{}{
// "string",
// "int",
Expand All @@ -91,6 +91,6 @@ parsed := Parse(v)
// Primitive types
v := true

parsed := Parse(v)
parsed, err := Parse(v)
// parsed = "bool"
```

0 comments on commit 3a41319

Please sign in to comment.