@terascope/data-types / data-type / DataType
Class: DataType
Defined in: data-types/src/data-type.ts:23
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
Constructor
new DataType(
config,typeName?,description?):DataType
Defined in: data-types/src/data-type.ts:91
Parameters
| Parameter | Type |
|---|---|
config | Partial<DataTypeConfig> |
typeName? | string |
description? | string |
Returns
DataType
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
description? | readonly | string | - | data-types/src/data-type.ts:25 |
fields | readonly | ReadonlyDataTypeFields | - | data-types/src/data-type.ts:26 |
groupedFields | readonly | GroupedFields | An object of base fields with their child fields | data-types/src/data-type.ts:29 |
name | readonly | string | - | data-types/src/data-type.ts:24 |
version | readonly | number | - | data-types/src/data-type.ts:27 |
Methods
toESMapping()
toESMapping(
__namedParameters):ESMapping
Defined in: data-types/src/data-type.ts:110
Convert the DataType to an elasticsearch mapping.
Parameters
| Parameter | Type |
|---|---|
__namedParameters | Partial<ESMappingOptions> |
Returns
ESMapping
toGraphQL()
toGraphQL(
args?,removeScalars?):string
Defined in: data-types/src/data-type.ts:190
Parameters
| Parameter | Type | Default value |
|---|---|---|
args? | GraphQLOptions | undefined |
removeScalars? | boolean | false |
Returns
string
toGraphQLTypes()
toGraphQLTypes(
args):GraphQLTypesResult
Defined in: data-types/src/data-type.ts:198
Parameters
| Parameter | Type |
|---|---|
args | GraphQLOptions |
Returns
toXlucene()
toXlucene():
xLuceneTypeConfig
Defined in: data-types/src/data-type.ts:272
Returns
xLuceneTypeConfig
mergeGraphQLDataTypes()
staticmergeGraphQLDataTypes(types,options):string
Defined in: data-types/src/data-type.ts:34
Merge multiple data types into one GraphQL schema, useful for removing duplicates
Parameters
| Parameter | Type |
|---|---|
types | DataType[] |
options | MergeGraphQLOptions |
Returns
string