func (j JobRun) WorkflowNodeRunJob() (sdk.WorkflowNodeJobRun, error) {
	jr := sdk.WorkflowNodeJobRun{
		ProjectID:         j.ProjectID,
		ID:                j.ID,
		WorkflowNodeRunID: j.WorkflowNodeRunID,
		Status:            j.Status,
		Retry:             j.Retry,
		Queued:            j.Queued,
		QueuedSeconds:     time.Now().Unix() - j.Queued.Unix(),
		Start:             j.Start,
		Done:              j.Done,
		BookedBy:          j.BookedBy,
		ContainsService:   j.ContainsService,
		HatcheryName:      j.HatcheryName,
		WorkerName:        j.WorkerName,
		Model:             j.Model,
	}
	if err := gorpmapping.JSONNullString(j.Job, &jr.Job); err != nil {
		return jr, sdk.WrapError(err, "column job")
	}
	if err := gorpmapping.JSONNullString(j.Parameters, &jr.Parameters); err != nil {
		return jr, sdk.WrapError(err, "column variables")
	}
	if err := gorpmapping.JSONNullString(j.ExecGroups, &jr.ExecGroups); err != nil {
		return jr, sdk.WrapError(err, "column exec_groups")
	}
	if err := gorpmapping.JSONNullString(j.IntegrationPluginBinaries, &jr.IntegrationPluginBinaries); err != nil {
		return jr, sdk.WrapError(err, "integration_plugin_binaries")
	}
	if err := gorpmapping.JSONNullString(j.Header, &jr.Header); err != nil {
		return jr, sdk.WrapError(err, "header")
	}
	if j.ModelType.Valid {
		jr.ModelType = j.ModelType.String
	}
	if defaultOS != "" && defaultArch != "" {
		var modelFound, osArchFound bool
		for _, req := range jr.Job.Action.Requirements {
			if req.Type == sdk.ModelRequirement {
				modelFound = true
			}
			if req.Type == sdk.OSArchRequirement {
				osArchFound = true
			}
		}

		if !modelFound && !osArchFound {
			jr.Job.Action.Requirements = append(jr.Job.Action.Requirements, sdk.Requirement{
				Name:  defaultOS + "/" + defaultArch,
				Type:  sdk.OSArchRequirement,
				Value: defaultOS + "/" + defaultArch,
			})
		}
	}
	return jr, nil
}
// WorkflowNodeRunJob returns a sdk.WorkflowNodeRunJob
WorkflowNodeRunJob returns a sdk.WorkflowNodeRunJob
// WorkflowNodeRunJob returns a sdk . WorkflowNodeRunJob
func (j JobRun) WorkflowNodeRunJob() (sdk.WorkflowNodeJobRun, error) {
	jr := sdk.WorkflowNodeJobRun{
		ProjectID:         j.ProjectID,
		ID:                j.ID,
		WorkflowNodeRunID: j.WorkflowNodeRunID,
		Status:            j.Status,
		Retry:             j.Retry,
		Queued:            j.Queued,
		QueuedSeconds:     time.Now().Unix() - j.Queued.Unix(),
		Start:             j.Start,
		Done:              j.Done,
		BookedBy:          j.BookedBy,
		ContainsService:   j.ContainsService,
		HatcheryName:      j.HatcheryName,
		WorkerName:        j.WorkerName,
		Model:             j.Model,
	}
	if err := gorpmapping.JSONNullString(j.Job, &jr.Job); err != nil {
		return jr, sdk.WrapError(err, "column job")
	}
	if err := gorpmapping.JSONNullString(j.Parameters, &jr.Parameters); err != nil {
		return jr, sdk.WrapError(err, "column variables")
	}
	if err := gorpmapping.JSONNullString(j.ExecGroups, &jr.ExecGroups); err != nil {
		return jr, sdk.WrapError(err, "column exec_groups")
	}
	if err := gorpmapping.JSONNullString(j.IntegrationPluginBinaries, &jr.IntegrationPluginBinaries); err != nil {
		return jr, sdk.WrapError(err, "integration_plugin_binaries")
	}
	if err := gorpmapping.JSONNullString(j.Header, &jr.Header); err != nil {
		return jr, sdk.WrapError(err, "header")
	}
	if j.ModelType.Valid {
		jr.ModelType = j.ModelType.String
	}
	if defaultOS != "" && defaultArch != "" {
		var modelFound, osArchFound bool
		for _, req := range jr.Job.Action.Requirements {
			if req.Type == sdk.ModelRequirement {
				modelFound = true
			}
			if req.Type == sdk.OSArchRequirement {
				osArchFound = true
			}
		}
		if !modelFound && !osArchFound {
			jr.Job.Action.Requirements = append(jr.Job.Action.Requirements, sdk.Requirement{
				Name:  defaultOS + "/" + defaultArch,
				Type:  sdk.OSArchRequirement,
				Value: defaultOS + "/" + defaultArch,
			})
		}
	}
	return jr, nil
}
func ( j JobRun ) WorkflowNodeRunJob ( ) ( sdk . WorkflowNodeJobRun , error ) { jr := sdk . WorkflowNodeJobRun { ProjectID : j . ProjectID , ID : j . ID , WorkflowNodeRunID : j . WorkflowNodeRunID , Status : j . Status , Retry : j . Retry , Queued : j . Queued , QueuedSeconds : time . Now ( ) . Unix ( ) - j . Queued . Unix ( ) , Start : j . Start , Done : j . Done , BookedBy : j . BookedBy , ContainsService : j . ContainsService , HatcheryName : j . HatcheryName , WorkerName : j . WorkerName , Model : j . Model , } if err := gorpmapping . JSONNullString ( j . Job , & jr . Job ) ; err != nil { return jr , sdk . WrapError ( err , " " ) } if err := gorpmapping . JSONNullString ( j . Parameters , & jr . Parameters ) ; err != nil { return jr , sdk . WrapError ( err , " " ) } if err := gorpmapping . JSONNullString ( j . ExecGroups , & jr . ExecGroups ) ; err != nil { return jr , sdk . WrapError ( err , " " ) } if err := gorpmapping . JSONNullString ( j . IntegrationPluginBinaries , & jr . IntegrationPluginBinaries ) ; err != nil { return jr , sdk . WrapError ( err , " " ) } if err := gorpmapping . JSONNullString ( j . Header , & jr . Header ) ; err != nil { return jr , sdk . WrapError ( err , " " ) } if j . ModelType . Valid { jr . ModelType = j . ModelType . String } if defaultOS != " " && defaultArch != " " { var modelFound , osArchFound bool for _ , req := range jr . Job . Action . Requirements { if req . Type == sdk . ModelRequirement { modelFound = true } if req . Type == sdk . OSArchRequirement { osArchFound = true } } if ! modelFound && ! osArchFound { jr . Job . Action . Requirements = append ( jr . Job . Action . Requirements , sdk . Requirement { Name : defaultOS + " " + defaultArch , Type : sdk . OSArchRequirement , Value : defaultOS + " " + defaultArch , } ) } } return jr , nil }
WorkflowNodeRunJob returns a sdk.WorkflowNodeRunJob
WorkflowNodeRunJob returns a sdk . WorkflowNodeRunJob