configfuncw

package
v0.0.0-...-797f71f Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Name  string
	IsErr bool
	Count int
}

func Make

func Make(options ...Option) (*Config, error)

type ConfigBuilder

type ConfigBuilder struct {
	// contains filtered or unexported fields
}

func (*ConfigBuilder) Build

func (cb *ConfigBuilder) Build() (*Config, error)
Example
x1, y1 := Make(
	Name("1"),
	IsErr(true),
	Count(3),
)

x2, y2 := Make(
	Name("1"),
	Count(3),
)

fmt.Println(x1, y1)
fmt.Println(x2, y2)
Output:

<nil> IsErr
&{1 false 3} <nil>

type Option

type Option func(cb *ConfigBuilder) error

func Count

func Count(count int) Option

func IsErr

func IsErr(isErr bool) Option

func Name

func Name(name string) Option

Jump to

Keyboard shortcuts

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