github.com/ipld/go-ipld-prime@v0.21.0/datamodel.go (about) 1 package ipld 2 3 import ( 4 "github.com/ipld/go-ipld-prime/datamodel" 5 "github.com/ipld/go-ipld-prime/linking" 6 "github.com/ipld/go-ipld-prime/schema" 7 ) 8 9 type ( 10 Kind = datamodel.Kind 11 Node = datamodel.Node 12 NodeAssembler = datamodel.NodeAssembler 13 NodeBuilder = datamodel.NodeBuilder 14 NodePrototype = datamodel.NodePrototype 15 MapIterator = datamodel.MapIterator 16 MapAssembler = datamodel.MapAssembler 17 ListIterator = datamodel.ListIterator 18 ListAssembler = datamodel.ListAssembler 19 20 Link = datamodel.Link 21 LinkPrototype = datamodel.LinkPrototype 22 23 Path = datamodel.Path 24 PathSegment = datamodel.PathSegment 25 ) 26 27 var ( 28 Null = datamodel.Null 29 Absent = datamodel.Absent 30 ) 31 32 const ( 33 Kind_Invalid = datamodel.Kind_Invalid 34 Kind_Map = datamodel.Kind_Map 35 Kind_List = datamodel.Kind_List 36 Kind_Null = datamodel.Kind_Null 37 Kind_Bool = datamodel.Kind_Bool 38 Kind_Int = datamodel.Kind_Int 39 Kind_Float = datamodel.Kind_Float 40 Kind_String = datamodel.Kind_String 41 Kind_Bytes = datamodel.Kind_Bytes 42 Kind_Link = datamodel.Kind_Link 43 ) 44 45 // Future: These aliases for the `KindSet_*` values may be dropped someday. 46 // I don't think they're very important to have cluttering up namespace here. 47 // They're included for a brief transitional period, largely for the sake of codegen things which have referred to them, but may disappear in the future. 48 var ( 49 KindSet_Recursive = datamodel.KindSet_Recursive 50 KindSet_Scalar = datamodel.KindSet_Scalar 51 KindSet_JustMap = datamodel.KindSet_JustMap 52 KindSet_JustList = datamodel.KindSet_JustList 53 KindSet_JustNull = datamodel.KindSet_JustNull 54 KindSet_JustBool = datamodel.KindSet_JustBool 55 KindSet_JustInt = datamodel.KindSet_JustInt 56 KindSet_JustFloat = datamodel.KindSet_JustFloat 57 KindSet_JustString = datamodel.KindSet_JustString 58 KindSet_JustBytes = datamodel.KindSet_JustBytes 59 KindSet_JustLink = datamodel.KindSet_JustLink 60 ) 61 62 // Future: These error type aliases may be dropped someday. 63 // Being able to see them as having more than one package name is not helpful to clarity. 64 // They are left here for now for a brief transitional period, because it was relatively easy to do so. 65 type ( 66 ErrWrongKind = datamodel.ErrWrongKind 67 ErrNotExists = datamodel.ErrNotExists 68 ErrRepeatedMapKey = datamodel.ErrRepeatedMapKey 69 ErrInvalidSegmentForList = datamodel.ErrInvalidSegmentForList 70 ErrIteratorOverread = datamodel.ErrIteratorOverread 71 ErrInvalidKey = schema.ErrInvalidKey 72 ErrMissingRequiredField = schema.ErrMissingRequiredField 73 ErrHashMismatch = linking.ErrHashMismatch 74 ) 75 76 // Future: a bunch of these alias methods for path creation may be dropped someday. 77 // They don't hurt anything, but I don't think they add much clarity either, vs the amount of namespace noise they create; 78 // many of the high level convenience functions we add here in the root package will probably refer to datamodel.Path, and that should be sufficient to create clarity for new users for where to look for more on pathing. 79 // They are here for now for a transitional period, but may eventually be revisited and perhaps removed. 80 81 // NewPath is an alias for datamodel.NewPath. 82 // 83 // Pathing is a concept defined in the data model layer of IPLD. 84 func NewPath(segments []PathSegment) Path { 85 return datamodel.NewPath(segments) 86 } 87 88 // ParsePath is an alias for datamodel.ParsePath. 89 // 90 // Pathing is a concept defined in the data model layer of IPLD. 91 func ParsePath(pth string) Path { 92 return datamodel.ParsePath(pth) 93 } 94 95 // ParsePathSegment is an alias for datamodel.ParsePathSegment. 96 // 97 // Pathing is a concept defined in the data model layer of IPLD. 98 func ParsePathSegment(s string) PathSegment { 99 return datamodel.ParsePathSegment(s) 100 } 101 102 // PathSegmentOfString is an alias for datamodel.PathSegmentOfString. 103 // 104 // Pathing is a concept defined in the data model layer of IPLD. 105 func PathSegmentOfString(s string) PathSegment { 106 return datamodel.PathSegmentOfString(s) 107 } 108 109 // PathSegmentOfInt is an alias for datamodel.PathSegmentOfInt. 110 // 111 // Pathing is a concept defined in the data model layer of IPLD. 112 func PathSegmentOfInt(i int64) PathSegment { 113 return datamodel.PathSegmentOfInt(i) 114 }