(ctx context.Context, params *riverdriver.JobUpdateFullParams)
| 922 | } |
| 923 | |
| 924 | func (e *Executor) JobUpdateFull(ctx context.Context, params *riverdriver.JobUpdateFullParams) (*rivertype.JobRow, error) { |
| 925 | attemptedAt := params.AttemptedAt |
| 926 | if attemptedAt != nil { |
| 927 | attemptedAt = ptrutil.Ptr(attemptedAt.UTC()) |
| 928 | } |
| 929 | |
| 930 | attemptedBy, err := json.Marshal(params.AttemptedBy) |
| 931 | if err != nil { |
| 932 | return nil, err |
| 933 | } |
| 934 | |
| 935 | errors, err := json.Marshal(sliceutil.Map(params.Errors, func(e []byte) json.RawMessage { return json.RawMessage(e) })) |
| 936 | if err != nil { |
| 937 | return nil, err |
| 938 | } |
| 939 | |
| 940 | finalizedAt := params.FinalizedAt |
| 941 | if finalizedAt != nil { |
| 942 | finalizedAt = ptrutil.Ptr(finalizedAt.UTC()) |
| 943 | } |
| 944 | |
| 945 | metadata := params.Metadata |
| 946 | if metadata == nil { |
| 947 | metadata = []byte("{}") |
| 948 | } |
| 949 | |
| 950 | job, err := dbsqlc.New().JobUpdateFull(schemaTemplateParam(ctx, params.Schema), e.dbtx, &dbsqlc.JobUpdateFullParams{ |
| 951 | ID: params.ID, |
| 952 | Attempt: int64(params.Attempt), |
| 953 | AttemptDoUpdate: params.AttemptDoUpdate, |
| 954 | AttemptedAt: attemptedAt, |
| 955 | AttemptedAtDoUpdate: params.AttemptedAtDoUpdate, |
| 956 | AttemptedBy: attemptedBy, |
| 957 | AttemptedByDoUpdate: params.AttemptedByDoUpdate, |
| 958 | ErrorsDoUpdate: params.ErrorsDoUpdate, |
| 959 | Errors: errors, |
| 960 | FinalizedAtDoUpdate: params.FinalizedAtDoUpdate, |
| 961 | FinalizedAt: finalizedAt, |
| 962 | MaxAttemptsDoUpdate: params.MaxAttemptsDoUpdate, |
| 963 | MaxAttempts: int64(min(params.MaxAttempts, math.MaxInt64)), |
| 964 | MetadataDoUpdate: params.MetadataDoUpdate, |
| 965 | Metadata: metadata, |
| 966 | StateDoUpdate: params.StateDoUpdate, |
| 967 | State: string(params.State), |
| 968 | }) |
| 969 | if err != nil { |
| 970 | return nil, interpretError(err) |
| 971 | } |
| 972 | |
| 973 | return jobRowFromInternal(job) |
| 974 | } |
| 975 | |
| 976 | func (e *Executor) LeaderAttemptElect(ctx context.Context, params *riverdriver.LeaderElectParams) (*riverdriver.Leader, error) { |
| 977 | leader, err := dbsqlc.New().LeaderAttemptElect(schemaTemplateParam(ctx, params.Schema), e.dbtx, &dbsqlc.LeaderAttemptElectParams{ |
nothing calls this directly
no test coverage detected