-
Notifications
You must be signed in to change notification settings - Fork 663
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
MG-2214 - Add LTREE Path to Groups #2223
base: main
Are you sure you want to change the base?
Conversation
c8c66bc
to
603cf33
Compare
pkg/groups/groups.go
Outdated
@@ -52,6 +52,7 @@ type MembersPage struct { | |||
// of Groups that belong to the page. | |||
type Page struct { | |||
PageMeta | |||
Type 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.
Do we need this?
} | ||
if gm.ID == "" { | ||
q = `SELECT DISTINCT g.id, g.domain_id, COALESCE(g.parent_id, '') AS parent_id, g.name, g.description, | ||
g.metadata, g.created_at, g.updated_at, g.updated_by, g.status FROM groups g` | ||
g.metadata, g.created_at, g.updated_at, g.updated_by, g.status, nlevel(path) as level, g.path FROM groups g` | ||
query = buildQuery(gm, "WHERE") |
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.
Add the WHERE
and AND
clauses in buildquery
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.
They are added in buildquery @rodneyosodo, I added WHERE
as a parameter since at times we need to build the query with a WHERE
clause and at times we need to append more queries using AND
.
internal/groups/postgres/groups.go
Outdated
return query | ||
} | ||
path = parent.Path + "." + g.ID | ||
if len(strings.Split(path, ".")) > 20 { |
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.
what is this magic number
Signed-off-by: WashingtonKK <washingtonkigan@gmail.com> feat(groups): ffetch groups using ltree Signed-off-by: WashingtonKK <washingtonkigan@gmail.com> fix(groups): remove lquery Signed-off-by: WashingtonKK <washingtonkigan@gmail.com> feat(groups): add index Signed-off-by: WashingtonKK <washingtonkigan@gmail.com> fix(groups): handle empty response body Signed-off-by: WashingtonKK <washingtonkigan@gmail.com> refactor groups for test Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
Signed-off-by: WashingtonKK <washingtonkigan@gmail.com> refactor: ltree in groups Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
Signed-off-by: WashingtonKK <washingtonkigan@gmail.com> fix: tests Signed-off-by: WashingtonKK <washingtonkigan@gmail.com> fix: tests Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
Signed-off-by: WashingtonKK <washingtonkigan@gmail.com> fix ci Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
Signed-off-by: WashingtonKK <washingtonkigan@gmail.com>
What type of PR is this?
This is a feature because it adds LTREE to groups.
What does this do?
This adds ltree to groups
Which issue(s) does this PR fix/relate to?
Have you included tests for your changes?
Yes, I have included tests for my changes.
Did you document any new/modified feature?
Yes, I have updated the documentation for the new feature.
Notes
Signed-off-by: WashingtonKK washingtonkigan@gmail.com