Documentation ¶
Index ¶
- type MyMap
- func (m *MyMap) AsImmutable(v *MyMap) *MyMap
- func (m *MyMap) AsMutable() *MyMap
- func (m *MyMap) Del(k string) *MyMap
- func (m *MyMap) Get(k string) (*MySlice, bool)
- func (s *MyMap) IsDeeplyNonMutable(seen map[interface{}]bool) bool
- func (m *MyMap) Len() int
- func (m *MyMap) Mutable() bool
- func (m *MyMap) Range() map[string]*MySlice
- func (m *MyMap) Set(k string, v *MySlice) *MyMap
- func (mr *MyMap) WithImmutable(f func(m *MyMap)) *MyMap
- func (mr *MyMap) WithMutable(f func(m *MyMap)) *MyMap
- type MySlice
- func (m *MySlice) Append(v ...*MyMap) *MySlice
- func (m *MySlice) AsImmutable(v *MySlice) *MySlice
- func (m *MySlice) AsMutable() *MySlice
- func (m *MySlice) Get(i int) *MyMap
- func (s *MySlice) IsDeeplyNonMutable(seen map[interface{}]bool) bool
- func (m *MySlice) Len() int
- func (m *MySlice) Mutable() bool
- func (m *MySlice) Range() []*MyMap
- func (m *MySlice) Set(i int, v *MyMap) *MySlice
- func (m *MySlice) WithImmutable(f func(mi *MySlice)) *MySlice
- func (m *MySlice) WithMutable(f func(mi *MySlice)) *MySlice
- type MyStruct
- func (s *MyStruct) AsImmutable(v *MyStruct) *MyStruct
- func (s *MyStruct) AsMutable() *MyStruct
- func (s *MyStruct) IsDeeplyNonMutable(seen map[interface{}]bool) bool
- func (s *MyStruct) Mutable() bool
- func (s *MyStruct) Name() string
- func (s *MyStruct) SetName(n string) *MyStruct
- func (s *MyStruct) WithImmutable(f func(si *MyStruct)) *MyStruct
- func (s *MyStruct) WithMutable(f func(si *MyStruct)) *MyStruct
- type Person
- func (s *Person) Age() int
- func (s *Person) AsImmutable(v *Person) *Person
- func (s *Person) AsMutable() *Person
- func (s *Person) IsDeeplyNonMutable(seen map[interface{}]bool) bool
- func (s *Person) Mutable() bool
- func (s *Person) Name() string
- func (s *Person) SetAge(n int) *Person
- func (s *Person) SetName(n string) *Person
- func (p *Person) String() string
- func (s *Person) WithImmutable(f func(si *Person)) *Person
- func (s *Person) WithMutable(f func(si *Person)) *Person
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MyMap ¶
type MyMap struct {
// contains filtered or unexported fields
}
MyMap will be exported
MyMap is an immutable type and has the following template:
map[string]*MySlice
func NewMyMapCap ¶
func (*MyMap) AsImmutable ¶
func (*MyMap) IsDeeplyNonMutable ¶
func (*MyMap) WithImmutable ¶
func (*MyMap) WithMutable ¶
type MySlice ¶
type MySlice struct {
// contains filtered or unexported fields
}
MySlice will be exported
MySlice is an immutable type and has the following template:
[]*MyMap
func NewMySlice ¶
func NewMySliceLen ¶
func (*MySlice) AsImmutable ¶
func (*MySlice) IsDeeplyNonMutable ¶
func (*MySlice) WithImmutable ¶
func (*MySlice) WithMutable ¶
type MyStruct ¶
type MyStruct struct {
// contains filtered or unexported fields
}
MyStruct will be exported.
It is a special type.
MyStruct is an immutable type and has the following template:
struct { Name string surname string self *MyStruct age int }
func (*MyStruct) AsImmutable ¶
func (*MyStruct) IsDeeplyNonMutable ¶
func (*MyStruct) WithImmutable ¶
func (*MyStruct) WithMutable ¶
type Person ¶
type Person struct {
// contains filtered or unexported fields
}
via go generate, this template is code generated into the immutable Person struct within the same package
Person is an immutable type and has the following template:
struct { Name string Age int }
func (*Person) AsImmutable ¶
func (*Person) IsDeeplyNonMutable ¶
func (*Person) String ¶
Hence we can then define methods on *Person (methods can only be defined on a pointer receiver)
func (*Person) WithImmutable ¶
func (*Person) WithMutable ¶
Click to show internal directories.
Click to hide internal directories.