functional-models
    Preparing search index...

    Function ForeignKeyProperty

    • A property that represents a foreign key to another model in a database. By default it is a "uuid" type, but if you want to use an arbitrary string, or an integer type you can set the dataType property. NOTE: auto is ignored in config.

      Type Parameters

      • TValue extends PrimaryKeyType
      • TModel extends Readonly<{ [s: string]: any }>

      Parameters

      Returns (
          | Readonly<
              {
                  createGetter: (
                      value: string,
                      modelData: TData,
                      modelInstance: ModelInstance<
                          Readonly<{ [s: string]: any }>,
                          object,
                          object,
                      >,
                  ) => ValueGetter<string, Readonly<{ [s: string]: any }>, object, object>;
                  getChoices: () => readonly ChoiceTypes[];
                  getConfig: () => object;
                  getConstantValue: () => string | undefined;
                  getDefaultValue: () => string | undefined;
                  getPropertyType: () => string;
                  getValidator: (
                      valueGetter: ValueGetter<
                          string,
                          Readonly<{ [s: string]: any }>,
                          object,
                          object,
                      >,
                  ) => PropertyValidator<Readonly<{ [s: string]: any }>>;
                  getZod: () => ZodType<string>;
              },
          >
          | Readonly<
              {
                  createGetter: (
                      value: number,
                      modelData: TData,
                      modelInstance: ModelInstance<
                          Readonly<{ [s: string]: any }>,
                          object,
                          object,
                      >,
                  ) => ValueGetter<number, Readonly<{ [s: string]: any }>, object, object>;
                  getChoices: () => readonly ChoiceTypes[];
                  getConfig: () => object;
                  getConstantValue: () => number | undefined;
                  getDefaultValue: () => number | undefined;
                  getPropertyType: () => string;
                  getValidator: (
                      valueGetter: ValueGetter<
                          number,
                          Readonly<{ [s: string]: any }>,
                          object,
                          object,
                      >,
                  ) => PropertyValidator<Readonly<{ [s: string]: any }>>;
                  getZod: () => ZodType<number>;
              },
          >
      ) & {
          getReferencedId: (instanceValues: TValue) => TValue;
          getReferencedModel: () => ModelType<TModel>;
      }