Documentation ¶
Overview ¶
optparams 用于管理关键字参数的模块
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FuncOption ¶
type FuncOption[T any] struct { // contains filtered or unexported fields }
FuncOption 作为关键字参数项的返回值 @generic T any 关键字参数对应的结构
func NewFuncOption ¶
func NewFuncOption[T any](f func(*T)) *FuncOption[T]
NewFuncOption 用于构造关键字参数项目 @generic T any 关键字参数对应的结构 例子:
func WithName(name string) optparams.Option[NameOpt] { return optparams.NewFuncOption( func(o *NameOpt) { o.Name = name }) }
func (*FuncOption[T]) Apply ¶
func (fo *FuncOption[T]) Apply(do *T)
Click to show internal directories.
Click to hide internal directories.