Function useEntityAttributeConstraint

  • Retrieves the constraint object of the given type for the given attribute if it exists.

    Type Parameters

    • C extends AttributeConstraint

    • T extends "UniqueConstraint" | "SizeConstraint" | "RegexpConstraint" | "BoundaryConstraint" | "IntervalBoundConstraint" | "StaticVocabularyConstraint" | "FormatConstraint" | "RQLConstraint"

    Parameters

    • attributeName: string

      The name of the attribute to fetch constraints for

    • type: T

      The type of constraint to get

    Returns (C extends infer Constraint
        ? Constraint extends {
                type: T;
            }
            ? Constraint
            : never
        : never) | null

    The constraint object if it exists for the given attribute, null otherwise

    Throws

    Entity not initialized error if no schema is found.

    Could not find attribute error if the attribute does not exist in the schema

Generated using TypeDoc