Skip to main content

@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

ParameterType
configPartial<DataTypeConfig>
typeName?string
description?string

Returns

DataType

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

ParameterType
__namedParametersPartial<ESMappingOptions>

Returns

ESMapping

Source

data-types/src/data-type.ts:110


toGraphQL()

toGraphQL(args?, removeScalars?): string

Parameters

ParameterTypeDefault value
args?GraphQLOptionsundefined
removeScalars?booleanfalse

Returns

string

Source

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


toGraphQLTypes()

toGraphQLTypes(args): GraphQLTypesResult

Parameters

ParameterType
argsGraphQLOptions

Returns

GraphQLTypesResult

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

ParameterType
typesDataType[]
optionsMergeGraphQLOptions

Returns

string

Source

data-types/src/data-type.ts:34