Skip to content

Commit

Permalink
data: Add frame.SetRefID method (#1209)
Browse files Browse the repository at this point in the history
  • Loading branch information
kylebrandt authored Jan 28, 2025
1 parent 73f56c7 commit 69da630
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
7 changes: 7 additions & 0 deletions data/field.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,13 @@ func (f *Field) Nullable() bool {
return f.Type().Nullable()
}

// SetConfig modifies the Field's Config property to
// be set to conf and returns the Field.
func (f *Field) SetConfig(conf *FieldConfig) *Field {
f.Config = conf
return f
}

// FloatAt returns a float64 at the specified index idx for all supported Field types.
// It will panic if idx is out of range.
//
Expand Down
13 changes: 6 additions & 7 deletions data/frame.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,6 @@ func (f *Frame) TypeIndices(fTypes ...FieldType) []int {
return indices
}

// SetConfig modifies the Field's Config property to
// be set to conf and returns the Field.
func (f *Field) SetConfig(conf *FieldConfig) *Field {
f.Config = conf
return f
}

// NewFrame returns a new Frame.
func NewFrame(name string, fields ...*Field) *Frame {
return &Frame{
Expand All @@ -232,6 +225,12 @@ func (f *Frame) SetMeta(m *FrameMeta) *Frame {
return f
}

// SetRefID sets the Frame's RefID attribute to r and returns the Frame.
func (f *Frame) SetRefID(r string) *Frame {
f.RefID = r
return f
}

// Rows returns the number of rows in the frame.
func (f *Frame) Rows() int {
if len(f.Fields) > 0 {
Expand Down

0 comments on commit 69da630

Please sign in to comment.