Improve performance of dashboard list orgs #16099

Merged
lunny merged 6 commits from lunny/list_orgs_performance into main 2021-06-14 12:18:09 +00:00
Owner

partially fix #15412

partially fix #15412
6543 (Migrated from github.com) reviewed 2021-06-07 15:56:37 +00:00
6543 (Migrated from github.com) commented 2021-06-07 15:56:36 +00:00
Author
Owner

why not just use User directly?
for later refactors?!?

why not just use User directly? for later refactors?!?
lunny reviewed 2021-06-08 02:12:50 +00:00
Author
Owner

To notice that the struct only have part fields filled. If we don't add this, we cannot differ the two Users.

To notice that the struct only have part fields filled. If we don't add this, we cannot differ the two Users.
6543 (Migrated from github.com) reviewed 2021-06-08 03:06:30 +00:00
6543 (Migrated from github.com) commented 2021-06-08 03:06:30 +00:00
Author
Owner

doesnt it make more sence then to create a new struct type?

doesnt it make more sence then to create a new struct type?
lunny reviewed 2021-06-08 04:13:47 +00:00
Author
Owner

I have tried that, but we have to copy some functions from User.

I have tried that, but we have to copy some functions from `User`.
zeripath reviewed 2021-06-08 06:25:20 +00:00
Contributor

This is why most Java design moved to use POJOs for data with functionality moved to Services eg UserService to do actions on that data.

Our data structs are too powerful & ultimately too tightly bound to the db interface. modules/git is another example and is why creating a second backend was so so hard.

For the moment don't call this "Simple" call it MinimalUser or something like that.

This is why most Java design moved to use POJOs for data with functionality moved to Services eg UserService to do actions on that data. Our data structs are too powerful & ultimately too tightly bound to the db interface. `modules/git` is another example and is why creating a second backend was so so hard. For the moment don't call this "Simple" call it `MinimalUser` or something like that.
zeripath approved these changes 2021-06-08 16:53:46 +00:00
KN4CK3R (Migrated from github.com) reviewed 2021-06-14 09:11:52 +00:00
KN4CK3R (Migrated from github.com) commented 2021-06-14 09:11:38 +00:00
Author
Owner

ctx.ServerError("GetUserOrgsList", err)

`ctx.ServerError("GetUserOrgsList", err)`
lunny reviewed 2021-06-14 10:09:56 +00:00
Author
Owner

done.

done.
6543 (Migrated from github.com) reviewed 2021-06-14 11:02:13 +00:00
6543 (Migrated from github.com) commented 2021-06-14 11:02:02 +00:00
Author
Owner
// MinimalOrg represents a simple orgnization with only needed columns
type MinimalOrg = User
```suggestion // MinimalOrg represents a simple orgnization with only needed columns type MinimalOrg = User ```
6543 (Migrated from github.com) commented 2021-06-14 11:02:09 +00:00
Author
Owner
func GetUserOrgsList(uid int64) ([]*MinimalOrg, error) {
```suggestion func GetUserOrgsList(uid int64) ([]*MinimalOrg, error) { ```
6543 (Migrated from github.com) reviewed 2021-06-14 11:03:57 +00:00
6543 (Migrated from github.com) commented 2021-06-14 11:03:57 +00:00
Author
Owner
	var orgs = make([]*MinimalOrg, 0, 20)
```suggestion var orgs = make([]*MinimalOrg, 0, 20) ```
6543 (Migrated from github.com) approved these changes 2021-06-14 11:04:41 +00:00
This repo is archived. You cannot comment on pull requests.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: lunny/gitea#16099
No description provided.