2
0

Add inet and cidr to pgtype

This commit is contained in:
Jack Christensen
2017-03-04 17:33:41 -06:00
parent 2010bea555
commit 4cdea13f0f
11 changed files with 916 additions and 43 deletions
+16
View File
@@ -85,6 +85,22 @@ func underlyingBoolType(val interface{}) (interface{}, bool) {
return nil, false
}
// underlyingPtrType dereferences a pointer
func underlyingPtrType(val interface{}) (interface{}, bool) {
refVal := reflect.ValueOf(val)
switch refVal.Kind() {
case reflect.Ptr:
if refVal.IsNil() {
return nil, false
}
convVal := refVal.Elem().Interface()
return convVal, true
}
return nil, false
}
// underlyingTimeType gets the underlying type that can be converted to time.Time
func underlyingTimeType(val interface{}) (interface{}, bool) {
refVal := reflect.ValueOf(val)