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

MG-2214 - Add LTREE Path to Groups #2223

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

WashingtonKK
Copy link
Contributor

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

@@ -52,6 +52,7 @@ type MembersPage struct {
// of Groups that belong to the page.
type Page struct {
PageMeta
Type string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this?

internal/groups/postgres/groups.go Show resolved Hide resolved
}
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")
Copy link
Member

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

Copy link
Contributor Author

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.

return query
}
path = parent.Path + "." + g.ID
if len(strings.Split(path, ".")) > 20 {
Copy link
Member

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>
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

Successfully merging this pull request may close these issues.

Add LTREE Path in Groups
2 participants