Пример #1
0
// BuildCollection generates a single collection using the model and adapter provided
func (cs *Caddyshack) BuildCollection(m model.Definition, a adapter.Definition) (Caddyshack, error) {
	coll, err := a.BuildCollection(m)
	if err != nil {
		return *cs, err
	}

	cs.Collections[m.Name] = coll
	return *cs, nil
}
Пример #2
0
// LoadAdapter loads a single adapter into the instance
func (cs *Caddyshack) LoadAdapter(adp adapter.Definition, rsc resource.Definition) (Caddyshack, error) {
	name := adp.GetName()
	if name == "" {
		return *cs, errors.New("adapter .Name cannot be empty")
	}
	cs.Adapters[name] = adp
	cs.Adapters[name].SetConfig(rsc)
	return *cs, nil
}