code: func FindTasks(tx ReadTx, by By) ([]*api.Task, error) {
  	checkType := func(by By) error {
  		switch by.(type) {
  		case byName, byNamePrefix, byIDPrefix, byRuntime, byDesiredState, byTaskState, byNode, byService, bySlot, byReferencedNetworkID, byReferencedSecretID, byReferencedConfigID, byCustom, byCustomPrefix:
  			return nil
  		default:
  			return ErrInvalidFindBy
  		}
  	}
  
  	taskList := []*api.Task{}
  	appendResult := func(o api.StoreObject) {
  		taskList = append(taskList, o.(*api.Task))
  	}
  
  	err := tx.find(tableTask, by, checkType, appendResult)
  	return taskList, err
  }
docs: // FindTasks selects a set of tasks and returns them.