7 type collectionTypeImpl interface {
11 // IsCollectionType returns true if the given type supports the operations
12 // that are defined for all collection types.
13 func (t Type) IsCollectionType() bool {
14 _, ok := t.typeImpl.(collectionTypeImpl)
18 // ElementType returns the element type of the receiver if it is a collection
19 // type, or panics if it is not. Use IsCollectionType first to test whether
20 // this method will succeed.
21 func (t Type) ElementType() Type {
22 if ct, ok := t.typeImpl.(collectionTypeImpl); ok {
23 return ct.ElementType()
25 panic(errors.New("not a collection type"))
28 // ElementCallback is a callback type used for iterating over elements of
29 // collections and attributes of objects.
31 // The types of key and value depend on what type is being iterated over.
32 // Return true to stop iterating after the current element, or false to
33 // continue iterating.
34 type ElementCallback func(key Value, val Value) (stop bool)