ModelField

public struct ModelField

Warning

Although this has public access, it is intended for internal & codegen use and should not be used directly by host applications. The behavior of this may change without warning.
  • Declaration

    Swift

    public let name: ModelFieldName
  • Declaration

    Swift

    public let type: ModelFieldType
  • Declaration

    Swift

    public let isRequired: Bool
  • Declaration

    Swift

    public let isReadOnly: Bool
  • Declaration

    Swift

    public let isArray: Bool
  • Declaration

    Swift

    public let attributes: [ModelFieldAttribute]
  • Declaration

    Swift

    public let association: ModelAssociation?
  • Declaration

    Swift

    public let authRules: AuthRules
  • Declaration

    Swift

    public var isPrimaryKey: Bool { get }
  • Declaration

    Swift

    public init(name: String,
                type: ModelFieldType,
                isRequired: Bool = false,
                isReadOnly: Bool = false,
                isArray: Bool = false,
                attributes: [ModelFieldAttribute] = [],
                association: ModelAssociation? = nil,
                authRules: AuthRules = [])
  • Warning

    Although this has public access, it is intended for internal & codegen use and should not be used directly by host applications. The behavior of this may change without warning. Though it is not used by host application making any change to these public types should be backward compatible, otherwise it will be a breaking change.

    Declaration

    Swift

    public var hasAssociation: Bool { get }
  • If the field represents an association returns the Model.Type.

    Seealso

    ModelFieldType

    Seealso

    ModelFieldAssociation

    Warning

    Although this has public access, it is intended for internal & codegen use and should not be used directly by host applications. The behavior of this may change without warning. Though it is not used by host application making any change to these public types should be backward compatible, otherwise it will be a breaking change.

    Declaration

    Swift

    @available(*, deprecated, message: "Use of associated model type is deprecated, use `associatedModelName` instead.")
    public var associatedModel: Model.Type? { get }
  • If the field represents an association returns the ModelName.

    Seealso

    ModelFieldType

    Seealso

    ModelFieldAssociation

    Warning

    Although this has public access, it is intended for internal & codegen use and should not be used directly by host applications. The behavior of this may change without warning. Though it is not used by host application making any change to these public types should be backward compatible, otherwise it will be a breaking change.

    Declaration

    Swift

    public var associatedModelName: ModelName? { get }
  • This calls associatedModelName but enforces that the field must represent an association. In case the field type is not a Model it calls preconditionFailure. Consumers should fix their models in order to recover from it, since associations are only possible between two Model.

    Note

    as a maintainer, make sure you use this computed property only when context allows (i.e. the field is a valid relationship, such as foreign keys).

    Warning

    Although this has public access, it is intended for internal & codegen use and should not be used directly by host applications. The behavior of this may change without warning. Though it is not used by host application making any change to these public types should be backward compatible, otherwise it will be a breaking change.

    Declaration

    Swift

    @available(*, deprecated, message: "Use of requiredAssociatedModel with Model.Type is deprecated, use `requiredAssociatedModelName`\nthat return ModelName instead.")
    public var requiredAssociatedModel: Model.Type { get }
  • This calls associatedModelName but enforces that the field must represent an association. In case the field type is not a Model it calls preconditionFailure. Consumers should fix their models in order to recover from it, since associations are only possible between two Model.

    Note

    as a maintainer, make sure you use this computed property only when context allows (i.e. the field is a valid relationship, such as foreign keys).

    Warning

    Although this has public access, it is intended for internal & codegen use and should not be used directly by host applications. The behavior of this may change without warning. Though it is not used by host application making any change to these public types should be backward compatible, otherwise it will be a breaking change.

    Declaration

    Swift

    public var requiredAssociatedModelName: ModelName { get }
  • Warning

    Although this has public access, it is intended for internal & codegen use and should not be used directly by host applications. The behavior of this may change without warning. Though it is not used by host application making any change to these public types should be backward compatible, otherwise it will be a breaking change.

    Declaration

    Swift

    public var isAssociationOwner: Bool { get }
  • Warning

    Although this has public access, it is intended for internal & codegen use and should not be used directly by host applications. The behavior of this may change without warning. Though it is not used by host application making any change to these public types should be backward compatible, otherwise it will be a breaking change.

    Declaration

    Swift

    public var associatedField: ModelField? { get }
  • Warning

    Although this has public access, it is intended for internal & codegen use and should not be used directly by host applications. The behavior of this may change without warning. Though it is not used by host application making any change to these public types should be backward compatible, otherwise it will be a breaking change.

    Declaration

    Swift

    public var isOneToOne: Bool { get }
  • Warning

    Although this has public access, it is intended for internal & codegen use and should not be used directly by host applications. The behavior of this may change without warning. Though it is not used by host application making any change to these public types should be backward compatible, otherwise it will be a breaking change.

    Declaration

    Swift

    public var isOneToMany: Bool { get }
  • Warning

    Although this has public access, it is intended for internal & codegen use and should not be used directly by host applications. The behavior of this may change without warning. Though it is not used by host application making any change to these public types should be backward compatible, otherwise it will be a breaking change.

    Declaration

    Swift

    public var isManyToOne: Bool { get }
  • Warning

    Although this has public access, it is intended for internal & codegen use and should not be used directly by host applications. The behavior of this may change without warning. Though it is not used by host application making any change to these public types should be backward compatible, otherwise it will be a breaking change.

    Declaration

    Swift

    @available(*, deprecated, message: "Use `embeddedType` is deprecated, use `embeddedTypeSchema` instead.")
    public var embeddedType: Embeddable.Type? { get }
  • Warning

    Although this has public access, it is intended for internal & codegen use and should not be used directly by host applications. The behavior of this may change without warning. Though it is not used by host application making any change to these public types should be backward compatible, otherwise it will be a breaking change.

    Declaration

    Swift

    public var embeddedTypeSchema: ModelSchema? { get }
  • Warning

    Although this has public access, it is intended for internal & codegen use and should not be used directly by host applications. The behavior of this may change without warning. Though it is not used by host application making any change to these public types should be backward compatible, otherwise it will be a breaking change.

    Declaration

    Swift

    public var isEmbeddedType: Bool { get }