diff --git a/paginator/paginator.go b/paginator/paginator.go index e277c90..979380b 100644 --- a/paginator/paginator.go +++ b/paginator/paginator.go @@ -192,7 +192,19 @@ func (p *Paginator) decodeCursor(dest interface{}) (result []interface{}, err er } // replace null values for i := range result { - if isNil(result[i]) { + var isNullValue bool + // for custom types, evaluate isNil on the underlying value + if ct, ok := result[i].(cursor.CustomType); ok && p.rules[i].CustomType != nil { + val, valErr := ct.GetCustomTypeValue(p.rules[i].CustomType.Meta) + if valErr != nil { + err = valErr + } + isNullValue = isNil(val) + } else { + isNullValue = isNil(result[i]) + } + + if isNullValue { result[i] = p.rules[i].NULLReplacement } }