You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the moment frame contains only list of values, so if you need to get a value from specific field, then you first need to get the frame-definition from reader, then get a field index by name, and then resolve the field value by its index.
We can improve it by introducing function which provides this functionality.
For now I have 3 ideas:
when we create a frame, we also add there a pointer to *LogDefinition, and then add frame.GetField(name FieldName) (interface{}, error) to frame type (and maybe even GetFieldString(name FieldName) (string, error) and GetFieldInt32(name FieldName) (int32, error))
(👎single responsibility) instead of passing *LogDefinition to every frame, we could add those methods to the reader, which already has access to *LogDefinition. So it would look like reader.GetFrameField(frame Frame, name FieldName) (interface{}, error)
or we could just export a stateless function which does the job GetFrameField(frame Frame, name FieldName, def *LogDefinition) (interface{}, error)
The text was updated successfully, but these errors were encountered:
At the moment frame contains only list of values, so if you need to get a value from specific field, then you first need to get the frame-definition from reader, then get a field index by name, and then resolve the field value by its index.
We can improve it by introducing function which provides this functionality.
For now I have 3 ideas:
*LogDefinition
, and then addframe.GetField(name FieldName) (interface{}, error)
to frame type (and maybe evenGetFieldString(name FieldName) (string, error)
andGetFieldInt32(name FieldName) (int32, error)
)*LogDefinition
to every frame, we could add those methods to the reader, which already has access to*LogDefinition
. So it would look likereader.GetFrameField(frame Frame, name FieldName) (interface{}, error)
GetFrameField(frame Frame, name FieldName, def *LogDefinition) (interface{}, error)
The text was updated successfully, but these errors were encountered: