Ejemplo n.º 1
0
func (self *Backend) getBlobRefCollectionSelectors() map[*mongo.Collection][]string {
	return nil

	if self.imageRefCollectionSelectors == nil {
		colSel := make(map[*mongo.Collection][]string)
		for _, collection := range mongo.Collections {
			var doc BlobDoc // todo needs to be document type of collection
			collection.InitDocument(&doc)
			model.SetAllSliceLengths(&doc, 1)
			model.Visit(&doc, model.FieldOnlyVisitor(
				func(data *model.MetaData) error {
					if _, ok := data.Value.Addr().Interface().(*media.BlobRef); ok {
						if _, ok := colSel[collection]; !ok {
							colSel[collection] = nil
						}
						colSel[collection] = append(colSel[collection], data.WildcardSelector())
					}
					return nil
				},
			))
		}
		self.blobRefCollectionSelectors = colSel
	}
	return self.blobRefCollectionSelectors
}
Ejemplo n.º 2
0
func (self *Backend) getImageRefCollectionSelectors() map[*mongo.Collection][]string {
	if self.imageRefCollectionSelectors == nil {
		colSel := make(map[*mongo.Collection][]string)
		for _, collection := range mongo.Collections {
			doc := collection.NewDocument()
			model.SetAllSliceLengths(doc, 1)
			model.Visit(doc, model.FieldOnlyVisitor(
				func(data *model.MetaData) error {
					if _, ok := data.Value.Addr().Interface().(*media.ImageRef); ok {
						if _, ok := colSel[collection]; !ok {
							colSel[collection] = nil
						}
						colSel[collection] = append(colSel[collection], data.WildcardSelector())
					}
					return nil
				},
			))
		}
		self.imageRefCollectionSelectors = colSel
	}
	return self.imageRefCollectionSelectors
}