| 239 | } |
| 240 | |
| 241 | func (s *SmartContract) GetBanks(ctx contractapi.TransactionContextInterface) ([]Bank, error) { |
| 242 | count, err := currentID(ctx, bankCounterKey) |
| 243 | if err != nil { |
| 244 | return nil, err |
| 245 | } |
| 246 | banks := make([]Bank, 0, count) |
| 247 | for id := 0; id < count; id++ { |
| 248 | bank, err := readBank(ctx, id) |
| 249 | if err != nil { |
| 250 | return nil, err |
| 251 | } |
| 252 | banks = append(banks, *bank) |
| 253 | } |
| 254 | return banks, nil |
| 255 | } |
| 256 | |
| 257 | func (s *SmartContract) GetCompanies(ctx contractapi.TransactionContextInterface) ([]Company, error) { |
| 258 | count, err := currentID(ctx, companyCounterKey) |