File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -259,3 +259,25 @@ func (s *Schema) Resolve(tr TypeRef) (Atom, bool) {
259
259
}
260
260
return tr .Inlined , true
261
261
}
262
+
263
+ // Clones this instance of Schema into the other
264
+ // If other is nil this method does nothing.
265
+ // If other is already initialized, overwrites it with this instance
266
+ // Warning: Not thread safe
267
+ func (s Schema ) CopyInto (dst * Schema ) {
268
+ if dst == nil {
269
+ return
270
+ }
271
+
272
+ // Schema type is considered immutable so sharing references
273
+ dst .Types = s .Types
274
+
275
+ if s .m != nil {
276
+ // If cache is non-nil then the once token had been consumed.
277
+ // Must reset token and use it again to ensure same semantics.
278
+ dst .once = sync.Once {}
279
+ dst .once .Do (func () {
280
+ dst .m = s .m
281
+ })
282
+ }
283
+ }
You can’t perform that action at this time.
0 commit comments