scootpl / sqlreq

SQLReq is a wrapper around standard Go net/http client. You can execute REST requests using SQL-like syntax.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SQLReq

Go Reference Go Report Card

SQLReq is a wrapper around standard Go net/http client. You can execute REST requests using SQL-like syntax.

Quick Start

import "github.com/scootpl/sqlreq"

xauth, status, err := sqlreq.SelectHEADER(`
    X-AUTH FROM http://example.com/api/init
    WHERE login = testlogin AND pass = testpass
    WITH POST`)
token := "12345678"

payload := Msg{
    Message: "test",
}

body, status, err := sqlreq.SelectBODY(`
    FROM http://example.com/api/status
    WHERE HEADER x-auth = %s AND
    PAYLOAD = ?
    WITH POST`, token, &payload)
resp, status, err := sqlreq.SelectRESPONSE(`
    FROM http://example.com/api/status
    WHERE HEADER x-auth = '123456' AND
    message = 'test'
    WITH TIMEOUT 30
    WITH POST`)

See GoDoc for more details.

About

SQLReq is a wrapper around standard Go net/http client. You can execute REST requests using SQL-like syntax.

License:MIT License


Languages

Language:Go 100.0%