func (d *Datastore) ListTeams(ctx context.Context, filter fleet.TeamFilter, opt fleet.ListOptions) ([]*fleet.Team, error) {
	query := fmt.Sprintf(`
			SELECT *,
				(SELECT count(*) FROM user_teams WHERE team_id = t.id) AS user_count,
				(SELECT count(*) FROM hosts WHERE team_id = t.id) AS host_count
			FROM teams t
			WHERE %s
		`,
		d.whereFilterTeams(filter, "t"),
	)
	query, params := searchLike(query, nil, opt.MatchQuery, teamSearchColumns...)
	query = appendListOptionsToSQL(query, opt)
	teams := []*fleet.Team{}
	if err := sqlx.SelectContext(ctx, d.reader, &teams, query, params...); err != nil {
		return nil, ctxerr.Wrap(ctx, err, "list teams")
	}
	if err := loadSecretsForTeamsDB(ctx, d.reader, teams); err != nil {
		return nil, ctxerr.Wrap(ctx, err, "getting secrets for teams")
	}
	return teams, nil
}
// ListTeams lists all teams with limit, sort and offset passed in with
// fleet.ListOptions
ListTeams lists all teams with limit, sort and offset passed in with
fleet.ListOptions
// ListTeams lists all teams with limit sort and offset passed in with // fleet . ListOptions
func (d *Datastore) ListTeams(ctx context.Context, filter fleet.TeamFilter, opt fleet.ListOptions) ([]*fleet.Team, error) {
	query := fmt.Sprintf(`
			SELECT *,
				(SELECT count(*) FROM user_teams WHERE team_id = t.id) AS user_count,
				(SELECT count(*) FROM hosts WHERE team_id = t.id) AS host_count
			FROM teams t
			WHERE %s
		`,
		d.whereFilterTeams(filter, "t"),
	)
	query, params := searchLike(query, nil, opt.MatchQuery, teamSearchColumns...)
	query = appendListOptionsToSQL(query, opt)
	teams := []*fleet.Team{}
	if err := sqlx.SelectContext(ctx, d.reader, &teams, query, params...); err != nil {
		return nil, ctxerr.Wrap(ctx, err, "list teams")
	}
	if err := loadSecretsForTeamsDB(ctx, d.reader, teams); err != nil {
		return nil, ctxerr.Wrap(ctx, err, "getting secrets for teams")
	}
	return teams, nil
}
func ( d * Datastore ) ListTeams ( ctx context . Context , filter fleet . TeamFilter , opt fleet . ListOptions ) ( [ ] * fleet . Team , error ) { query := fmt . Sprintf ( `
			SELECT *,
				(SELECT count(*) FROM user_teams WHERE team_id = t.id) AS user_count,
				(SELECT count(*) FROM hosts WHERE team_id = t.id) AS host_count
			FROM teams t
			WHERE %s
		` , d . whereFilterTeams ( filter , " " ) , ) query , params := searchLike ( query , nil , opt . MatchQuery , teamSearchColumns ... ) query = appendListOptionsToSQL ( query , opt ) teams := [ ] * fleet . Team { } if err := sqlx . SelectContext ( ctx , d . reader , & teams , query , params ... ) ; err != nil { return nil , ctxerr . Wrap ( ctx , err , " " ) } if err := loadSecretsForTeamsDB ( ctx , d . reader , teams ) ; err != nil { return nil , ctxerr . Wrap ( ctx , err , " " ) } return teams , nil }
ListTeams lists all teams with limit, sort and offset passed in with
fleet.ListOptions
ListTeams lists all teams with limit sort and offset passed in with fleet . ListOptions