example

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 1, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Street string
	City   string
}

type Embedded added in v0.2.0

type Embedded struct{}

type Embedded2 added in v0.2.0

type Embedded2 struct{}

type Embedded3 added in v0.2.0

type Embedded3 struct{}

type Embedded4 added in v0.2.0

type Embedded4 struct{}

type Embedded5 added in v0.2.0

type Embedded5 struct{}

type Embedded6 added in v0.2.0

type Embedded6 struct{}

type Embedded7 added in v0.2.0

type Embedded7 struct{}

type Embedded8 added in v0.2.0

type Embedded8 struct{}

type GenericExample added in v0.1.0

type GenericExample[T any, U comparable, V ~int] struct {
	A T `opt:"-"`
	B U
	C V
	D string
}

type User

type User struct {
	Embedded   `opt:"-"`
	*Embedded2 `opt:"-"`
	E3         Embedded3  `opt:"-"`
	E4         *Embedded4 `opt:"-"`
	Embedded5
	*Embedded6
	E7                 Embedded7
	E8                 *Embedded8
	Username           string
	Email              string
	Address            // combined struct
	ArrayField         [4]int
	SliceField         []int
	ThirdPartyField    third_party.ThirdParty
	MapField           map[string]int
	PtrField           *int
	EmptyStructFiled   struct{}
	SimpleFuncField    func()
	ComplexFuncField   func(a int)
	ComplexFuncFieldV2 func() int
	ComplexFuncFieldV3 func(a int) int
	ComplexFuncFieldV4 func(a int) (int, error)
	ChanField          chan int
	// contains filtered or unexported fields
}

func NewUser

func NewUser(embedded Embedded, embedded2 *Embedded2, e3 Embedded3, e4 *Embedded4, opts ...UserOption) *User

type UserOption

type UserOption func(*User)

func WithAddress

func WithAddress(address Address) UserOption

func WithArrayField

func WithArrayField(arrayField [4]int) UserOption

func WithChanField

func WithChanField(chanField chan int) UserOption

func WithComplexFuncField

func WithComplexFuncField(complexFuncField func(a int)) UserOption

func WithComplexFuncFieldV2

func WithComplexFuncFieldV2(complexFuncFieldV2 func() int) UserOption

func WithComplexFuncFieldV3

func WithComplexFuncFieldV3(complexFuncFieldV3 func(a int) int) UserOption

func WithComplexFuncFieldV4

func WithComplexFuncFieldV4(complexFuncFieldV4 func(a int) (int, error)) UserOption

func WithE7 added in v0.2.0

func WithE7(e7 Embedded7) UserOption

func WithE8 added in v0.2.0

func WithE8(e8 *Embedded8) UserOption

func WithEmail

func WithEmail(email string) UserOption

func WithEmbedded5 added in v0.2.0

func WithEmbedded5(embedded5 Embedded5) UserOption

func WithEmbedded6 added in v0.2.0

func WithEmbedded6(embedded6 *Embedded6) UserOption

func WithEmptyStructFiled

func WithEmptyStructFiled(emptyStructFiled struct{}) UserOption

func WithError

func WithError(error error) UserOption

func WithMapField

func WithMapField(mapField map[string]int) UserOption

func WithPtrField

func WithPtrField(ptrField *int) UserOption

func WithSimpleFuncField

func WithSimpleFuncField(simpleFuncField func()) UserOption

func WithSliceField

func WithSliceField(sliceField []int) UserOption

func WithThirdPartyField

func WithThirdPartyField(thirdPartyField third_party.ThirdParty) UserOption

func WithUsername

func WithUsername(username string) UserOption

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL