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

Method LastDate

asset/sql_repository.go:152–167  ·  view source on GitHub ↗

LastDate returns the date of the last snapshot for the asset with the given name.

(name string)

Source from the content-addressed store, hash-verified

150
151// LastDate returns the date of the last snapshot for the asset with the given name.
152func (s *SQLRepository) LastDate(name string) (time.Time, error) {
153 row := s.lastDateQuery.QueryRow(name)
154
155 var date time.Time
156
157 err := row.Scan(&date)
158 if err != nil {
159 if err == sql.ErrNoRows {
160 return date, fmt.Errorf("unable to find asset")
161 }
162
163 return date, fmt.Errorf("unable to get the last date: %w", err)
164 }
165
166 return date, nil
167}
168
169// Append adds the given snapshots to the asset with the given name.
170func (s *SQLRepository) Append(name string, snapshots <-chan *Snapshot) error {

Callers 1

TestSQLRepositoryFunction · 0.95

Calls

no outgoing calls

Tested by 1

TestSQLRepositoryFunction · 0.76