• entities.Step とほぼ同じ、違いはslicesにして返す点のみ sqinstmtcheck // StepCollect breaks ids into chunks of size limitOpt (or default 1000), // and collects the results of the process function into a slice. // idsを分割して 1000件(デフォルト )ずつ取得した結果をスライスに収集 . func StepCollect[ID, Out any](ids []ID, process func([]ID) ([]Out, error), limitOpt ...int) ([]Out, error) { limit := 1000 if len(limitOpt) == 1 { if n := limitOpt[0]; n > 0 { limit = n } } list := make([]Out, 0, len(ids)) for chunk := range slices.Chunk(ids, limit) { res, err := process(chunk) if err != nil { return nil, err } list = append(list, res...) } return slices.Clip(list), nil