| Conditions | 3 |
| Total Lines | 15 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | package memory |
||
| 25 | func (b *BundleReader) Read(ctx context.Context, tenantID, name string) (bundle *base.DataBundle, err error) { |
||
| 26 | txn := b.database.DB.Txn(false) |
||
| 27 | defer txn.Abort() |
||
| 28 | var raw interface{} |
||
| 29 | raw, err = txn.First(constants.BundlesTable, "id", tenantID, name) |
||
| 30 | if err != nil { |
||
| 31 | return bundle, errors.New(base.ErrorCode_ERROR_CODE_EXECUTION.String()) |
||
| 32 | } |
||
| 33 | |||
| 34 | bun, ok := raw.(storage.Bundle) |
||
| 35 | if ok { |
||
| 36 | return bun.DataBundle, err |
||
| 37 | } |
||
| 38 | |||
| 39 | return nil, errors.New(base.ErrorCode_ERROR_CODE_BUNDLE_NOT_FOUND.String()) |
||
| 40 | } |
||
| 41 |