GQLEnum
GQLEnum
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:
- GQLEnum.js, line 112
Methods
(static) valueFor(value, deprecationReason, description) → {Object}
Shorthand method to generate a GraphQLEnumValueDefinition implementation
object. Use this for building and customizing your values
key/value
object in your child classes.
Parameters:
Name | Type | Description |
---|---|---|
value |
mixed | any nonstandard value you wish your enum to have |
deprecationReason |
String | an optional reason to deprecate an enum |
description |
String | a non Lattice standard way to write a comment |
Returns:
(
Object
)
an object that conforms to the GraphQLEnumValueDefinition
defined here http://graphql.org/graphql-js/type/#graphqlenumtype
- Source:
- GQLEnum.js, line 130
(static) ⬇︎⠀enums() → {Array.<Symbol>}
For easier use within JavaScript, the static enums method provides a
Symbol backed solution for each of the enums defined. Each Symbol
instance is wrapped in Object so as to allow some additional properties
to be written to it.
Returns:
(
Array.<Symbol>
)
an array of modified Symbols for each enum
variation defined.
- Source:
- GQLEnum.js, line 158
(static) ⬇︎⠀values() → {Object|Null}
Each instance of GQLEnum must specify a map of keys and values. If this
method returns null or is not defined, the value of the enum will match
the name of the enum as per the reference implementation.
Example:
static get values(): ?Object {
const { valueOf } = this;
return {
NAME: valueOf(value)
}
}
Returns:
(
Object
|
Null
)
an object mapping with each key mapping to an object
possessing at least a value field, which in turn maps to the desired value
- Source:
- GQLEnum.js, line 191