Skip to main content

@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

new DataType()

new DataType(config, typeName?, description?): DataType

Defined in: data-types/src/data-type.ts:91

Parameters

ParameterType
configPartial<DataTypeConfig>
typeName?string
description?string

Returns

DataType

Properties

PropertyModifierTypeDescriptionDefined in
description?readonlystring-data-types/src/data-type.ts:25
fieldsreadonlyReadonlyDataTypeFields-data-types/src/data-type.ts:26
groupedFieldsreadonlyGroupedFieldsAn object of base fields with their child fieldsdata-types/src/data-type.ts:29
namereadonlystring-data-types/src/data-type.ts:24
versionreadonlynumber-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

ParameterType
__namedParametersPartial<ESMappingOptions>

Returns

ESMapping


toGraphQL()

toGraphQL(args?, removeScalars?): string

Defined in: data-types/src/data-type.ts:183

Parameters

ParameterTypeDefault value
args?GraphQLOptionsundefined
removeScalars?booleanfalse

Returns

string


toGraphQLTypes()

toGraphQLTypes(args): GraphQLTypesResult

Defined in: data-types/src/data-type.ts:191

Parameters

ParameterType
argsGraphQLOptions

Returns

GraphQLTypesResult


toXlucene()

toXlucene(): xLuceneTypeConfig

Defined in: data-types/src/data-type.ts:265

Returns

xLuceneTypeConfig


mergeGraphQLDataTypes()

static mergeGraphQLDataTypes(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

ParameterType
typesDataType[]
optionsMergeGraphQLOptions

Returns

string