(ctx context.Context, cache dagql.PersistedObjectCache)
| 358 | } |
| 359 | |
| 360 | func (ref *GitRef) EncodePersistedObject(ctx context.Context, cache dagql.PersistedObjectCache) (dagql.PersistedObjectEncoding, error) { |
| 361 | _ = ctx |
| 362 | if ref == nil { |
| 363 | return dagql.PersistedObjectEncoding{}, fmt.Errorf("encode persisted git ref: nil ref") |
| 364 | } |
| 365 | if ref.Ref == nil { |
| 366 | return dagql.PersistedObjectEncoding{}, fmt.Errorf("encode persisted git ref: missing ref") |
| 367 | } |
| 368 | repoID, err := encodePersistedObjectRef(cache, ref.Repo, "git ref repo") |
| 369 | if err != nil { |
| 370 | return dagql.PersistedObjectEncoding{}, err |
| 371 | } |
| 372 | payloadJSON, err := json.Marshal(persistedGitRefPayload{ |
| 373 | RepoResultID: repoID, |
| 374 | Name: ref.Ref.Name, |
| 375 | SHA: ref.Ref.SHA, |
| 376 | }) |
| 377 | if err != nil { |
| 378 | return dagql.PersistedObjectEncoding{}, fmt.Errorf("marshal persisted git ref payload: %w", err) |
| 379 | } |
| 380 | return encodePersistedObjectRawJSON(payloadJSON), nil |
| 381 | } |
| 382 | |
| 383 | func (*GitRef) DecodePersistedObject(ctx context.Context, dag *dagql.Server, _ uint64, _ *dagql.ResultCall, payload json.RawMessage) (dagql.Typed, error) { |
| 384 | var persisted persistedGitRefPayload |
nothing calls this directly
no test coverage detected