func (i Interval) MarshalJSON() ([]byte, error) {
	var str string
	if days := i.Days(); days > 0 {
		str = strconv.Itoa(days)
	} else {
		str = strconv.Itoa(-int(time.Duration(i).Seconds()))
	}
	return []byte(str), nil
}
// MarshalJSON implements the json.Marshaler interface
//
// Values > 1 day are stored as a positive integer. Sub-day values are stored
// as negative seconds. This is to make sorting easy in PouchDB.
MarshalJSON implements the json.Marshaler interface

Values > 1 day are stored as a positive integer. Sub-day values are stored
as negative seconds. This is to make sorting easy in PouchDB.
// MarshalJSON implements the json . Marshaler interface // // Values > 1 day are stored as a positive integer . Sub - day values are stored // as negative seconds . This is to make sorting easy in PouchDB .
func (i Interval) MarshalJSON() ([]byte, error) {
	var str string
	if days := i.Days(); days > 0 {
		str = strconv.Itoa(days)
	} else {
		str = strconv.Itoa(-int(time.Duration(i).Seconds()))
	}
	return []byte(str), nil
}
func ( i Interval ) MarshalJSON ( ) ( [ ] byte , error ) { var str string if days := i . Days ( ) ; days > 0 { str = strconv . Itoa ( days ) } else { str = strconv . Itoa ( - int ( time . Duration ( i ) . Seconds ( ) ) ) } return [ ] byte ( str ) , nil }
MarshalJSON implements the json.Marshaler interface
MarshalJSON implements the json . Marshaler interface