code: func listSwitches(c context.Context, names, racks, datacenters stringset.Set) ([]*crimson.Switch, error) {
  	db := database.Get(c)
  	rows, err := db.QueryContext(c, `
  		SELECT s.name, s.description, s.ports, s.state, r.name, d.name
  		FROM switches s, racks r, datacenters d
  		WHERE s.rack_id = r.id
  			AND r.datacenter_id = d.id
  	`)
  	if err != nil {
  		return nil, errors.Annotate(err, "failed to fetch switches").Err()
  	}
  	defer rows.Close()
  
  	var switches []*crimson.Switch
  	for rows.Next() {
  		s := &crimson.Switch{}
  		if err = rows.Scan(&s.Name, &s.Description, &s.Ports, &s.State, &s.Rack, &s.Datacenter); err != nil {
  			return nil, errors.Annotate(err, "failed to fetch switch").Err()
  		}
  		if matches(s.Name, names) && matches(s.Rack, racks) && matches(s.Datacenter, datacenters) {
  			switches = append(switches, s)
  		}
  	}
  	return switches, nil
  }
docs: // listSwitches returns a slice of switches in the database.