Update README.md
This commit is contained in:
parent
9d01c85dab
commit
68345fdc8f
@ -26,7 +26,9 @@ s := &Server{
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Convert it to a `map[string]interface{}`
|
#### ToMap()
|
||||||
|
|
||||||
|
Convert to a `map[string]interface{}`
|
||||||
|
|
||||||
```go
|
```go
|
||||||
m, err := structure.ToMap(s)
|
m, err := structure.ToMap(s)
|
||||||
@ -38,6 +40,8 @@ if err != nil {
|
|||||||
fmt.Printf("%#v", m)
|
fmt.Printf("%#v", m)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### ToSlice()
|
||||||
|
|
||||||
Convert to a `[]interface{}`. Slice values are **sorted** by default according
|
Convert to a `[]interface{}`. Slice values are **sorted** by default according
|
||||||
to the field names.
|
to the field names.
|
||||||
|
|
||||||
@ -51,6 +55,8 @@ if err != nil {
|
|||||||
fmt.Printf("%#v", m)
|
fmt.Printf("%#v", m)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### IsStruct()
|
||||||
|
|
||||||
Check if it's a struct or a pointer to struct
|
Check if it's a struct or a pointer to struct
|
||||||
|
|
||||||
```go
|
```go
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user