Closed oec closed 10 years ago
Suggested diff:
diff --git a/rrd_c.go b/rrd_c.go index 348c017..9ff5a60 100644 --- a/rrd_c.go +++ b/rrd_c.go @@ -457,6 +457,14 @@ func (r *FetchResult) FreeValues() { C.free(unsafe.Pointer(sliceHeader.Data)) } + +// Get a copy of the (c-)values of a FetchResult as slice +func (r *FetchResult) GetValues() []float64 { + ret := make([]float64,len(r.values)) + copy(ret,r.values) + return ret +} + // Export data from RRD file(s) func (e *Exporter) xport(start, end time.Time, step time.Duration) (XportResult, error) { cStart := C.time_t(start.Unix())
I've just added Values method which does what you want. Please check last commit.
Suggested diff: