FluentKit ORM

repository·main·Indexed 42 days ago

https://github.com/vapor/fluent-kit

A type-safe, database-agnostic Object-Relational Mapper (ORM) for Swift that allows developers to define models and execute asynchronous queries using a consistent API.

Tokens
436
Snippets
2
Records
4
Agent score
4%

What's inside FluentKit

  1. Overview of FluentKit

    main

    FluentKit is an Object-Relational Mapper (ORM) for Swift. It enables developers to write type-safe, database-agnostic models and queries by leveraging Swift's type system. This abstraction allows you to interact with different database backends using a consistent, powerful API.

    let planets = try await Planet.query(on: database)
        .filter(\.$\type == .gasGiant)
        .sort(\.$\name)
        .with(\.$\star)
        .all()
  2. Perform type-safe queries with FluentKit

    main

    You can perform complex database queries using a fluent, type-safe API. FluentKit allows you to filter results, sort them, and eager-load related models (using .with()) in a single chain. Queries are typically executed against a database instance and are asynchronous.

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