QueryFunction

open class QueryFunction : ObjectBase

Represents a OData query function. Query functions are typically used within DataQuery.filter. QueryFunctionCall can be constructed using static calls on QueryFunction or, more conveniently, by chained calls on QueryValue.

Example using proxy classes (with QueryFunction static calls)

open func queryFunctionExample() throws -> Void {
    let service = self.service
    let query = DataQuery()
        .filter(QueryFunction.contains(QueryFunction.toLower(Customer.address),
            searchValue: StringValue.of("king")))
    let customers = try service.fetchCustomers(matching: query)
    self.showCustomers(customers)
}

Example using proxy classes (with QueryValue chained calls)

open func queryValueFunctionExample() throws -> Void {
    let service = self.service
    let query = DataQuery().filter(Customer.address.toLower().contains("king"))
    let customers = try service.fetchCustomers(matching: query)
    self.showCustomers(customers)
}
  • Function code.

    See also

    QueryFunctionCode.

    Declaration

    Swift

    final public var code: Int
  • Function name, e.g. OData name.

    Declaration

    Swift

    final public var name: String
  • Function method, e.g. target language method.

    Declaration

    Swift

    final public var method: String
  • Minimum arity (number of arguments).

    Declaration

    Swift

    final public var minArity: Int
  • Maximum arity (number of arguments).

    Declaration

    Swift

    final public var maxArity: Int
  • A map of predefined query functions.

    Declaration

    Swift

    public static let functionMap: QueryFunctionMap
  • Default initializer.

    Declaration

    Swift

    override public init()
  • Declaration

    Swift

    open class func asType(_ type: DataType, value: DataValue? = nil) -> QueryValue

    Parameters

    type

    A data type.

    value

    A data value, or nil to refer to the “current instance”.

    Return Value

    a deferred call of the OData ‘cast’ canonical function.

  • Declaration

    Swift

    open class func ceiling(_ value: DataValue) -> QueryValue

    Parameters

    value

    A number value.

    Return Value

    a deferred call of the OData ‘ceiling’ canonical function.

  • Declaration

    Swift

    open class func concat(_ left: DataValue, _ right: DataValue) -> QueryValue

    Parameters

    left

    Left string value.

    right

    Right string value.

    Return Value

    a deferred call of the OData ‘concat’ canonical function.

  • Declaration

    Swift

    open class func contains(_ value: DataValue, searchValue: DataValue) -> QueryFilter

    Parameters

    value

    A string value.

    searchValue

    To search for in value.

    Return Value

    a deferred call of the OData ‘contains’ canonical function.

  • Declaration

    Swift

    open class func custom(name: String, arguments: DataValueList) -> QueryValue

    Parameters

    name

    Custom function name.

    arguments

    Custom function arguments.

    Return Value

    a deferred call of a custom function.

  • Declaration

    Swift

    open class func date(_ value: DataValue) -> QueryValue

    Parameters

    value

    A value with date components.

    Return Value

    a deferred call of the OData ‘date’ canonical function.

  • Declaration

    Swift

    open class func day(_ value: DataValue) -> QueryValue

    Parameters

    value

    A value with date components.

    Return Value

    a deferred call of the OData ‘day’ canonical function.

  • Declaration

    Swift

    open class func endsWith(_ value: DataValue, suffix: DataValue) -> QueryFilter

    Parameters

    value

    A string value.

    suffix

    Suffix to check for in value.

    Return Value

    a deferred call of the OData ‘endswith’ canonical function.

  • Declaration

    Swift

    open class func floor(_ value: DataValue) -> QueryValue

    Parameters

    value

    A number value.

    Return Value

    a deferred call of the OData ‘floor’ canonical function.

  • Lookup a query function by code.

    See also

    constants.

    Declaration

    Swift

    open class func forCode(_ code: Int) -> QueryFunction

    Parameters

    code

    Function code.

    Return Value

    Query function.

  • Lookup a query function by name.

    Throws

    DataQueryException if name is not the name of a known query function.

    Declaration

    Swift

    open class func forName(_ name: String) throws -> QueryFunction

    Parameters

    name

    Function name.

    Return Value

    Query function.

  • Declaration

    Swift

    open class func fractionalSeconds(_ value: DataValue) -> QueryValue

    Parameters

    value

    A value with time components.

    Return Value

    a deferred call of the OData ‘fractionalseconds’ canonical function.

  • Declaration

    Swift

    open class func geoDistance(from: DataValue, to: DataValue) -> QueryValue

    Parameters

    from

    A starting point.

    to

    An ending point.

    Return Value

    a deferred call of the OData ‘geo.distance’ canonical function.

  • Declaration

    Swift

    open class func geoIntersects(point: DataValue, polygon: DataValue) -> QueryFilter

    Parameters

    point

    A point.

    polygon

    A polygon.

    Return Value

    a deferred call of the OData ‘geo.intersects’ canonical function.

  • Declaration

    Swift

    open class func geoLength(_ value: DataValue) -> QueryValue

    Parameters

    value

    A line string or polygon.

    Return Value

    a deferred call of the OData ‘geo.length’ canonical function.

  • Declaration

    Swift

    open class func hour(_ value: DataValue) -> QueryValue

    Parameters

    value

    A value with time components.

    Return Value

    a deferred call of the OData ‘hour’ canonical function.

  • Declaration

    Swift

    open class func indexOf(_ value: DataValue, searchValue: DataValue) -> QueryValue

    Parameters

    value

    A string value.

    searchValue

    To search for in value.

    Return Value

    a deferred call of the OData ‘indexof’ canonical function.

  • Declaration

    Swift

    open class func isType(_ type: DataType, value: DataValue? = nil) -> QueryFilter

    Parameters

    type

    A data type.

    value

    A data value, or nil to refer to the “current instance”.

    Return Value

    a deferred call of the OData ‘isof’ canonical function.

  • Declaration

    Swift

    open class func length(_ value: DataValue) -> QueryValue

    Parameters

    value

    A string value.

    Return Value

    a deferred call of the OData ‘length’ canonical function.

  • Declaration

    Swift

    open class func maxDateTime() -> QueryValue

    Return Value

    a deferred call of the OData ‘maxdatetime’ canonical function.

  • Declaration

    Swift

    open class func minDateTime() -> QueryValue

    Return Value

    a deferred call of the OData ‘mindatetime’ canonical function.

  • Declaration

    Swift

    open class func minute(_ value: DataValue) -> QueryValue

    Parameters

    value

    A value with time components.

    Return Value

    a deferred call of the OData ‘minute’ canonical function.

  • Declaration

    Swift

    open class func month(_ value: DataValue) -> QueryValue

    Parameters

    value

    A value with date components.

    Return Value

    a deferred call of the OData ‘month’ canonical function.

  • Declaration

    Swift

    open class func now() -> QueryValue

    Return Value

    a deferred call of the OData ‘now’ canonical function.

  • Declaration

    Swift

    open class func round(_ value: DataValue) -> QueryValue

    Parameters

    value

    A number value.

    Return Value

    a deferred call of the OData ‘round’ canonical function.

  • Declaration

    Swift

    open class func second(_ value: DataValue) -> QueryValue

    Parameters

    value

    A value with time components.

    Return Value

    a deferred call of the OData ‘second’ canonical function.

  • Declaration

    Swift

    open class func startsWith(_ value: DataValue, prefix: DataValue) -> QueryFilter

    Parameters

    value

    A string value.

    prefix

    Prefix to check for in value.

    Return Value

    a deferred call of the OData ‘startswith’ canonical function.

  • Declaration

    Swift

    open class func substring(_ value: DataValue, start: DataValue, length: DataValue? = nil) -> QueryValue

    Parameters

    value

    A string value.

    start

    A starting index.

    length

    A substring length.

    Return Value

    a deferred call of the OData ‘substring’ canonical function.

  • Declaration

    Swift

    open class func time(_ value: DataValue) -> QueryValue

    Parameters

    value

    A value with time components.

    Return Value

    a deferred call of the OData ‘time’ canonical function.

  • Declaration

    Swift

    open class func toLower(_ value: DataValue) -> QueryValue

    Parameters

    value

    A string value.

    Return Value

    a deferred call of the OData ‘tolower’ canonical function.

  • Declaration

    Swift

    override open func toString() -> String

    Return Value

    A string representation of this object.

  • Declaration

    Swift

    open class func toUpper(_ value: DataValue) -> QueryValue

    Parameters

    value

    A string value.

    Return Value

    a deferred call of the OData ‘toUpper’ canonical function.

  • Declaration

    Swift

    open class func totalOffsetMinutes(_ value: DataValue) -> QueryValue

    Parameters

    value

    A value with time components.

    Return Value

    a deferred call of the OData ‘totaloffsetminutes’ canonical function.

  • Declaration

    Swift

    open class func trim(_ value: DataValue) -> QueryValue

    Parameters

    value

    A string value.

    Return Value

    a deferred call of the OData ‘trim’ canonical function.

  • Declaration

    Swift

    open class func year(_ value: DataValue) -> QueryValue

    Parameters

    value

    A value with date components.

    Return Value

    a deferred call of the OData ‘year’ canonical function.