-
Notifications
You must be signed in to change notification settings - Fork 43
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
Property service for saving properties to database #4248
Conversation
if err != nil { | ||
return 0, fmt.Errorf("value is not of type int64: %w", err) | ||
} | ||
return int64(fval), nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This need more work because internally structpb.Value
stores any numerical value as float64
. In order to handle int64
and uint64
I will, when creating a property or properties, check if the leaf value is either of those and change the value to be an object containing our own type annotation and the stringified value. The reverse on getting the value.
) | ||
|
||
// PropertiesService is the interface for the properties service | ||
type PropertiesService interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At first I wanted to have just the Retrieve
methods that would save the entity as well when saving the properties. But - I don't know if we can generalize saving the entity, especially while we are still in migrating mode and are saving the entity with a defined UUID that we take from the older tables. So at least for now I split the methods into separate retrieve and save where the idea is that the caller would retrieve properties, save the entity and then save the properties.
03e26bc
to
0696eb4
Compare
@JAORMX this version should be getting quite close. I need to check the unit tests and such, but the manual tests work and the interface is I think what I'd like it to have. I'll be polishing this and then un-draft the PR. I'll also send the first patches in the PR separately for review so we can upstream them and avoid conflicts. |
I fixed a couple of tests, but this is as far as I go on a Friday afternoon. Pieces of the PR have been submitted separately and apart from the tests, I think this is ready to go. |
Adds a service that either returns cached properties for a very short amount of time or contacts the provider to fetch updated service. The service also marshalls the properties to the database properly. Fixes: mindersec#4171
Summary
Adds a service that either returns cached properties for a very short amount of time or contacts the provider to fetch updated service.
The service also marshalls the properties to the database properly.
Fixes: #4171
Change Type
Testing
mostly unit tests so far
Review Checklist: