mneudert / instream

InfluxDB driver for Elixir
Apache License 2.0
222 stars 37 forks source link

from_result does not return timestamp or time #54

Closed e-fu closed 4 years ago

e-fu commented 4 years ago

I'm wondering how to get the time or timestamp back from the function from_result. I get timestamp nil.

%Signal{ fields: %Signal.Fields{ chart_timeframe: "15M", signal_price: 8888, signal_type: "BUY" }, tags: %Signal.Tags{ algo: "ETHI", exchange: "KRAKEN", ticker: "ETHUSD" }, timestamp: nil }

e-fu commented 4 years ago

"%{results: [%{series: [%{columns: [\"time\", \"algo\", \"chart_timeframe\", \"exchange\", \"signal_price\", \"signal_type\", \"ticker\"], name: \"signal\", values: [[\"2020-01-02T04:43:20.992015Z\", \"ETHI\", \"15M\", \"KRAKEN\", 8888, \"BUY\", \"ETHUSD\"], [\"2020-01-02T04:43:57.749585908Z\", \"ETHI\", \"15M\", \"KRAKEN\", 8888, \"BUY\", \"ETHUSD\"]]}], statement_id: 0}]}"

e-fu commented 4 years ago

Adding precision to the query returns the UNIX / epoch timestamp. Default without precision is RFC3339 UTC. """ SELECT * FROM "signal" """ |> InfluxDB.query(database: "#{@db_name}", precision: :nanosecond)

Not sure if it's the behaviour you want. I will let it open, even if it's solved for me.

Please decide what to do.