Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New[T any]() *T
New will make a new T and call Init function recursively on it if it is implemented.
Example ¶
package main import ( "go.llib.dev/frameless/pkg/mk" ) func main() { v := mk.New[TypeWithInit]() _ = v } type TypeWithInit struct { V1 string V2 string Foo string Bar int Baz bool } func (v *TypeWithInit) Init() { v.V1 = "V1i" v.V2 = "V2i" }
Example (Nested) ¶
package main import ( "go.llib.dev/frameless/pkg/mk" ) func main() { v := mk.New[NestedType]() _ = v // initialised _ = v.Nested // initialised } type TypeWithInit struct { V1 string V2 string Foo string Bar int Baz bool } func (v *TypeWithInit) Init() { v.V1 = "V1i" v.V2 = "V2i" } type NestedType struct { V1 string Nested TypeWithInit } func (nt *NestedType) Init() { nt.V1 = "NT:" + nt.Nested.V1 }
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.