Skip to content

Commit 7db4fb7

Browse files
committed
리드미 끝
1 parent c28960e commit 7db4fb7

File tree

1 file changed

+67
-19
lines changed

1 file changed

+67
-19
lines changed

README.md

Lines changed: 67 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# mysql_udf_http_golang
2+
[![MySQL UDF](https://img.shields.io/badge/MySQL-UDF-blue.svg)](https://dev.mysql.com/) [![MariaDB UDF](https://img.shields.io/badge/MariaDB-UDF-blue.svg)](https://mariadb.com/)
3+
24
[MySQL](https://dev.mysql.com/) or [MariaDB](https://mariadb.com/) UDF(User-Defined Functions) HTTP Client Plugin
35

46
Call RESTful API on query.
@@ -27,7 +29,7 @@ Build output is `http.so`, move file to `plugin_dir` path.
2729
if you don't know `plugin_dir` path.
2830
Command input this on MySQL, MariaDB connection.
2931

30-
```query
32+
```sql
3133
SHOW VARIABLES LIKE 'plugin_dir';
3234
```
3335

@@ -80,7 +82,7 @@ SELECT http_help();
8082

8183
- **Prototype**
8284
```sql
83-
SELECT http_get(url, option...);
85+
SELECT http_get(url, options...);
8486
```
8587

8688
- **Simple Request**
@@ -90,14 +92,12 @@ SELECT http_get('http://example.com');
9092
**Return**
9193
```javascript
9294
{
93-
"Body": String(HTML(Default), Base64, Hexdecimal)
95+
"Body" : String(HTML(Default), Base64, Hexdecimal)
9496
}
9597
```
9698

9799
- **Output Option**
98-
`-O outputType` Define kind of result.
99-
100-
- Kinds
100+
`-O {outputType}` Define kind of result.
101101
`PROTO`, `STATUS` or `STATUS_CODE`, `HEADER`, `BODY`(default), `FULL`
102102
`-O PROTO|STATUS|HEADER|BODY` same this `-O FULL`.
103103

@@ -107,23 +107,71 @@ SELECT http_get('http://example.com', '-O FULL');
107107
**Return**
108108
```javascript
109109
{
110-
"Proto": String(Http Version, HTTP/1.0, HTTP/1.1, HTTP/2.0),
111-
"Status": String(Status Code, 200 OK, 404 NOT FOUND),
112-
"Header": JSON(`{Key : Array, ...}`),
113-
"Body": String(HTML(Default), Base64, Hexdecimal)
110+
"Proto" : String(Http Version, HTTP/1.0, HTTP/1.1, HTTP/2.0),
111+
"Status" : String(Status Code, 200 OK, 404 NOT FOUND...),
112+
"Header" : JSON(`{Key : Array, ...}`),
113+
"Body" : String(HTML(Default), Base64, Hexdecimal)
114114
}
115115
```
116-
#
117-
#
118-
#
119-
#
120-
### writing... plz wait...
121-
### Add Soon
116+
- **Custom Header**
117+
Option param input `-H {key}:{value}`.
118+
```sql
119+
SELECT http_get('http://example.com', '-O FULL', '-H CustomKey:CustomValue', '-H Authorization:Bearer a1b2c3d4-123e-5678-9fgh-ijk098765432')
120+
```
121+
**Like this**
122+
```http
123+
GET / HTTP/1.1
124+
Host: example.com
125+
CustomKey: CustomValue
126+
Authorization: Bearer a1b2c3d4-123e-5678-9fgh-ijk098765432
127+
User-Agent: Go-http-client/1.1
128+
Accept-Encoding: gzip
129+
```
130+
122131
### - POST Method
132+
- **Prototype**
133+
```sql
134+
SELECT http_post(url, contentType, body, options...)
135+
```
136+
- **Simple Request(No Body)**
137+
```sql
138+
SELECT http_post('http://example.com', '', '');
139+
```
140+
- **Simple Request(Json Body)**
141+
```sql
142+
SELECT http_post('http://example.com', 'application/json', '{"Hello":"World"}');
143+
```
144+
**Like this**
145+
```http
146+
POST / HTTP/1.1
147+
Host: example.com
148+
Content-Type: application/json
149+
Content-Length: 17
150+
User-Agent: Go-http-client/1.1
151+
Accept-Encoding: gzip
152+
153+
154+
{"Hello":"World"}
155+
```
156+
### - Raw Method
157+
- **Prototype**
123158
```sql
124-
SELECT http_post();
159+
SELECT http_raw(method, url, body, options...)
125160
```
126-
161+
162+
- **PUT**
163+
```sql
164+
SELECT http_raw('PUT', url, body, options...)
165+
```
166+
- **PATCH**
167+
```sql
168+
SELECT http_raw('PATCH', url, body, options...)
169+
```
170+
- **DELETE**
171+
```sql
172+
SELECT http_raw('DELETE', url, body, options...)
173+
```
174+
127175
License
128176
---
129-
[`THE BEER-WARE LICENSE (Revision 42)`](http://en.wikipedia.org/wiki/Beerware)
177+
[`THE BEER-WARE LICENSE (Revision 42)`](http://en.wikipedia.org/wiki/Beerware)

0 commit comments

Comments
 (0)