Exemplo n.º 1
0
func newContext(mapper typemapper.TypeMapper, wrappers []*wrapper) *context {
	ret := &context{
		TypeMapper: typemapper.New(mapper),
		wrappers:   wrappers,
		funcIndex:  0,
	}
	ret.InsertType(ret, contextType)
	return ret
}
Exemplo n.º 2
0
// Clone creates another Middleware which has same content.
func (m *Middleware) Clone() *Middleware {
	wrappers := make([]*wrapper, len(m.wrappers))
	for i, wrapper := range m.wrappers {
		wrappers[i] = wrapper
	}
	return &Middleware{
		TypeMapper: typemapper.New(m.TypeMapper),
		wrappers:   wrappers,
	}
}
Exemplo n.º 3
0
// New creates a new Middleware
func New() *Middleware {
	return &Middleware{
		TypeMapper: typemapper.New(nil),
	}
}
Exemplo n.º 4
0
func newFakeContext() *fakeContext {
	return &fakeContext{
		TypeMapper: typemapper.New(nil),
	}
}