func (r *GormWorkItemLinkRepository) ListWorkItemChildren(ctx context.Context, parent string) ([]workitem.WorkItem, error) {
	defer goa.MeasureSince([]string{"goa", "db", "workitem", "children", "query"}, time.Now())

	where := fmt.Sprintf(`
	id in (
		SELECT target_id FROM %s
		WHERE source_id = ? AND link_type_id IN (
			SELECT id FROM %s WHERE forward_name = 'parent of'
		)
	)`, WorkItemLink{}.TableName(), WorkItemLinkType{}.TableName())
	db := r.db.Model(&workitem.WorkItemStorage{}).Where(where, parent)
	rows, err := db.Rows()
	if err != nil {
		return nil, err
	}
	defer rows.Close()
	result := []workitem.WorkItemStorage{}

	for rows.Next() {
		value := workitem.WorkItemStorage{}
		db.ScanRows(rows, &value)

		result = append(result, value)
	}
	res := make([]workitem.WorkItem, len(result))
	for index, value := range result {
		wiType, err := r.workItemTypeRepo.LoadTypeFromDB(ctx, value.Type)
		if err != nil {
			return nil, errors.NewInternalError(err.Error())
		}
		modelWI, err := workitem.ConvertWorkItemStorageToModel(wiType, &value)
		if err != nil {
			return nil, errors.NewInternalError(err.Error())
		}
		res[index] = *modelWI
	}

	return res, nil
}
// ListWorkItemChildren get all child work items
ListWorkItemChildren get all child work items
// ListWorkItemChildren get all child work items
func (r *GormWorkItemLinkRepository) ListWorkItemChildren(ctx context.Context, parent string) ([]workitem.WorkItem, error) {
	defer goa.MeasureSince([]string{"goa", "db", "workitem", "children", "query"}, time.Now())
	where := fmt.Sprintf(`
	id in (
		SELECT target_id FROM %s
		WHERE source_id = ? AND link_type_id IN (
			SELECT id FROM %s WHERE forward_name = 'parent of'
		)
	)`, WorkItemLink{}.TableName(), WorkItemLinkType{}.TableName())
	db := r.db.Model(&workitem.WorkItemStorage{}).Where(where, parent)
	rows, err := db.Rows()
	if err != nil {
		return nil, err
	}
	defer rows.Close()
	result := []workitem.WorkItemStorage{}
	for rows.Next() {
		value := workitem.WorkItemStorage{}
		db.ScanRows(rows, &value)
		result = append(result, value)
	}
	res := make([]workitem.WorkItem, len(result))
	for index, value := range result {
		wiType, err := r.workItemTypeRepo.LoadTypeFromDB(ctx, value.Type)
		if err != nil {
			return nil, errors.NewInternalError(err.Error())
		}
		modelWI, err := workitem.ConvertWorkItemStorageToModel(wiType, &value)
		if err != nil {
			return nil, errors.NewInternalError(err.Error())
		}
		res[index] = *modelWI
	}
	return res, nil
}
func ( r * GormWorkItemLinkRepository ) ListWorkItemChildren ( ctx context . Context , parent string ) ( [ ] workitem . WorkItem , error ) { defer goa . MeasureSince ( [ ] string { " " , " " , " " , " " , " " } , time . Now ( ) ) where := fmt . Sprintf ( `
	id in (
		SELECT target_id FROM %s
		WHERE source_id = ? AND link_type_id IN (
			SELECT id FROM %s WHERE forward_name = 'parent of'
		)
	)` , WorkItemLink { } . TableName ( ) , WorkItemLinkType { } . TableName ( ) ) db := r . db . Model ( & workitem . WorkItemStorage { } ) . Where ( where , parent ) rows , err := db . Rows ( ) if err != nil { return nil , err } defer rows . Close ( ) result := [ ] workitem . WorkItemStorage { } for rows . Next ( ) { value := workitem . WorkItemStorage { } db . ScanRows ( rows , & value ) result = append ( result , value ) } res := make ( [ ] workitem . WorkItem , len ( result ) ) for index , value := range result { wiType , err := r . workItemTypeRepo . LoadTypeFromDB ( ctx , value . Type ) if err != nil { return nil , errors . NewInternalError ( err . Error ( ) ) } modelWI , err := workitem . ConvertWorkItemStorageToModel ( wiType , & value ) if err != nil { return nil , errors . NewInternalError ( err . Error ( ) ) } res [ index ] = * modelWI } return res , nil }
ListWorkItemChildren get all child work items
ListWorkItemChildren get all child work items