// GetTabsByUserID fetches all tabs that the given user has access to.
GetTabsByUserID fetches all tabs that the given user has access to.
// GetTabsByUserID fetches all tabs that the given user has access to .
func GetTabsByUserID(userID int) ([]Tab, error) {
	rows, err := DB.Query("SELECT tabs.id, tabs.slug, tabs.icon, tabs.label, tabs.target FROM tabs INNER JOIN tab_permissions ON tab_permissions.tabId = tabs.id WHERE tab_permissions.userId = ?", userID)
	if err != nil {
		return nil, err
	}
	defer rows.Close()
	tabs := []Tab{}
	for rows.Next() {
		tab := Tab{}
		err := rows.Scan(&tab.ID, &tab.Slug, &tab.Icon, &tab.Label, &tab.Target)
		if err != nil {
			return nil, err
		}
		tabs = append(tabs, tab)
	}
	return tabs, nil
}
func GetTabsByUserID ( userID int ) ( [ ] Tab , error ) { rows , err := DB . Query ( " " , userID ) if err != nil { return nil , err } defer rows . Close ( ) tabs := [ ] Tab { } for rows . Next ( ) { tab := Tab { } err := rows . Scan ( & tab . ID , & tab . Slug , & tab . Icon , & tab . Label , & tab . Target ) if err != nil { return nil , err } tabs = append ( tabs , tab ) } return tabs , nil }
GetTabsByUserID fetches all tabs that the given user has access to.
GetTabsByUserID fetches all tabs that the given user has access to .