`go-redash-query` is a simple library to get structed data from `redash query` sources

go-redash-query

go-redash-query is a simple library to get structed data from redash query sources

Example

Source table

id name email
1 Dannyhann [email protected]
2 foo [email protected]
3 bar [email protected]

Source query

SELECT id, name, email 
FROM test_user 
WHERE id > {{id}}
ORDER BY id ASC 
LIMIT {{size}}

Usage

package main

import (
	"fmt"
	"go-redash-query"
	"log"
)

var (
	redashQueryId = 1 // Redash QueryId
	redashApiUrl  = ""
	redashAPiKey  = ""
)

type TestUserData struct {
	Id    int    `json:"id" mapstructure:"id"`
	Name  string `json:"name" mapstructure:"name"`
	Email string `json:"email" mapstructure:"email"`
}

func main() {

	client := go_redash_query.CreateClient(redashApiUrl, redashAPiKey)

	queryData := go_redash_query.QueryData{
		MaxAge: 10,
		Parameters: go_redash_query.P{
			"id":   1,
			"size": 20,
		},
	}

	job, err := client.CreateJobWithQuery(redashQueryId, queryData)
	if err != nil {
		log.Fatalf("CreateJobWithQuery %s", err)
	}

	fetchedData, err := client.Fetch(job)
	if err != nil {
		log.Fatalf("Fetch %s", err)
	}

	users := make([]TestUserData, 0)

	err = fetchedData.GetDataWithStruct(&users)
	if err != nil {
		log.Fatal(err)
	}

	for _, user := range users {
		fmt.Printf("%d %s %s\n", user.Id, user.Name, user.Email)
	}
}
Similar Resources

This is an example of a keep-it-simple directory layout for Go projects that was created using DDD principles, please copy and share if you like it.

DDD Go Template This project was created to illustrate a great architectural structure I developed together with @fabiorodrigues in the period I was w

Dec 5, 2022

Repository for COMP 429 Programming Assignment# 1 - A simple chat application, by Sabra Bilodeau.

Chatty COMP 429 Programming Assignment 1 A Chat Application for Remote Message Exchange by Sabra Bilodeau Getting Started with Chatty Building the Pro

Nov 28, 2021

Simple first method GRPC on GO

Simple first method GRPC on GO

Dec 10, 2021

Simple Notifier/Listener utility package to pass around messages in-memory

Simple Observer (go) A small simple library to use for sending around messages in-memory. It uses a notifier/listener style messaging. Installation go

Dec 7, 2021

Simple script for farm free books from PackPub.com

Bookgot BookGot is a simple boot for farm free books from PACKTPUB.COM #Install go get -u github.com/bregydoc/Bookgot Usage First import BookGot //..

Mar 26, 2019

Redash-go-sdk - An SDK for the programmatic management of Redash, in Go

Redash-go-sdk - An SDK for the programmatic management of Redash, in Go

Redash Go SDK An SDK for the programmatic management of Redash. The main compone

Dec 13, 2022

xyr is a very lightweight, simple and powerful data ETL platform that helps you to query available data sources using SQL.

xyr [WIP] xyr is a very lightweight, simple and powerful data ETL platform that helps you to query available data sources using SQL. Supported Drivers

Dec 2, 2022

Prometheus Common Data Exporter can parse JSON, XML, yaml or other format data from various sources (such as HTTP response message, local file, TCP response message and UDP response message) into Prometheus metric data.

Prometheus Common Data Exporter can parse JSON, XML, yaml or other format data from various sources (such as HTTP response message, local file, TCP response message and UDP response message) into Prometheus metric data.

Prometheus Common Data Exporter Prometheus Common Data Exporter 用于将多种来源(如http响应报文、本地文件、TCP响应报文、UDP响应报文)的Json、xml、yaml或其它格式的数据,解析为Prometheus metric数据。

May 18, 2022

Use SQL to instantly query resources, data sources and more from Terraform code. Open source CLI. No DB required.

Use SQL to instantly query resources, data sources and more from Terraform code. Open source CLI. No DB required.

Terraform Plugin for Steampipe Use SQL to query data from Terraform configuration files. Get started → Documentation: Table definitions & examples Com

Dec 22, 2022

Graphoscope: a solution to access multiple independent data sources from a common UI and show data relations as a graph

Graphoscope: a solution to access multiple independent data sources from a common UI and show data relations as a graph

Graphoscope A solution to access multiple independent data sources from a common UI and show data relations as a graph: Contains a list of by default

May 26, 2022

Cfginterpolator is an interpolate library in golang allowing to include data from external sources in your configuration

cfginterpolator cfginterpolator is an interpolate library in golang allowing to include data from external sources in your configuration cfginterpolat

Dec 14, 2021

A library for the MIGP (Might I Get Pwned) protocolA library for the MIGP (Might I Get Pwned) protocol

MIGP library This contains a library for the MIGP (Might I Get Pwned) protocol. MIGP can be used to build privacy-preserving compromised credential ch

Dec 3, 2022

The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.

The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.

The open-source platform for monitoring and observability. Grafana allows you to query, visualize, alert on and understand your metrics no matter wher

Jan 3, 2023

sq is a command line tool that provides jq-style access to structured data sources such as SQL databases, or document formats like CSV or Excel.

sq: swiss-army knife for data sq is a command line tool that provides jq-style access to structured data sources such as SQL databases, or document fo

Jan 1, 2023

RuuviBridge - Utility to bridge RuuviTag data between various sources and consumers

RuuviBridge RuuviBridge is designed to act as a "data bridge" between various so

Nov 19, 2022

Mergestat - a command-line tool for running SQL queries on git repositories and related data sources

Mergestat - a command-line tool for running SQL queries on git repositories and related data sources

Query git repositories with SQL. Generate reports, perform status checks, analyze codebases. 🔍 📊

Dec 30, 2022

Harvit harvests data from different sources (e.g websites, APIs), converts and transforms it.

harvit Harvit harvests data from different sources (e.g websites, APIs), converts and transforms it. Contents harvit Contents Requirements Usage Examp

May 16, 2022

Redis-benchmark - Simple get, mget and pipelined get benchmark.

redis-benchmark Simple get, mget and pipelined get benchmark. Usage git clone https://github.com/Ali-A-A/redis-benchmark.git cd ./redis-benchmark dock

Dec 31, 2021

Know your customer library. The sources are OFAC, UK sanctions, Interpol, Wikidata, etc.

KYC/AML check The package provides a level of know your customer service for banking and other financial services. Note: They may have some missing re

Sep 21, 2022
Solving structy.net data structures & algorithms programming problems in Go (with Tests)

structy.net Solving structy.net data structures & algorithms programming problems in Go (with Tests) I. Introduction 000. hey programmer 001. max-valu

Oct 18, 2022
About An instrumented microservice in Go - it'll give you some Honeycomb data to play with.

Intro to Observability: OpenTelemetry in Go This application is here for you to try out tracing. It consists of a microservice that calls itself, so y

Dec 5, 2022
An experimental generic functional utility library inspired by Lodash

go-godash An experimental generic functional utility library inspired by Lodash Implemented functions Map Reduce Sum Filter Take TakeWhile Drop DropWh

May 31, 2022
Goro: A High-level Machine Learning Library for Go
Goro: A High-level Machine Learning Library for Go

Overview Goro is a high-level machine learning library for Go built on Gorgonia. It aims to have the same feel as Keras. Usage import ( . "github.

Nov 20, 2022
A library providing useful functional programming helpers for Go 1.18

Underscore underscore is a Go library providing useful functional programming helpers without extending any built-in objects. It is mostly a port from

Dec 29, 2022
Clarifai - Clarifai library for Golang

Clarifai Golang Library Library for our v1 API. Disclaimer This API client only

Sep 27, 2022
Go-openoffice - Go library for reading OpenOffice odf and ods files

go-openoffice A Go library for reading OpenOffice/LibreOffice .ods (and .odf) fi

Dec 16, 2022
Go-integrals - A numerical integration library in GoLang

Go Integrals About Go Integrals is an implementation of numerical integration al

Jan 19, 2022
A go wrapper around the rwkv.cpp library

AI without python (1) go-rwkv.cpp gowrkv.go is a wrapper around rwkv-cpp, which is an adaption of ggml.cpp. (1) Python required for training and conve

May 10, 2023
An open source programming language that makes it easy to build simple
An open source programming language that makes it easy to build simple

The Go Programming Language Go is an open source programming language that makes it easy to build simple, reliable, and efficient software. Gopher ima

Oct 15, 2021