Skip to contents

A field in a registry.

Active bindings

type

(character(1))
The type of the field.

through

(list() or NULL)
The through value of the field.

field_name

(character(1))
The field name.

registry_name

(character(1))
The registry name.

column_name

(character(1))
The column name.

module_name

(character(1))
The module name.

is_link_table

(logical(1))
Whether the field is a link table.

relation_type

(character(1) or NULL)
The relation type. Can be one of: "one-to-many", "many-to-one", "many-to-many".

related_field_name

(character(1) or NULL)
The related field name.

related_registry_name

(character(1) or NULL)
The related registry name.

related_module_name

(character(1) or NULL)
The related module name.

Methods


Method new()

Creates an instance of this R6 class. This class should not be instantiated directly, but rather by connecting to a LaminDB instance using the connect() function.

Usage

Field$new(
  type,
  through,
  field_name,
  registry_name,
  column_name,
  module_name,
  is_link_table,
  relation_type,
  related_field_name,
  related_registry_name,
  related_module_name
)

Arguments

type

The type of the field. Can be one of: "IntegerField", "JSONField", "OneToOneField", "SmallIntegerField", "BigIntegerField", "AutoField", "BigAutoField", "BooleanField", "TextField", "DateTimeField", "ManyToManyField", "CharField", "ForeignKey"

through

If the relation type is one-to-many, many-to-one, or many-to-many, This value will be a named list with keys 'left_key', 'right_key', 'link_table_name'.

field_name

The name of the field in the registry. Example: "name".

registry_name

The name of the registry. Example: "user".

column_name

The name of the column in the database. Example: "name".

module_name

The name of the module. Example: "core".

is_link_table

Whether the field is a link table.

relation_type

The type of relation. Can be NULL or one of: "one-to-one", "many-to-one", "many-to-many".

related_field_name

The name of the related field in the related registry. Example: "name".

related_registry_name

The name of the related registry. Example: "user".

related_module_name

The name of the related module. Example: "core".


Method print()

Print a Field

Usage

Field$print(style = TRUE)

Arguments

style

Logical, whether the output is styled using ANSI codes


Method to_string()

Create a string representation of a Field

Usage

Field$to_string(style = FALSE)

Arguments

style

Logical, whether the output is styled using ANSI codes

Returns

A cli::cli_ansi_string if style = TRUE or a character vector