Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get frame fields by name #16

Open
jumale opened this issue May 24, 2019 · 0 comments
Open

Get frame fields by name #16

jumale opened this issue May 24, 2019 · 0 comments

Comments

@jumale
Copy link
Collaborator

jumale commented May 24, 2019

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant