remove some code duplication in FrameOption encoding

This commit is contained in:
Travis 2017-09-16 18:05:44 -05:00
parent 27921564c0
commit 80603ef28a
No known key found for this signature in database
GPG key ID: 7F08008DFD9314C9

View file

@ -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(),
}
}