bindings

package
v0.0.0-...-6d43c30 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package bindings setups the the dependency bindings for a component

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BindingModule

type BindingModule interface {
	BindsBoundType(impl SpecificBoundType) BoundType
}

BindingModule binds SpecificBoundType to BoundType

type BoundType

type BoundType string

BoundType is used to test whether or not bound types work on components

type ServiceComponent

type ServiceComponent interface {
	// The actual instance to return (fully injected). Errors during injection
	// will be returned in the error
	GetService() (*example.Service, error)

	// Non-interface / pointer types cannot return an error
	GetServiceTimeout() (example.ServiceTimeout, error)

	GetBoundType() BoundType
}

ServiceComponent defines the top level component. The return type of the `Modules()` method is used as a list of modules to include for injection All other methods are considered types to generate injections for

type ServiceDefinition

type ServiceDefinition interface {
	// The list of modules to include
	Modules() (BindingModule, *ServiceModule, dbstore.DBBindingModule)

	// An implementation of the interface will be automatically generated. The values
	// returned will be automatically instiated from their dependencies.
	Target() ServiceComponent
}

ServiceDefinition defines the target and the modules to include

type ServiceModule

type ServiceModule struct{}

ServiceModule illustrates how each method on a struct module can provide an instance to be injected

func (*ServiceModule) ProvidesServiceTimeout

func (s *ServiceModule) ProvidesServiceTimeout() (example.ServiceTimeout, error)

ProvidesServiceTimeout provides a time.Duration under the name ServiceTimeout

func (*ServiceModule) ProvidesSpecificBoundType

func (s *ServiceModule) ProvidesSpecificBoundType() SpecificBoundType

ProvidesSpecificBoundType provides the SpecificBoundType

type SpecificBoundType

type SpecificBoundType string

SpecificBoundType is a specific instance assignable to BoundType

Directories

Path Synopsis
Code generated by go generate; DO NOT EDIT.
Code generated by go generate; DO NOT EDIT.

Jump to

Keyboard shortcuts

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