From 8a1e78be51a4ec571a19b1d13d46451d119c7e55 Mon Sep 17 00:00:00 2001 From: Fatih Arslan Date: Tue, 28 Oct 2014 20:16:26 +0200 Subject: [PATCH] Update README.md --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 49a56fd..42e75dd 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ go get github.com/fatih/structs ## Usage and Examples Just like the standard lib `strings`, `bytes` and co packages, `structs` has -many global functions to manipulate or organize your struct data Lets define +many global functions to manipulate or organize your struct data. Lets define and declare a struct: ```go @@ -37,27 +37,27 @@ server := &Server{ ```go // Convert a struct to a map[string]interface{} // => {"Name":"gopher", "ID":123456, "Enabled":true} -m := structs.Map(s) +m := structs.Map(server) // Convert the values of a struct to a []interface{} // => ["gopher", 123456, true] -v := structs.Values(s) +v := structs.Values(server) // Convert the values of a struct to a []*Field // (see "Field methods" for more info about fields) -f := structs.Fields(s) // Get a []*Field +f := structs.Fields(server) // Get a []*Field // Return the struct name => "Server" -n := structs.Name(s) // Get the struct name +n := structs.Name(server) // Get the struct name // Check if any field of a struct is initialized or not. -h := structs.HasZero(s) // Check if any field is initialized +h := structs.HasZero(server) // Check if any field is initialized // Check if all fields of a struct is initialized or not. -z := structs.IsZero(s) // Check if all fields are initialized +z := structs.IsZero(server) // Check if all fields are initialized -// Check if s is a struct or a pointer to struct -i := structs.IsStruct(s) +// Check if server is a struct or a pointer to struct +i := structs.IsStruct(server) ``` ### Struct methods