Skip to content

Latest commit

 

History

History
42 lines (31 loc) · 1.07 KB

README.md

File metadata and controls

42 lines (31 loc) · 1.07 KB

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.