@terascope/data-types / data-type / DataType
Class: DataType
A DataType is used to define the structure of data with version support and can be converted to the following formats:
- Elasticsearch Mappings
- GraphQL Schemas
- xLucene
Constructors
new DataType()
new DataType(
config
,typeName
?,description
?):DataType
Parameters
Parameter | Type |
---|---|
config | Partial <DataTypeConfig > |
typeName ? | string |
description ? | string |
Returns
Source
data-types/src/data-type.ts:91
Properties
description?
optional
readonly
description:string
Source
data-types/src/data-type.ts:25
fields
readonly
fields:ReadonlyDataTypeFields
Source
data-types/src/data-type.ts:26
groupedFields
readonly
groupedFields:GroupedFields
An object of base fields with their child fields
Source
data-types/src/data-type.ts:29
name
readonly
name:string
Source
data-types/src/data-type.ts:24
version
readonly
version:number
Source
data-types/src/data-type.ts:27
Methods
toESMapping()
toESMapping(
__namedParameters
):ESMapping
Convert the DataType to an elasticsearch mapping.
Parameters
Parameter | Type |
---|---|
__namedParameters | Partial <ESMappingOptions > |
Returns
ESMapping
Source
data-types/src/data-type.ts:110
toGraphQL()
toGraphQL(
args
?,removeScalars
?):string
Parameters
Parameter | Type | Default value |
---|---|---|
args ? | GraphQLOptions | undefined |
removeScalars ? | boolean | false |
Returns
string
Source
data-types/src/data-type.ts:183
toGraphQLTypes()
toGraphQLTypes(
args
):GraphQLTypesResult
Parameters
Parameter | Type |
---|---|
args | GraphQLOptions |
Returns
Source
data-types/src/data-type.ts:191
toXlucene()
toXlucene():
xLuceneTypeConfig
Returns
xLuceneTypeConfig
Source
data-types/src/data-type.ts:265
mergeGraphQLDataTypes()
static
mergeGraphQLDataTypes(types
,options
):string
Merge multiple data types into one GraphQL schema, useful for removing duplicates
Parameters
Parameter | Type |
---|---|
types | DataType [] |
options | MergeGraphQLOptions |
Returns
string