Skip to content

MySQL UDF library for making HTTP connections written in Golang

Notifications You must be signed in to change notification settings

StirlingMarketingGroup/mysql-http

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MySQL HTTP

A small MySQL UDF library for making HTTP requests written in Golang.

Usage

http_touch

Makes an HTTP Get request to the given URL and returns nothing.

`http_touch` ( `URL` )
  • `URL`
    • The URL to request.

Examples

We can quickly build a test table of random numbers by running these queries

-- hit our test endpoint
select`http_touch`('http://localhost:48642/');

Dependencies

You will need Golang, which you can get from here https://golang.org/doc/install.

Debian / Ubuntu

sudo apt update
sudo apt install libmysqlclient-dev

Installing

You can find your MySQL plugin directory by running this MySQL query

select @@plugin_dir;

then replace /usr/lib/mysql/plugin below with your MySQL plugin directory.

cd ~ # or wherever you store your git projects
git clone https://github.com/StirlingMarketingGroup/mysql-http.git
cd mysql-http
go build -buildmode=c-shared -o mysql_http.so
sudo cp mysql_http.so /usr/lib/mysql/plugin/mysql_http.so # replace plugin dir here if needed

Enable the function in MySQL by running this MySQL query

create function`http_touch`returns int soname'mysql_http.so';

About

MySQL UDF library for making HTTP connections written in Golang

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages