Update how isZero handles Pointers (#181)
* Update how isZero handles Pointers
This commit modifies the isZero function so it checks to see if
a pointer is actually set rather than if it points to a zero value.
* Adding a loop to BuildQueryString to efficiently determine parameter type
* Moving reflect.Ptr to top of BuildQueryString loop
diff --git a/params.go b/params.go
index b7f9508..e484fe1 100644
--- a/params.go
+++ b/params.go
@@ -232,7 +232,7 @@
if v.IsNil() {
return true
}
- return isZero(v.Elem())
+ return false
case reflect.Func, reflect.Map, reflect.Slice:
return v.IsNil()
case reflect.Array:
@@ -307,7 +307,11 @@
// if the field is set, add it to the slice of query pieces
if !isZero(v) {
+ loop:
switch v.Kind() {
+ case reflect.Ptr:
+ v = v.Elem()
+ goto loop
case reflect.String:
params.Add(tags[0], v.String())
case reflect.Int: