Instantiate a new Bridge for a repo, from the given target and name
(repo *cache.RepoCache, target string, name string)
| 89 | |
| 90 | // Instantiate a new Bridge for a repo, from the given target and name |
| 91 | func NewBridge(repo *cache.RepoCache, target string, name string) (*Bridge, error) { |
| 92 | implType, ok := bridgeImpl[target] |
| 93 | if !ok { |
| 94 | return nil, fmt.Errorf("unknown bridge target %v", target) |
| 95 | } |
| 96 | |
| 97 | impl := reflect.New(implType).Interface().(BridgeImpl) |
| 98 | |
| 99 | bridge := &Bridge{ |
| 100 | Name: name, |
| 101 | repo: repo, |
| 102 | impl: impl, |
| 103 | } |
| 104 | |
| 105 | return bridge, nil |
| 106 | } |
| 107 | |
| 108 | // LoadBridge instantiate a new bridge from a repo configuration |
| 109 | func LoadBridge(repo *cache.RepoCache, name string) (*Bridge, error) { |
no test coverage detected