myitcv.io: myitcv.io/immutable/example Index | Files

package example

import "myitcv.io/immutable/example"

Index

Package Files

example.go gen_example_immutableGen.go gen_strings_immutableGen.go strings.go

type MyMap Uses

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 NewMyMap Uses

func NewMyMap(inits ...func(m *MyMap)) *MyMap

func NewMyMapCap Uses

func NewMyMapCap(l int) *MyMap

func (*MyMap) AsImmutable Uses

func (m *MyMap) AsImmutable(v *MyMap) *MyMap

func (*MyMap) AsMutable Uses

func (m *MyMap) AsMutable() *MyMap

func (*MyMap) Del Uses

func (m *MyMap) Del(k string) *MyMap

func (*MyMap) Get Uses

func (m *MyMap) Get(k string) (*MySlice, bool)

func (*MyMap) IsDeeplyNonMutable Uses

func (s *MyMap) IsDeeplyNonMutable(seen map[interface{}]bool) bool

func (*MyMap) Len Uses

func (m *MyMap) Len() int

func (*MyMap) Mutable Uses

func (m *MyMap) Mutable() bool

func (*MyMap) Range Uses

func (m *MyMap) Range() map[string]*MySlice

func (*MyMap) Set Uses

func (m *MyMap) Set(k string, v *MySlice) *MyMap

func (*MyMap) WithImmutable Uses

func (mr *MyMap) WithImmutable(f func(m *MyMap)) *MyMap

func (*MyMap) WithMutable Uses

func (mr *MyMap) WithMutable(f func(m *MyMap)) *MyMap

type MySlice Uses

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 Uses

func NewMySlice(s ...*MyMap) *MySlice

func NewMySliceLen Uses

func NewMySliceLen(l int) *MySlice

func (*MySlice) Append Uses

func (m *MySlice) Append(v ...*MyMap) *MySlice

func (*MySlice) AsImmutable Uses

func (m *MySlice) AsImmutable(v *MySlice) *MySlice

func (*MySlice) AsMutable Uses

func (m *MySlice) AsMutable() *MySlice

func (*MySlice) Get Uses

func (m *MySlice) Get(i int) *MyMap

func (*MySlice) IsDeeplyNonMutable Uses

func (s *MySlice) IsDeeplyNonMutable(seen map[interface{}]bool) bool

func (*MySlice) Len Uses

func (m *MySlice) Len() int

func (*MySlice) Mutable Uses

func (m *MySlice) Mutable() bool

func (*MySlice) Range Uses

func (m *MySlice) Range() []*MyMap

func (*MySlice) Set Uses

func (m *MySlice) Set(i int, v *MyMap) *MySlice

func (*MySlice) WithImmutable Uses

func (m *MySlice) WithImmutable(f func(mi *MySlice)) *MySlice

func (*MySlice) WithMutable Uses

func (m *MySlice) WithMutable(f func(mi *MySlice)) *MySlice

type MyStruct Uses

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 Uses

func (s *MyStruct) AsImmutable(v *MyStruct) *MyStruct

func (*MyStruct) AsMutable Uses

func (s *MyStruct) AsMutable() *MyStruct

func (*MyStruct) IsDeeplyNonMutable Uses

func (s *MyStruct) IsDeeplyNonMutable(seen map[interface{}]bool) bool

func (*MyStruct) Mutable Uses

func (s *MyStruct) Mutable() bool

func (*MyStruct) Name Uses

func (s *MyStruct) Name() string

Name is a field in MyStruct

func (*MyStruct) SetName Uses

func (s *MyStruct) SetName(n string) *MyStruct

SetName is the setter for Name()

func (*MyStruct) WithImmutable Uses

func (s *MyStruct) WithImmutable(f func(si *MyStruct)) *MyStruct

func (*MyStruct) WithMutable Uses

func (s *MyStruct) WithMutable(f func(si *MyStruct)) *MyStruct

type Person Uses

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) Age Uses

func (s *Person) Age() int

func (*Person) AsImmutable Uses

func (s *Person) AsImmutable(v *Person) *Person

func (*Person) AsMutable Uses

func (s *Person) AsMutable() *Person

func (*Person) IsDeeplyNonMutable Uses

func (s *Person) IsDeeplyNonMutable(seen map[interface{}]bool) bool

func (*Person) Mutable Uses

func (s *Person) Mutable() bool

func (*Person) Name Uses

func (s *Person) Name() string

func (*Person) SetAge Uses

func (s *Person) SetAge(n int) *Person

SetAge is the setter for Age()

func (*Person) SetName Uses

func (s *Person) SetName(n string) *Person

SetName is the setter for Name()

func (*Person) String Uses

func (p *Person) String() string

Hence we can then define methods on *Person (methods can only be defined on a pointer receiver)

func (*Person) WithImmutable Uses

func (s *Person) WithImmutable(f func(si *Person)) *Person

func (*Person) WithMutable Uses

func (s *Person) WithMutable(f func(si *Person)) *Person

Package example imports 2 packages (graph). Updated 2019-07-27. Refresh now. Tools for package owners.