Last active
November 10, 2022 01:52
-
-
Save skangmy/5d2fa3dbc51b7019a80b9d747f7d1b9c to your computer and use it in GitHub Desktop.
Frequently used Flux code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// return default value if v is null | |
// usage: coalesce(v: r.host, default: "missing") | |
coalesce = (v, default) => if exists v then v else default | |
// setting timezone | |
// needed when using aggregateWindow with period 1d and higher, or date truncate function | |
import "timezone" | |
option location = timezone.location(name: "Asia/Kuala_Lumpur") | |
// http request | |
import "http/requests" | |
import "experimental/json" | |
response = requests.get(url: "http://localhost/api/" + id) | |
data = json.parse(data: response.body).data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment