From 80603ef28a16b4db6537985be853fbb667544f37 Mon Sep 17 00:00:00 2001 From: Travis Date: Sat, 16 Sep 2017 18:05:44 -0500 Subject: [PATCH] remove some code duplication in FrameOption encoding --- frame.go | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/frame.go b/frame.go index 3c52a8e94..7c785aaa0 100644 --- a/frame.go +++ b/frame.go @@ -223,7 +223,7 @@ func (f *Frame) Options() FrameOptions { } func (f *Frame) options() FrameOptions { - opt := FrameOptions{ + return FrameOptions{ RowLabel: f.rowLabel, InverseEnabled: f.inverseEnabled, RangeEnabled: f.rangeEnabled, @@ -232,7 +232,6 @@ func (f *Frame) options() FrameOptions { TimeQuantum: f.timeQuantum, Fields: f.schema.Fields, } - return opt } // Open opens and initializes the frame. @@ -925,17 +924,10 @@ func encodeFrames(a []*Frame) []*internal.Frame { // encodeFrame converts f into its internal representation. func encodeFrame(f *Frame) *internal.Frame { + options := f.Options() return &internal.Frame{ Name: f.name, - Meta: &internal.FrameMeta{ - RowLabel: f.rowLabel, - InverseEnabled: f.inverseEnabled, - RangeEnabled: f.rangeEnabled, - CacheType: f.cacheType, - CacheSize: f.cacheSize, - TimeQuantum: string(f.timeQuantum), - Fields: encodeFields(f.schema.Fields), - }, + Meta: options.Encode(), } }