Skip to content

SublimateQueryBuilder

mxcl edited this page Dec 15, 2020 · 8 revisions

SublimateQueryBuilder

public struct SublimateQueryBuilder<Model: FluentKit.Model>

Initializers

init(_:)

public init(_ kernel: QueryBuilder<Model>)

Properties

kernel

let kernel: QueryBuilder<Model>

Methods

join(_:on:method:)

@discardableResult @inlinable func join<Foreign, Local, Value>(_ foreign: Foreign.Type, on filter: JoinFilter<Foreign, Local, Value>, method: DatabaseQuery.Join.Method = .inner) -> Self where Foreign: Schema, Local: Schema

group(_:_:)

@discardableResult @inlinable func group(_ relation: DatabaseQuery.Filter.Relation = .and, _ closure: (QueryBuilder<Model>) throws -> ()) rethrows -> Self

filter(_:)

@discardableResult @inlinable func filter(_ filter: ModelValueFilter<Model>) -> Self

filter(_:_:_:)

@discardableResult @inlinable func filter<Field>(_ field: KeyPath<Model, Field>, _ method: DatabaseQuery.Filter.Method, _ value: Field.Value) -> Self where Field: QueryableProperty, Field.Model == Model

filter(_:_:)

@discardableResult @inlinable func filter<Joined>(_ schema: Joined.Type, _ filter: FluentKit.ModelValueFilter<Joined>) -> Self where Joined: FluentKit.Schema

all()

@inlinable func all() throws -> [Model]

limit(_:)

@inlinable func limit(_ count: Int) -> Self

offset(_:)

@inlinable func offset(_ count: Int) -> Self

unique()

@inlinable func unique() -> Self

chunk(max:closure:)

@inlinable func chunk(max: Int, closure: @escaping ([Result<Model, Error>]) -> ()) throws -> Void

first()

@inlinable func first() throws -> Model?

first(with:)

func first<With: FluentKit.Model>(with other: With.Type) throws -> (Model, With)?

first(with:_:)

func first<With: FluentKit.Model, And: FluentKit.Model>(with: With.Type, _ and: And.Type) throws -> (Model, With, And)?

first(or:file:line:)

func first(or _: CO.QueryOptions? = nil, file: String = #file, line: UInt = #line) throws -> Model

first(or:with:file:line:)

func first<With: FluentKit.Model>(or _: CO.QueryOptions, with other: With.Type, file: String = #file, line: UInt = #line) throws -> (Model, With)

exists()

@inlinable func exists() throws -> Bool

range(_:)

@inlinable func range(_ range: PartialRangeThrough<Int>) -> Self

delete()

@inlinable func delete() throws

with(_:)

@inlinable func with<Relation>(_ relationKey: KeyPath<Model, Relation>) -> Self where Relation: EagerLoadable, Relation.From == Model

sort(_:_:)

@inlinable func sort<Field>(_ field: KeyPath<Model, Field>, _ direction: DatabaseQuery.Sort.Direction = .ascending) -> Self where Field: QueryableProperty, Field.Model == Model

sort(_:_:)

@inlinable func sort(_ path: FieldKey, _ direction: DatabaseQuery.Sort.Direction = .ascending) -> Self

sort(_:_:)

@inlinable func sort(_ path: [FieldKey], _ direction: DatabaseQuery.Sort.Direction = .ascending) -> Self

sort(_:_:_:alias:)

@inlinable func sort<Joined, Field>(_ joined: Joined.Type, _ field: KeyPath<Joined, Field>, _ direction: DatabaseQuery.Sort.Direction = .ascending, alias: String? = nil) -> Self where Field: QueryableProperty, Field.Model == Joined, Joined: Schema

sort(_:_:_:alias:)

@inlinable func sort<Joined>(_ model: Joined.Type, _ path: FieldKey, _ direction: DatabaseQuery.Sort.Direction = .ascending, alias: String? = nil) -> Self where Joined: Schema

sort(_:_:_:alias:)

@inlinable func sort<Joined>(_ model: Joined.Type, _ path: [FieldKey], _ direction: DatabaseQuery.Sort.Direction = .ascending, alias: String? = nil) -> Self where Joined: Schema

sort(_:_:)

@inlinable func sort(_ field: DatabaseQuery.Field, _ direction: DatabaseQuery.Sort.Direction) -> Self

sort(_:)

@inlinable func sort(_ sort: DatabaseQuery.Sort) -> Self

count()

@inlinable func count() throws -> Int

count(_:)

@inlinable func count<Field>(_ key: KeyPath<Model, Field>) throws -> Int where Field: QueryableProperty, Field.Model == Model

sum(_:)

@inlinable func sum<Field>(_ key: KeyPath<Model, Field>) throws -> Field.Value? where Field: QueryableProperty, Field.Model == Model

sum(_:)

@inlinable func sum<Field>(_ key: KeyPath<Model, Field>) throws -> Field.Value where Field: QueryableProperty, Field.Value: OptionalType, Field.Model == Model

average(_:)

@inlinable func average<Field>(_ key: KeyPath<Model, Field>) throws -> Field.Value? where Field: QueryableProperty, Field.Model == Model

average(_:)

@inlinable func average<Field>(_ key: KeyPath<Model, Field>) throws -> Field.Value where Field: QueryableProperty, Field.Value: OptionalType, Field.Model == Model

min(_:)

@inlinable func min<Field>(_ key: KeyPath<Model, Field>) throws -> Field.Value? where Field: QueryableProperty, Field.Model == Model

min(_:)

@inlinable func min<Field>(_ key: KeyPath<Model, Field>) throws -> Field.Value where Field: QueryableProperty, Field.Value: OptionalType, Field.Model == Model

max(_:)

@inlinable func max<Field>(_ key: KeyPath<Model, Field>) throws -> Field.Value? where Field: QueryableProperty, Field.Model == Model

max(_:)

@inlinable func max<Field>(_ key: KeyPath<Model, Field>) throws -> Field.Value where Field: QueryableProperty, Field.Value: OptionalType, Field.Model == Model