query.go 421 B

1234567891011121314151617181920
  1. package client
  2. import (
  3. "fmt"
  4. "time"
  5. )
  6. func QueryProducts(client *FhoClient, lastUpdatedTime time.Time) ([]*Product, error) {
  7. data, err := client.query("products", lastUpdatedTime)
  8. if err != nil {
  9. fmt.Println("query error:", err.Error())
  10. return nil, err
  11. }
  12. var products []*Product
  13. for _, rec := range data {
  14. _product := ProductFromMap(rec)
  15. products = append(products, _product)
  16. }
  17. return products, nil
  18. }