foundation

package module
v0.0.0-...-f198145 Latest Latest
Warning

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

Go to latest
Published: May 7, 2022 License: MIT Imports: 7 Imported by: 0

README

codecov

Foundation

This repository contains the foundation for confetti.

https://confetti-framework.github.io/docs/architecture-concepts/lifecycle.html

License

Confetti is open-sourced software licensed under the MIT license.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CanNotInstantiateCallbackWithParameters = errors.New("Can not instantiate callback with parameters")

Functions

func NewContainerByBoot

func NewContainerByBoot(bootContainer inter.Container) inter.Container

func NewTestApp

func NewTestApp(decorator func(container inter.Container) inter.Container) inter.App

Types

type Application

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

func NewApp

func NewApp() *Application

func (*Application) Bind

func (a *Application) Bind(abstract interface{}, concrete interface{})

Bind registers a binding. You can pass the struct or interface that we want to register, along with a closure that returns an instance of the struct.

func (*Application) Container

func (a *Application) Container() *inter.Container

Container fetch the container from the application

func (*Application) Db

func (a *Application) Db(connectionName ...string) inter.Database

func (*Application) Environment

func (a *Application) Environment() (string, error)

func (*Application) Instance

func (a *Application) Instance(abstract interface{}) interface{}

func (*Application) IsEnvironment

func (a *Application) IsEnvironment(environments ...string) bool

func (*Application) Log

func (a *Application) Log(channels ...string) inter.LoggerFacade

func (*Application) Make

func (a *Application) Make(abstract interface{}) interface{}

Make the given type from the container.

func (*Application) MakeE

func (a *Application) MakeE(abstract interface{}) (interface{}, error)

MakeE make or give an error by the given type from the container.

func (*Application) SetContainer

func (a *Application) SetContainer(container inter.Container)

SetContainer set the service container

func (*Application) Singleton

func (a *Application) Singleton(abstract interface{}, concrete interface{})

Singleton registered a shared binding in the container.

type Container

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

func NewContainer

func NewContainer() *Container

func (*Container) Bind

func (c *Container) Bind(abstract interface{}, concrete interface{})

Register a binding with the container.

func (*Container) Bindings

func (c *Container) Bindings() inter.Bindings

GetE the container's bindings.

func (*Container) Bound

func (c *Container) Bound(abstract string) bool

Determine if the given abstract type has been bound.

func (*Container) Extend

func (c *Container) Extend(abstract interface{}, function func(service interface{}) interface{})

Extend an abstract type in the container.

func (*Container) Instance

func (c *Container) Instance(concrete interface{}) interface{}

Register an existing instance as shared in the container without an abstract

func (*Container) Make

func (c *Container) Make(abstract interface{}) interface{}

MakeE the given type from the container.

func (*Container) MakeE

func (c *Container) MakeE(abstract interface{}) (interface{}, error)

MakeE the given type from the container.

func (*Container) Singleton

func (c *Container) Singleton(abstract interface{}, concrete interface{})

Register a shared binding in the container.

Jump to

Keyboard shortcuts

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