QuerySortInput

public struct QuerySortInput
  • Declaration

    Swift

    public let inputs: [QuerySortBy]
  • Declaration

    Swift

    public init(_ inputs: [QuerySortBy])
  • Creates a QuerySortInput in an expressive way, enabling a short and developer friendly access to an instance of QuerySortInput. Simply by calling:

    • Amplify.Datastore.query(model.self, sort: .ascending(model.keys.id)) or
    • Amplify.Datastore.query(model.self, sort: .descending(model.keys.id)) or
    • Amplify.Datastore.query(model.self, sort: .by(.ascending(model.keys.id), .descending(model.keys.createdAt))

    Declaration

    Swift

    public static func by(_ inputs: QuerySortBy...) -> QuerySortInput

    Parameters

    inputs

    a variadic parameters that take uncertain number of QuerySortBy

    Return Value

    a new instance of QuerySortInput

  • Returns an ascending sort specifier for field

    Declaration

    Swift

    public static func ascending(_ field: CodingKey) -> QuerySortInput
  • Returns an descending sort specifier for field

    Declaration

    Swift

    public static func descending(_ field: CodingKey) -> QuerySortInput