MCPcopy Index your code
hub / github.com/dagger/dagger / loadNthValue

Method loadNthValue

dagql/server.go:1219–1251  ·  view source on GitHub ↗
(
	ctx context.Context,
	parent AnyResult,
	nth int,
	nullAsError bool,
)

Source from the content-addressed store, hash-verified

1217}
1218
1219func (s *Server) loadNthValue(
1220 ctx context.Context,
1221 parent AnyResult,
1222 nth int,
1223 nullAsError bool,
1224) (AnyResult, error) {
1225 if parent == nil {
1226 if nullAsError {
1227 return nil, fmt.Errorf("item %d is null from enumerable", nth)
1228 }
1229 return nil, nil
1230 }
1231
1232 res, err := parent.NthValue(ctx, nth)
1233 if err != nil {
1234 return nil, fmt.Errorf("nth %d: %w", nth, err)
1235 }
1236 if res == nil {
1237 if nullAsError {
1238 return nil, fmt.Errorf("item %d is null from enumerable", nth)
1239 }
1240 return nil, nil
1241 }
1242
1243 res, ok := res.DerefValue()
1244 if !ok || res == nil {
1245 if nullAsError {
1246 return nil, fmt.Errorf("item %d is null from enumerable", nth)
1247 }
1248 return nil, nil
1249 }
1250 return res, nil
1251}
1252
1253func (s *Server) LoadType(ctx context.Context, id *call.ID) (_ AnyResult, rerr error) {
1254 ctx = srvToContext(ctx, s)

Callers 3

SelectMethod · 0.95
resolvePathMethod · 0.95
loadRecipeVertexMethod · 0.80

Calls 2

NthValueMethod · 0.65
DerefValueMethod · 0.65

Tested by

no test coverage detected