Append adds the given snapshots to the asset with the given name.
(name string, snapshots <-chan *Snapshot)
| 168 | |
| 169 | // Append adds the given snapshots to the asset with the given name. |
| 170 | func (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. |
| 193 | func (s *SQLRepository) Drop() error { |