MCPcopy Create free account
hub / github.com/dagger/dagger / resultCallFromRecipeIDInput

Function resultCallFromRecipeIDInput

dagql/call_request_input.go:106–162  ·  view source on GitHub ↗
(ctx context.Context, id *call.ID)

Source from the content-addressed store, hash-verified

104}
105
106func resultCallFromRecipeIDInput(ctx context.Context, id *call.ID) (*ResultCall, error) {
107 if id == nil {
108 return nil, nil
109 }
110 if id.IsHandle() {
111 return nil, fmt.Errorf("handle-form IDs cannot be converted to inline recipe calls: %s", idInputDebugString(id))
112 }
113
114 var callType *ResultCallType
115 if id.Type() != nil {
116 callType = NewResultCallType(id.Type().ToAST())
117 }
118 frame := &ResultCall{
119 Kind: ResultCallKindField,
120 Type: callType,
121 Field: id.Field(),
122 View: id.View(),
123 Nth: id.Nth(),
124 EffectIDs: id.EffectIDs(),
125 ExtraDigests: id.ExtraDigests(),
126 }
127
128 if receiver := id.Receiver(); receiver != nil {
129 receiverRef, err := resultCallRefFromIDInput(ctx, receiver)
130 if err != nil {
131 return nil, fmt.Errorf("receiver: %w", err)
132 }
133 frame.Receiver = receiverRef
134 }
135 if mod := id.Module(); mod != nil {
136 modRef, err := resultCallRefFromIDInput(ctx, mod.ID())
137 if err != nil {
138 return nil, fmt.Errorf("module: %w", err)
139 }
140 frame.Module = &ResultCallModule{
141 ResultRef: modRef,
142 Name: mod.Name(),
143 Ref: mod.Ref(),
144 Pin: mod.Pin(),
145 }
146 }
147 for _, arg := range id.Args() {
148 converted, err := resultCallArgFromRecipeArgument(ctx, arg)
149 if err != nil {
150 return nil, fmt.Errorf("arg %q: %w", arg.Name(), err)
151 }
152 frame.Args = append(frame.Args, converted)
153 }
154 for _, input := range id.ImplicitInputs() {
155 converted, err := resultCallArgFromRecipeArgument(ctx, input)
156 if err != nil {
157 return nil, fmt.Errorf("implicit input %q: %w", input.Name(), err)
158 }
159 frame.ImplicitInputs = append(frame.ImplicitInputs, converted)
160 }
161 return frame, nil
162}
163

Callers 1

resultCallRefFromIDInputFunction · 0.85

Calls 15

idInputDebugStringFunction · 0.85
NewResultCallTypeFunction · 0.85
resultCallRefFromIDInputFunction · 0.85
IsHandleMethod · 0.80
EffectIDsMethod · 0.80
ExtraDigestsMethod · 0.80
ImplicitInputsMethod · 0.80
TypeMethod · 0.65
ToASTMethod · 0.65
ViewMethod · 0.65
NthMethod · 0.65

Tested by

no test coverage detected