gimple: github.com/fjorgemota/gimple Index | Files | Directories

package gimple

import "github.com/fjorgemota/gimple"

Package gimple is a Dependency Injection Container developed in Golang with features highly inspired on Pimple, a micro dependency injection container for PHP.

Some of it's features is:

- Define services; - Define factories; - Define parameters easily; - Allow services to depend directly on interfaces, and not on concrete struct; - Defining services/parameters/factories from another files - because you should be able to split your configuration easily; - Simple API; - Allows extending services easily; - Allow to get the raw service creator easily; - Pure Go, no C code envolved; - Fully tested on each commit; - I already said that it have a really Simple API? :)

Index

Package Files

definitions.go gimple.go utils.go

Variables

var (
    Undefined = errors.New("Not defined")
)

type Container Uses

type Container interface {
    Get(key string) (interface{}, error)
    MustGet(key string) interface{}
    Set(key string, val interface{})
    Has(key string) bool
    Keys() []string
    Factory(fn func(c Container) interface{}) func(c Container) interface{}
    Protect(fn func(c Container) interface{}) func(c Container) interface{}
    Extend(key string, e Extender) error
    MustExtend(key string, e Extender)
    ExtendFunc(key string, f ExtenderFunc) error
    MustExtendFunc(key string, f ExtenderFunc)
    Register(provider Registerer)
    RegisterFunc(fn RegisterFunc)
    Raw(key string) (interface{}, error)
    MustRaw(key string) interface{}
}

func New Uses

func New(values ...map[string]interface{}) Container

func NewGimple Uses

func NewGimple() Container

func NewGimpleWithValues Uses

func NewGimpleWithValues(values map[string]interface{}) Container

func NewWithValues Uses

func NewWithValues(values map[string]interface{}) Container

type Error Uses

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

func (Error) Error Uses

func (self Error) Error() string

type Extender Uses

type Extender interface {
    Extend(old interface{}, c Container) interface{}
}

type ExtenderFunc Uses

type ExtenderFunc func(old interface{}, c Container) interface{}

func (ExtenderFunc) Extend Uses

func (f ExtenderFunc) Extend(old interface{}, c Container) interface{}

type Gimple Uses

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

func (*Gimple) Extend Uses

func (container *Gimple) Extend(key string, e Extender) error

func (*Gimple) ExtendFunc Uses

func (container *Gimple) ExtendFunc(key string, f ExtenderFunc) error

func (*Gimple) Factory Uses

func (container *Gimple) Factory(fn func(c Container) interface{}) func(c Container) interface{}

func (*Gimple) Get Uses

func (container *Gimple) Get(key string) (interface{}, error)

func (*Gimple) Has Uses

func (container *Gimple) Has(key string) bool

func (*Gimple) Keys Uses

func (container *Gimple) Keys() []string

func (*Gimple) MustExtend Uses

func (container *Gimple) MustExtend(key string, e Extender)

func (*Gimple) MustExtendFunc Uses

func (container *Gimple) MustExtendFunc(key string, f ExtenderFunc)

func (*Gimple) MustGet Uses

func (container *Gimple) MustGet(key string) interface{}

func (*Gimple) MustRaw Uses

func (container *Gimple) MustRaw(key string) interface{}

func (*Gimple) Protect Uses

func (container *Gimple) Protect(fn func(c Container) interface{}) func(c Container) interface{}

func (*Gimple) Raw Uses

func (container *Gimple) Raw(key string) (interface{}, error)

func (*Gimple) Register Uses

func (container *Gimple) Register(provider Registerer)

func (*Gimple) RegisterFunc Uses

func (container *Gimple) RegisterFunc(fn RegisterFunc)

func (*Gimple) Set Uses

func (container *Gimple) Set(key string, val interface{})

type RegisterFunc Uses

type RegisterFunc func(c Container)

func (RegisterFunc) Register Uses

func (fn RegisterFunc) Register(c Container)

type Registerer Uses

type Registerer interface {
    Register(container Container)
}

Directories

PathSynopsis
_example

Package gimple imports 4 packages (graph) and is imported by 2 packages. Updated 2017-08-10. Refresh now. Tools for package owners.