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

Method Append

asset/sql_repository.go:170–190  ·  view source on GitHub ↗

Append adds the given snapshots to the asset with the given name.

(name string, snapshots <-chan *Snapshot)

Source from the content-addressed store, hash-verified

168
169// Append adds the given snapshots to the asset with the given name.
170func (s *SQLRepository) Append(name string, snapshots <-chan *Snapshot) error {
171 go func() {
172 for snapshot := range snapshots {
173 _, err := s.appendQuery.Exec(
174 name,
175 snapshot.Date,
176 snapshot.Open,
177 snapshot.High,
178 snapshot.Low,
179 snapshot.Close,
180 snapshot.Volume,
181 )
182
183 if err != nil {
184 log.Printf("unable to append snapshot: %v", err)
185 }
186 }
187 }()
188
189 return nil
190}
191
192// Drop drops the snapshots table.
193func (s *SQLRepository) Drop() error {

Callers 1

TestSQLRepositoryFunction · 0.95

Calls 1

ExecMethod · 0.80

Tested by 1

TestSQLRepositoryFunction · 0.76