Skip to content

prest/adapter-mysql

Repository files navigation

MySQL Adapter to pRest project https://postgres.rest/

Build Status

  • Not Implemented
  • Implemented

[-] Not Applicable

Select - GET

Select operations over a TABLE

  • /DATABASE/SCHEMA/TABLE (show all rows, find by database and table)
  • /DATABASE/SCHEMA/TABLE?_select=column (select statement by columns)
  • /DATABASE/SCHEMA/TABLE?_select=* (select all from TABLE)
  • /DATABASE/SCHEMA/TABLE?_count=* (use count function)
  • /DATABASE/SCHEMA/TABLE?_count=column (use count function)
  • /DATABASE/SCHEMA/TABLE?_page=2&_page_size=10 (pagination, page_size 10 by default)
  • /DATABASE/SCHEMA/TABLE?FIELD=VALUE (filter)
  • /DATABASE/SCHEMA/TABLE?_renderer=xml (JSON by default)

[-] /DATABASE/SCHEMA/TABLE?_select=column[array id] (select statement by array colum)

Operators

  • $eq
  • $gt
  • $gte
  • $lt
  • $lte
  • $ne
  • $in
  • $nin
  • $null
  • $notnull
  • $true
  • $nottrue
  • $false
  • $notfalse
  • $like
  • $ilike

Join

  • /DATABASE/SCHEMA/Table?_join=Type:Table2:Table.field:Operator:Table2.field

ORDER BY

  • /DATABASE/SCHEMA/TABLE?_order=fieldname (ASC)
  • /DATABASE/SCHEMA/TABLE?_order=-fieldname (DESC)
  • /DATABASE/SCHEMA/TABLE?_order=fieldname01,-fieldname02,fieldname03 (Multiple Orders)

GROUP BY

  • /DATABASE/SCHEMA/TABLE?_select=fieldname00,fieldname01&_groupby=fieldname01
  • /DATABASE/SCHEMA/TABLE/?_select=fieldname00,sum:fieldname01&_groupby=fieldname00 (SUM)
  • /DATABASE/SCHEMA/TABLE/?_select=fieldname00,avg:fieldname01&_groupby=fieldname00 (AVG)
  • /DATABASE/SCHEMA/TABLE/?_select=fieldname00,max:fieldname01&_groupby=fieldname00 (MAX)
  • /DATABASE/SCHEMA/TABLE/?_select=fieldname00,min:fieldname01&_groupby=fieldname00 (MIN)
  • /DATABASE/SCHEMA/TABLE/?_select=fieldname00,stddev:fieldname01&_groupby=fieldname00 (STDDEV)
  • /DATABASE/SCHEMA/TABLE/?_select=fieldname00,variance:fieldname01&_groupby=fieldname00 (VARIANCE)
  • /DATABASE/SCHEMA/TABLE/?_groupby=fieldname->>having:GROUPFUNC:FIELDNAME:CONDITION:VALUE_CONDITION (HAVING)

[-] /DATABASE/SCHEMA/TABLE/?_select=fieldname00,median:fieldname01&_groupby=fieldname00 (MEDIAN)

Select operations over a VIEW

  • /DATABASE/SCHEMA/TABLE (show all rows, find by database and VIEW)
  • /DATABASE/SCHEMA/VIEW?_select=column (select statement by columns in VIEW)
  • /DATABASE/SCHEMA/VIEW?_select=* (select all from VIEW)
  • /DATABASE/SCHEMA/VIEW?_count=* (use count function)
  • /DATABASE/SCHEMA/VIEW?_count=column (use count function)
  • /DATABASE/SCHEMA/VIEW?_page=2&_page_size=10 (pagination, page_size 10 by default)
  • /DATABASE/SCHEMA/VIEW?FIELD=VALUE (filter)
  • /DATABASE/SCHEMA/VIEW?_renderer=xml (JSON by default)

Database structure

  • /databases (show all databases)
  • /databases?_count=* (count all databases)
  • /databases?_renderer=xml (JSON by default)
  • /schemas (show all schemas)
  • /schemas?_count=* (count all schemas)
  • /schemas?_renderer=xml (JSON by default)
  • /tables (show all tables)
  • /tables?_renderer=xml (JSON by default)
  • /DATABASE/SCHEMA (show all tables, find by schema)
  • /DATABASE/SCHEMA?_renderer=xml (JSON by default)

Insert - POST

  • /DATABASE/SCHEMA/TABLE
{
    "FIELD1": "string value",
    "FIELD2": 1234567890
}

Update - PATCH/PUT

  • /DATABASE/SCHEMA/TABLE?FIELD1=xyz
{
    "FIELD1": "string value",
    "FIELD2": 1234567890
}

Delete - DELETE

  • /DATABASE/SCHEMA/TABLE?FIELD1=xyz

Releases

No releases published

Packages

No packages published