code: func (r *GormWorkItemLinkRepository) WorkItemHasChildren(ctx context.Context, parentID uuid.UUID) (bool, error) {
  	defer goa.MeasureSince([]string{"goa", "db", "workitemlink", "has", "children"}, time.Now())
  	query := fmt.Sprintf(`
  		SELECT EXISTS (
  			SELECT 1 FROM %[1]s WHERE id in (
  				SELECT target_id FROM %[2]s
  				WHERE source_id = $1 AND deleted_at IS NULL AND link_type_id = $2
  			)
  		)`,
  		workitem.WorkItemStorage{}.TableName(),
  		WorkItemLink{}.TableName())
  	var hasChildren bool
  	db := r.db.CommonDB()
  	stmt, err := db.Prepare(query)
  	if err != nil {
  		return false, errs.Wrapf(err, "failed prepare statement: %s", query)
  	}
  	defer closeable.Close(ctx, stmt)
  	err = stmt.QueryRow(parentID.String(), SystemWorkItemLinkTypeParentChildID.String()).Scan(&hasChildren)
  	if err != nil {
  		return false, errs.Wrapf(err, "failed to check if work item %s has children: %s", parentID.String(), query)
  	}
  	return hasChildren, nil
  }
docs: // WorkItemHasChildren returns true if the given parent work item has children;
  // otherwise false is returned