brick

package
v0.0.0-...-3dc5271 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2017 License: Apache-2.0 Imports: 2 Imported by: 4

Documentation

Index

Constants

View Source
const (
	Empty ObjectState = 0
	New               = 1
	Init              = 2
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

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

Container manage all services

func NewContainer

func NewContainer() *Container

func (*Container) Add

func (p *Container) Add(obj interface{}, name string, factory Factory)

Add obj type in the container

func (*Container) Build

func (p *Container) Build()

Build all objs in the container

func (*Container) Dispose

func (p *Container) Dispose()

Build all objs in the container

func (*Container) GetByName

func (p *Container) GetByName(name string) interface{}

func (*Container) GetByType

func (p *Container) GetByType(svcType reflect.Type) interface{}

type ContainerAware

type ContainerAware interface {
	// SetContainer set the container to the service
	SetContainer(c *Container)
}

ContainerAware provide the container to the service

type Disposable

type Disposable interface {
	Dispose() error
}

Disposable dispose a service that release all resources which used

type EventHandler

type EventHandler interface {
	// Handle process the event
	Handle(event string, data interface{})
}

EventHandler process the event

type Factory

type Factory interface {

	// New a service instance
	New() interface{}
}

Factory create a service

type Initializer

type Initializer interface {
	Init() error
}

Initializer init a service

type Notify

type Notify interface {
	// Emmit an event
	Emmit(event string, data interface{})
}

Notify events

type ObjectRef

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

ObjectRef store the information of a object instance

func (*ObjectRef) Key

func (p *ObjectRef) Key() string

func (*ObjectRef) Target

func (p *ObjectRef) Target() interface{}

func (*ObjectRef) Type

func (p *ObjectRef) Type() reflect.Type

type ObjectState

type ObjectState uint32

ObjectState

type Observable

type Observable interface {
	// Register a handler on the event
	On(event string, handler EventHandler)

	// Remove the handler on the event
	Off(event string, handler EventHandler)
}

type Trigger

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

func (*Trigger) Emmit

func (p *Trigger) Emmit(event string, data interface{})

func (*Trigger) Off

func (p *Trigger) Off(event string, handler EventHandler)

func (*Trigger) On

func (p *Trigger) On(event string, handler EventHandler)

Jump to

Keyboard shortcuts

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