Esempio n. 1
0
func readSongsFromDataset(ds *dataset.Dataset) ListOfSong {
	songs := NewListOfSong()
	if commit, ok := ds.MaybeHead(); ok {
		songs = commit.Value().(ListOfSong)
	}
	return songs
}
Esempio n. 2
0
func buildSetOfRefOfPackage(pkg pkg.Parsed, deps depsMap, ds dataset.Dataset) types.SetOfRefOfPackage {
	// Can do better once generated collections implement types.Value.
	s := types.NewSetOfRefOfPackage()
	if h, ok := ds.MaybeHead(); ok {
		s = h.Value().(types.SetOfRefOfPackage)
	}
	for _, dep := range deps {
		// Writing the deps into ds should be redundant at this point, but do it to be sure.
		// TODO: consider moving all dataset work over into nomdl/pkg BUG 409
		s = s.Insert(ds.Store().WriteValue(dep).(types.RefOfPackage))
	}
	r := ds.Store().WriteValue(pkg.Package).(types.RefOfPackage)
	return s.Insert(r)
}