ORM
  • Introduction
  • Basics of Usage
    • Connecting to the Database
    • Creating a Model
    • Simple Queries
  • Configuration
  • Core Features
    • Models
    • CRUD Operations (Create, Read, Update, Delete): examples
    • Relationships
    • Transactions
  • Advanced Usage
    • Data Definition Language
    • Indexes
    • Triggers
    • Caching
  • Examples and templates
  • Security
    • Query parameterization and protection against SQL injections
    • Logging
    • Monitoring
    • Sanitization
  • ORM-CLI
    • Installing
    • Commands and usage
  • System architecture and implementation
    • Support of various databases
      • Implementation using a pattern strategy
      • Implementation using generics
      • Implementation using metaprogramming
    • Decorators
    • Migrations
      • Assignment of id in Tables and Columns
      • Assigning IDs to indexes and triggers
      • Working with migrations in ORM-CLI
        • Implementation of a pattern command for migration
    • QueryBuilder
    • Caching
    • File structure
  • API
    • Decorators
      • Column
      • ComputedColumn
      • Index
      • ForeignKey
      • PrimaryGeneratedColumn
      • Relations
      • Table
      • Trigger
      • Types decorators
        • Integer
        • Numeric
        • Float
        • Boolean
        • String
    • DDL
    • QueryBuilder
    • Additional API
Powered by GitBook
On this page
  1. API
  2. Decorators

ComputedColumn

ComputedColumn Decorator

The ComputedColumn decorator is used to define computed columns in the database. It takes a ComputedColumnDecoratorInterface object as a parameter, which contains settings for the computed column.

Parameters of ComputedColumnDecoratorInterface

  • name:

    • Type: string

    • Description: Specifies the name of the computed column in the database. If not provided, the property name in the class is used.

  • dataType:

    • Type: PostgresqlDataTypes | MysqlDataTypes

    • Description: Specifies the data type for the computed column depending on the database type (PostgreSQL or MySQL).

  • calculate:

    • Type: string

    • Description: Defines the formula or expression to be used for computing the column's value. The formula is written as a SQL query.

PreviousColumnNextIndex

Last updated 9 months ago