Skip to content

LiteralFieldBase

Wyatt Greenway edited this page Dec 13, 2022 · 6 revisions

class LiteralFieldBase extends LiteralBase 📜

LiteralFieldBase is the ancestor that all literals dealing with fields inherit from (which is nearly all literals). Its primary function is to enforce being provided fields when the child literal requires them, and to fetch those fields when the engine needs them.

See also: LiteralBase, Literal

method LiteralFieldBase::constructor(
    field: string | Field | LiteralBase,
    options?: object,
): LiteralFieldBase
📜

Construct a new field-based literal. The first argument should be a fully qualified field name, a Field instance, or another literal.

Arguments:

  • field: string | Field | LiteralBase

    The "field" that this literal is representing. If this is a string, then it is expected to be a fully qualified field name. If instead this is a Field, then that defines the field. Finally, this can also be another literal.

  • options?: object

    Connection, Literal, and operation specific options for this literal.

Return value: LiteralFieldBase


method LiteralFieldBase::getField(
    connection,
): Field
📜

Get the field represented by this literal.

Arguments:

  • connection

Return value: Field

The field that this literal is representing. This will be the field given to the constructor when the literal was first created.


method LiteralFieldBase::getFullyQualifiedFieldName(): string 📜

Get the fully qualified field name of the field that this literal is representing.

Return value: string

The fully qualified field name of the field this literal is representing. This would be the same field provided to the constructor when the literal was first created.

See also: ModelUtils.parseQualifiedName


static method LiteralFieldBase::isFieldRequired(): boolean 📜

This is provided so each child class can overload it. By default it returns true. However, any literal that inherits from this literal may override it to instead return false. The CountLiteral does exactly this for example.

Return value: boolean

Returns true by default, children can change the return value.


method LiteralFieldBase::valueOf() 📜

Return the raw field definition for the provided field.

See also: ModelUtils.parseQualifiedName



Clone this wiki locally