GQLScalar

GQLScalar

new GQLScalar()

GQLScalars are how one might construct their own types for use within
GraphQL with Lattice. The descriptions below should be sufficient to get
you started with your own types. The SDL for a Scalar looks like this:

scalar MyType
Source:
GQLScalar.js, line 34

Members

(static, constant) ⬇︎⠀GQL_TYPE

Determines the default type targeted by this GQLBase class. Any
type will technically be valid but only will trigger special behavior

Source:
GQLScalar.js, line 155

Methods

(static) serialize(value) → {mixed}

The serialize method is called by GraphQL when the type is going to
be sent to the client. Since values on the client are in the form of
JSON, the return value of serialize can be any valid JSON value;
String, Number, Array, Object, etc...

Parameters:
Name Type Description
value mixed

the value that needs to be converted for the
downstream JSON client side result.

Returns:
( mixed )

any valid JSON value

Source:
GQLScalar.js, line 57