这是indexloc提供的服务,不要输入任何密码
Skip to content
This repository was archived by the owner on Sep 11, 2018. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions graphql/manual/api-reference/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,12 @@ You can make the following types of requests using the GraphQL API:

Query <query>
Mutation <mutation>

PostgreSQL Types
--------------
You can refer the following to know about all PostgreSQL types in GraphQL Engine

.. toctree::
:maxdepth: 1

PostgreSQL Types <postgresql-types>
43 changes: 43 additions & 0 deletions graphql/manual/api-reference/pgtypes.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Name,Aliases,Description,GraphQL Engine Input Type
bigint,int8,signed eight-byte integer,Int_
bigserial,serial8,autoincrementing eight-byte integer,Int_
bit [ (n) ],,fixed-length bit string,Unsupported_
bit varying [ (n) ],varbit [ (n) ],variable-length bit string,Unsupported_
boolean,bool,logical Boolean (true/false),Bool_
box,,rectangular box on a plane,Unsupported_
bytea,,binary data (“byte array”),Unsupported_
character [ (n) ],char [ (n) ],fixed-length character string,Char_
character varying [ (n) ],varchar [ (n) ],variable-length character string,String_
cidr,,IPv4 or IPv6 network address, Unsupported_
circle,,circle on a plane,Unsupported_
date,,"calendar date (year, month, day)",Date_
double precision,float8,double precision floating-point number (8 bytes),Float_
inet,,IPv4 or IPv6 host address,Unsupported_
integer,"int, int4",signed four-byte integer,Int_
interval [ fields ] [ (p) ],,time span,Unsupported_
json,,textual JSON data,JSON_
jsonb,,"binary JSON data, decomposed",JSONB_
line,,infinite line on a plane,Unsupported_
lseg,,line segment on a plane, Unsupported_
macaddr,,MAC (Media Access Control) address, Unsupported_
macaddr8,,MAC (Media Access Control) address (EUI-64 format), Unsupported_
money,,currency amount,Unsupported_
"numeric [ (p, s) ]","decimal [ (p, s) ]",exact numeric of selectable precision, Numeric_
path,,geometric path on a plane,Unsupported_
pg_lsn,,PostgreSQL Log Sequence Number,Unsupported_
point,,geometric point on a plane,Unsupported_
polygon,,closed geometric path on a plane,Unsupported_
real,float4,single precision floating-point number (4 bytes),Float_
smallint,int2,signed two-byte integer,Int_
smallserial,serial2,autoincrementing two-byte integer,Int_
serial,serial4,autoincrementing four-byte integer,Int_
text,,variable-length character string,String_
time [ (p) ] [ without time zone ],,time of day (no time zone),Unsupported_
time [ (p) ] with time zone,timetz,"time of day, including time zone",Timetz_
timestamp [ (p) ] [ without time zone ],,date and time (no time zone),Unsupported_
timestamp [ (p) ] with time zone,timestamptz,"date and time, including time zone",Timestamptz_
tsquery,,text search query,Unsupported_
tsvector,,text search document,Unsupported_
txid_snapshot,,user-level transaction ID snapshot,Unsupported_
uuid,,universally unique identifier,Unsupported_
xml,,XML data,Unsupported_
274 changes: 274 additions & 0 deletions graphql/manual/api-reference/postgresql-types.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,274 @@
.. title:: API Reference - PostgreSQL Types

API Reference - PostgreSQL Types
==============================
List of PostgreSQL types supported by GraphQL Engine explicitly.

.. _table:

.. csv-table::
:file: pgtypes.csv
:widths: 10, 10, 30, 20
:header-rows: 1

.. _Int:

Int
---
GraphQL default scalar with name **Int**.

E.g.:

.. parsed-literal::
:class: haskell-pre

objects: [
{
id: 1,
int_col: 27
}
]

.. _Float:

Float
-----
GraphQL custom scalar type with name **float8**.

E.g.:

.. parsed-literal::
:class: haskell-pre

objects: [
{
id: 1,
float_col: 0.8
}
]

.. _Numeric:

Numeric
-------
GraphQL custom scalar type with name **numeric**.

E.g.:

.. parsed-literal::
:class: haskell-pre

objects: [
{
id: 1,
numeric_col: 0.00000008
}
]

.. _Bool:

Bool
----
GraphQL default Scalar with name **Boolean**. The **Boolean** scalar type represents ``true`` or ``false``.

E.g.:

.. parsed-literal::
:class: haskell-pre

objects: [
{
id: 1,
is_published: true
}
]

.. _Char:

Char
----
GraphQL custom scalar with name **character**. It is a ``String`` with single character.

E.g.:

.. parsed-literal::
:class: haskell-pre

objects: [
{
id: 1,
char_column: "a"
}
]


.. _String:

String
------
GraphQL default scalar with name **String**. The **String** scalar type represents textual data, represented as UTF-8 character sequences.
The String type is most often used by GraphQL to represent free-form human-readable text.

E.g.:

.. parsed-literal::
:class: haskell-pre

objects: [
{
id: 1,
name: "Raven"
}
]


.. _Date:

Date
----
GraphQL custom scalar with name **date**. Date (no time of day). Allowed values are yyyy-mm-dd

E.g.:

.. parsed-literal::
:class: haskell-pre

objects: [
{
id: 1,
date: "1996-03-15"
}
]

.. _Timetz:

Time with time zone
-------------------
Graphql custom scalar type with name **timetz**. Time of day only, with time zone. Allowed values should be of ISO8601 format.
Eg. 17:30:15Z, 17:30:15+05:30, 17:30:15.234890+05:30

E.g.:

.. parsed-literal::
:class: haskell-pre

objects: [
{
id: 1,
time: "17:30:15+05:30"
}
]

.. _Timestamptz:

Timestamp with time zone
------------------------
Graphql custom scalar type with name **timestamptz**. Both date and time, with time zone. Allowed values should be of ISO8601 format.
Eg. 2016-07-20T17:30:15Z, 2016-07-20T17:30:15+05:30, 2016-07-20T17:30:15.234890+05:30

E.g.:

.. parsed-literal::
:class: haskell-pre

objects: [
{
id: 1,
timestamptz_col: "2016-07-20T17:30:15+05:30"
}
]

.. _JSON:

JSON
----
GraphQL custom scalar type with name **json**. It is a stringified json value.

E.g.:

.. parsed-literal::
:class: haskell-pre

objects: [
{
id: 1,
json_col: "{ \"name\": \"raven\" }"
}
]

.. _JSONB:

JSONB
-----
GraphQL custom scalar type with name **jsonb**. Value should be given through a variable of type **jsonb**.

E.g.:

.. parsed-literal::
:class: haskell-pre

mutation insert_test($value : jsonb) {
insert_test(
objects: [
{
id: 1,
jsonb_col: $value
}
]
){
affected_rows
returning{
id
details
}
}
}

variable:-

.. code-block:: json

{
"value": {
"name": "raven"
}
}

.. _Unsupported:

Implicitly Supported types
--------------------------
All ``Unsupported`` types in above table_ are implicitly supported by GraphQL Engine. You've to provide value in **String**.


E.g.: For time without time zone type

In ISO 8601 format

.. parsed-literal::
:class: haskell-pre

objects: [
{
id: 1,
time_col: "04:05:06.789"
}
]

E.g.: For macaddr type

.. parsed-literal::
:class: haskell-pre

objects: [
{
id: 1,
macaddr_col: "08:00:2b:01:02:03"
}
]

.. Note::

You can learn more about PostgreSQL data types `here <https://www.postgresql.org/docs/current/static/datatype.html>`__