MCPcopy Create free account
hub / github.com/cinar/indicator / Assets

Method Assets

asset/sql_repository.go:87–109  ·  view source on GitHub ↗

Assets returns the names of all assets in the respository.

()

Source from the content-addressed store, hash-verified

85
86// Assets returns the names of all assets in the respository.
87func (s *SQLRepository) Assets() ([]string, error) {
88 rows, err := s.assetsQuery.Query()
89 if err != nil {
90 return nil, fmt.Errorf("unable to get assets: %w", err)
91 }
92
93 defer helper.CloseDatabaseRows(rows)
94
95 var assets []string
96
97 for rows.Next() {
98 var name string
99
100 err := rows.Scan(&name)
101 if err != nil {
102 return nil, fmt.Errorf("unable to scan assets: %w", err)
103 }
104
105 assets = append(assets, name)
106 }
107
108 return assets, nil
109}
110
111// Get attempts to return a channel of snapshots for the asset with the given name.
112func (s *SQLRepository) Get(name string) (<-chan *Snapshot, error) {

Callers 1

TestSQLRepositoryFunction · 0.95

Calls 3

CloseDatabaseRowsFunction · 0.92
QueryMethod · 0.80
NextMethod · 0.80

Tested by 1

TestSQLRepositoryFunction · 0.76