-
Notifications
You must be signed in to change notification settings - Fork 22
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
Add support for ODATA $filter, $select and $count on /scanConfigs #84
Conversation
f074819
to
19c8cad
Compare
68e2b6c
to
cf07208
Compare
if err != nil { | ||
return nil, fmt.Errorf("failed to convert scanID %v to uuid: %v", id, err) | ||
return ret, fmt.Errorf("failed to convert scanID %v to uuid: %v", scan.Id, err) |
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.
need to print *scan.Id, right?
return sc, nil | ||
} | ||
|
||
func getExistingScanConfigbyID(db *gorm.DB, scanConfig models.ScanConfig) (ScanConfig, error) { |
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.
By
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.
we can pass only the id here
|
||
// Fields for complex field types | ||
ComplexFieldSchemas []string | ||
DescriminatorProperty string |
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.
Discriminator :)
|
||
// nolint:gocognit,cyclop | ||
func (st *selectNode) insert(path []*godata.Token, filter *godata.GoDataFilterQuery, sel *godata.GoDataSelectQuery, subExpand *godata.GoDataExpandQuery, expand bool) error { | ||
// If path length == 0 then we've reach the bottom of the path and now |
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.
we've reached the bottom of the path, and ...
} | ||
|
||
// Parse $select using ParseExpandString because godata.ParseSelectString | ||
// is a nieve implementation and doesn't handle query options properly |
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.
naive
} | ||
|
||
// nolint:gocognit,cyclop | ||
func (st *selectNode) insert(path []*godata.Token, filter *godata.GoDataFilterQuery, sel *godata.GoDataSelectQuery, subExpand *godata.GoDataExpandQuery, expand bool) error { |
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.
worth putting a todo here to ad a unit test. I think that it will also make it more clear with input and output examples
This commit revisits the database interface such that each function takes in and returns a VMClarity API model object. How the DB driver decides to store these objects and process them efficently is the resposiblity of the DB driver. We start with one DB driver, gorm, which converts the model objects to GORM structs to save them.
* Covers most usecases with a fake DB and dataset * Fixes a couple of bugs with expand * Switches $filter to use / separated paths like $select/$expand
No description provided.