(rows []GetWorkspacesRow)
| 735 | } |
| 736 | |
| 737 | func ConvertWorkspaceRows(rows []GetWorkspacesRow) ([]Workspace, error) { |
| 738 | workspaces := make([]Workspace, len(rows)) |
| 739 | for i, r := range rows { |
| 740 | workspaces[i] = Workspace{ |
| 741 | ID: r.ID, |
| 742 | CreatedAt: r.CreatedAt, |
| 743 | UpdatedAt: r.UpdatedAt, |
| 744 | OwnerID: r.OwnerID, |
| 745 | OrganizationID: r.OrganizationID, |
| 746 | TemplateID: r.TemplateID, |
| 747 | Deleted: r.Deleted, |
| 748 | Name: r.Name, |
| 749 | AutostartSchedule: r.AutostartSchedule, |
| 750 | Ttl: r.Ttl, |
| 751 | LastUsedAt: r.LastUsedAt, |
| 752 | DormantAt: r.DormantAt, |
| 753 | DeletingAt: r.DeletingAt, |
| 754 | AutomaticUpdates: r.AutomaticUpdates, |
| 755 | Favorite: r.Favorite, |
| 756 | OwnerAvatarUrl: r.OwnerAvatarUrl, |
| 757 | OwnerUsername: r.OwnerUsername, |
| 758 | OwnerName: r.OwnerName, |
| 759 | OrganizationName: r.OrganizationName, |
| 760 | OrganizationDisplayName: r.OrganizationDisplayName, |
| 761 | OrganizationIcon: r.OrganizationIcon, |
| 762 | OrganizationDescription: r.OrganizationDescription, |
| 763 | TemplateName: r.TemplateName, |
| 764 | TemplateDisplayName: r.TemplateDisplayName, |
| 765 | TemplateIcon: r.TemplateIcon, |
| 766 | TemplateDescription: r.TemplateDescription, |
| 767 | NextStartAt: r.NextStartAt, |
| 768 | TaskID: r.TaskID, |
| 769 | } |
| 770 | |
| 771 | var err error |
| 772 | |
| 773 | err = workspaces[i].UserACL.Scan(r.UserACL) |
| 774 | if err != nil { |
| 775 | return nil, xerrors.Errorf("scan user ACL %q: %w", r.UserACL, err) |
| 776 | } |
| 777 | err = workspaces[i].GroupACL.Scan(r.GroupACL) |
| 778 | if err != nil { |
| 779 | return nil, xerrors.Errorf("scan group ACL %q: %w", r.GroupACL, err) |
| 780 | } |
| 781 | |
| 782 | err = workspaces[i].UserACLDisplayInfo.Scan(r.UserACLDisplayInfo) |
| 783 | if err != nil { |
| 784 | return nil, xerrors.Errorf("scan user ACL display info %q: %w", |
| 785 | r.UserACLDisplayInfo, err) |
| 786 | } |
| 787 | err = workspaces[i].GroupACLDisplayInfo.Scan(r.GroupACLDisplayInfo) |
| 788 | if err != nil { |
| 789 | return nil, xerrors.Errorf("scan group ACL display info %q: %w", |
| 790 | r.GroupACLDisplayInfo, err) |
| 791 | } |
| 792 | } |
| 793 | |
| 794 | return workspaces, nil |
no test coverage detected