( ctx context.Context, parent AnyResult, nth int, nullAsError bool, )
| 1217 | } |
| 1218 | |
| 1219 | func (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 | |
| 1253 | func (s *Server) LoadType(ctx context.Context, id *call.ID) (_ AnyResult, rerr error) { |
| 1254 | ctx = srvToContext(ctx, s) |
no test coverage detected