Skip to content

Framework

FluentKit

FluentKit is an ORM framework for Swift. It allows you to write type safe, database agnostic models and queries. It takes advantage of Swift’s type system to provide a powerful, yet easy to use API.

Overview

An example query looks like:

let planets = try await Planet.query(on: database)
    .filter(\.$type == .gasGiant)
    .sort(\.$name)
    .with(\.$star)
    .all()

For more information, see the Fluent documentation.

Topics

Classes

Protocols

  • AnyAsyncModelResponder
  • AnyCodableProperty
    Marks a property as participating in the Fields protocol’s (defaulted) implementation of Decodable and Encodable. This allows the property to encode and decode to and from representations other than storage in a database, and to act as a container if it contains any additional properties which also wish to participate. Just about every property type is codable.
  • AnyDatabaseProperty
    Marks a property as having “database” capability - in other words, the property receives output from the results of read queries, provides input to write queries, and/or represents one or more model fields.
  • AnyEagerLoader
  • AnyModel
  • AnyModelMiddleware
  • AnyModelResponder
  • AnyOptionalType
  • AnyProperty
    The type-erased form of Property (see below). AnyProperty is used to access a model’s set of Fluent properties in a fully generic fashion (with a little help from runtime reflection). It is generally not meaningful to conform to this protocol without also at least conforming to Property.
  • AnyQueryAddressableProperty
    The type-erased form of QueryAddressableProperty (see below). Both protocols serve to bridge the gap between AnyQueryableProperty - which describes a property whose singular Value directly corresponds to the value stored in the database for that property - and property types whose Value is a derivative of or expansion upon an underlying queryable property. See the discussion of QueryAddressableProperty itself for additional details.
  • AnyQueryableProperty
    The type-erased form of QueryableProperty (see below). AnyQueryableProperty is used most often as a type-generic check for whether or not a given property represents an actual database field.
  • AsyncMigration
  • AsyncModelMiddleware
  • BooleanPropertyFormat
    A conversion between Bool and an arbitrary alternative storage format, usually a string.
  • Database
  • DatabaseConfiguration
  • DatabaseDriver
  • DatabaseError
  • DatabaseInput
    A helper type for working with properties which conform to the AnyDatabaseProperty protocol.
  • DatabaseOutput
  • EagerLoadBuilder
  • EagerLoadable
  • EagerLoader
  • Fields
    A type conforming to Fields is able to use FluentKit’s various property wrappers to declare name, type, and semantic information for individual properties corresponding to fields in a generic database storage system.
  • Migration
    Fluent’s Migration can handle database migrations, which can include adding new table, changing existing tables or adding seed data. These actions are executed only once.
  • Model
  • ModelAlias
    Describes a model whose schema has an alias.
  • ModelMiddleware
  • OptionalType
  • Property
    A property wrapper type conforms to this protocol to participate in Fluent’s system for interfacing between the various properties of a model and the representations of those properties in a database. All properties whose wrappers conform to this protocol appear in Fluent’s list of the data items which exist on a given model - whether those items contain actual data, such as a property representing a field in a database table, or are means to access other data, such a list of associated models on the far side of a many-to-many relation.
  • QueryAddressableProperty
    Marks a property as being “query addressable”, meaning that it is either itself queryable (QueryableProperty implies QueryAddressableProperty), or it represents some other single property that is queryable. This allows properties whose purpose is to wrap or otherwise stand in for other properties to be handled generically without the need to add special case exceptions for those property types.
  • QueryableProperty
    Marks a property as being “queryable”, meaning that it represents exactly one “real” database field (i.e. the database table will contain a “physical” field corresponding to the property, and it will be the only field that does so).
  • RandomGeneratable
  • Relation
    A protocol which designates a conforming type as representing a database relation of any kind. Intended for use only by FluentKit property wrappers.
  • Schema
  • TimestampFormat
  • TransactionControlDatabase
    Protocol for describing a database that allows fine-grained control over transcactions when you need more control than provided by Database/transaction(_:)-1x3ds

Structures

Operators

Enumerations

Extended Modules