Skip to content

Instantly share code, notes, and snippets.

@maxtaco
Last active May 25, 2017 03:45
Show Gist options
  • Save maxtaco/d49d422785e5eb9d1473a77effb3ef24 to your computer and use it in GitHub Desktop.
Save maxtaco/d49d422785e5eb9d1473a77effb3ef24 to your computer and use it in GitHub Desktop.
A blurpy demo
record Cat {
map<Blurp,Noozle> bird;
map<Noozle> bee;
map<Blurp,array<Noozle>> birds;
map<Blurp,int> pickles;
map<string,int> penny;
map<int,string> pa;
array<map<Blurp,array<Noozle>>> wow;
}
type Cat struct {
Bird map[Blurp]Noozle `codec:"bird" json:"bird"`
Bee map[string]Noozle `codec:"bee" json:"bee"`
Birds map[Blurp][]Noozle `codec:"birds" json:"birds"`
Pickles map[Blurp]int `codec:"pickles" json:"pickles"`
Penny map[string]int `codec:"penny" json:"penny"`
Pa map[int]string `codec:"pa" json:"pa"`
Wow []map[Blurp][]Noozle `codec:"wow" json:"wow"`
}
func (o Cat) DeepCopy() Cat {
return Cat{
Bird : (func (x map[Blurp]Noozle) map[Blurp]Noozle {
ret := make(map[Blurp]Noozle)
for k,v := range x {
k = k.DeepCopy()
v = v.DeepCopy()
ret[k] = v
}
return ret
})(o.Bird),
Bee : (func (x map[string]Noozle) map[string]Noozle {
ret := make(map[string]Noozle)
for k,v := range x {
v = v.DeepCopy()
ret[k] = v
}
return ret
})(o.Bee),
Birds : (func (x map[Blurp][]Noozle) map[Blurp][]Noozle {
ret := make(map[Blurp][]Noozle)
for k,v := range x {
k = k.DeepCopy()
v = (func (x []Noozle) []Noozle {
var ret []Noozle
for _, v := range x {
v = v.DeepCopy()
ret = append(ret, v)
}
return ret
})(v)
ret[k] = v
}
return ret
})(o.Birds),
Pickles : (func (x map[Blurp]int) map[Blurp]int {
ret := make(map[Blurp]int)
for k,v := range x {
k = k.DeepCopy()
v = v
ret[k] = v
}
return ret
})(o.Pickles),
Penny : (func (x map[string]int) map[string]int {
ret := make(map[string]int)
for k,v := range x {
k = k
v = v
ret[k] = v
}
return ret
})(o.Penny),
Pa : (func (x map[int]string) map[int]string {
ret := make(map[int]string)
for k,v := range x {
k = k
v = v
ret[k] = v
}
return ret
})(o.Pa),
Wow : (func (x []map[Blurp][]Noozle) []map[Blurp][]Noozle {
var ret []map[Blurp][]Noozle
for _, v := range x {
v = (func (x map[Blurp][]Noozle) map[Blurp][]Noozle {
ret := make(map[Blurp][]Noozle)
for k,v := range x {
k = k.DeepCopy()
v = (func (x []Noozle) []Noozle {
var ret []Noozle
for _, v := range x {
v = v.DeepCopy()
ret = append(ret, v)
}
return ret
})(v)
ret[k] = v
}
return ret
})(v)
ret = append(ret, v)
}
return ret
})(o.Wow),
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment