example_zoo

package
v0.0.0-...-b388aef Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2022 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfigSet = wire.NewSet(
	wire.FieldsOf(new(*Config),
		"AnonymousConfigField2",
		"ConfigField",
	),
)
View Source
var ZooSet = wire.NewSet(
	wire.Struct(new(MiniZoo), "*"),

	wire.Struct(new(Zoo), "*"),
)

Functions

This section is empty.

Types

type AnonymousConfigField2

type AnonymousConfigField2 struct {
}

type Bird

type Bird struct{}

@autowire(set=animals,FlyAnimal)

func (Bird) Fly

func (b Bird) Fly()

it will be collect into animalsSet and wire as interface FlyAnimal

type Cat

type Cat struct{}

it will be collect into animalsSet @autowire(set=animals)

type Config

type Config struct {
	ConfigField ConfigField
	AnonymousConfigField2
}

@autowire.config(set=config)

type ConfigField

type ConfigField struct {
}

type Dog

type Dog struct{}

use provider func

func ProvideDog

func ProvideDog() Dog

it will be collect into animalsSet user provider func @autowire(set=animals)

type FlyAnimal

type FlyAnimal interface {
	Fly()
}

type Lion

type Lion struct{}

it will be collect into animalsSet as it has a New method it will use NewLion as provider @autowire(set=animals)

func NewLion

func NewLion() Lion

type MiniZoo

type MiniZoo struct {
	Cat       Cat
	FlyAnimal FlyAnimal
}

@autowire.init(set=zoo)

func InitializeMiniZoo

func InitializeMiniZoo(c0 *Config) (*MiniZoo, func(), error)

type Tiger

type Tiger struct{}

it will be collect into animalsSet as it has a New method it will use NewLion as provider @autowire(set=animals,new=InitSomeTiger)

func InitSomeTiger

func InitSomeTiger() Tiger

type Zoo

type Zoo struct {
	Cat         Cat
	Dog         Dog
	Lion        Lion
	FlyAnimal   FlyAnimal
	ConfigField ConfigField
	AnonymousConfigField2
	Tiger
}

it will be collect into zooSet use init to create initZoo method in wire.gen.go @autowire.init(set=zoo)

func InitializeZoo

func InitializeZoo(c0 *Config) (*Zoo, func(), error)

Jump to

Keyboard shortcuts

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