Class Index | File Index

Classes


Class KiiClause

Represents a KiiClause expression object
Defined in: KiiSDK.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Method Summary
Method Attributes Method Name and Description
<static>  
KiiClause.and(A)
Create a KiiClause with the AND operator concatenating multiple KiiClause objects
<static>  
KiiClause.equals(key, value)
Create an expression of the form (key == value)
<static>  
KiiClause.geoBox(key, northEast, southWest)
Create a clause of geo box.
<static>  
KiiClause.geoDistance(key, center, radius, putDistanceInto)
Create a clause of geo distance.
<static>  
KiiClause.greaterThan(key, value)
Create an expression of the form (key > value)
<static>  
KiiClause.greaterThanOrEqual(key, value)
Create an expression of the form (key >= value)
<static>  
KiiClause.hasField(key, fieldType)
Create an expression to returns all entities that have a specified field and type.
<static>  
KiiClause.inClause(key, values)
Create an expression of the form (key in values)
<static>  
KiiClause.lessThan(key, value)
Create an expression of the form (key < value)
<static>  
KiiClause.lessThanOrEqual(key, value)
Create an expression of the form (key <= value)
<static>  
KiiClause.not(clause)
Create a KiiClause with the NOT operator concatenating a KiiClause object

Note: Query performance will be worse as the number of objects in bucket increases, so we recommend you avoid the NOT clause if possible.
<static>  
KiiClause.notEquals(key, value)
Create an expression of the form (key != value)
<static>  
KiiClause.or(A)
Create a KiiClause with the OR operator concatenating multiple KiiClause objects

Note: Query performance will be worse as the number of objects in bucket increases, so we recommend you avoid the OR clause if possible.
<static>  
KiiClause.startsWith(key, value)
Create an expression of the form (key STARTS WITH value)
Class Detail
KiiClause()
Method Detail
<static> KiiClause.and(A)
Create a KiiClause with the AND operator concatenating multiple KiiClause objects
  KiiClause clause = KiiClause.and(clause1, clause2, clause3, . . .)
Parameters:
{List} A
variable-length list of KiiClause objects to concatenate

<static> KiiClause.equals(key, value)
Create an expression of the form (key == value)
Parameters:
{String} key
The key to compare
{Object} value
the value to compare

<static> {KiiClause} KiiClause.geoBox(key, northEast, southWest)
Create a clause of geo box. This clause inquires objects in the specified rectangle. Rectangle would be placed parallel to the equator with specified coordinates of the corner.
Parameters:
{String} key
Key to inquire which holds geo point.
{KiiGeoPoint} northEast
North-Eest corner of the rectangle.
{KiiGeoPoint} southWest
South-Wast corner of the rectangle.
Throws:
{String}
  • Specified key is not a string or is an empty string.
  • northEast or southWest is not a reference of KiiGeoPoint.
  • Returns:
    {KiiClause} KiiClause reference.

    <static> {KiiClause} KiiClause.geoDistance(key, center, radius, putDistanceInto)
    Create a clause of geo distance. This clause inquires objects in the specified circle.
              var putDistanceInto = "distanceFromCurrentLoc";
              var currentLoc = ..; // current location
              var clause = KiiClause.geoDistance("location", currentLoc, 4000, putDistanceInto);
              var query = KiiQuery.queryWithClause(clause);
              // Sort by distances by ascending order.(Optional, use only if you intend to retrieve the distances in a ascending order).
              var orderByKey = "_calculated." + putDistanceInto;
              query.sortByAsc(orderByKey);
              // Define the callbacks
              var bucket = Kii.bucketWithName("MyBucket");
              var queryCallback = {
                  success: function(queryPerformed, resultSet, nextQuery) {
                      // check the first object from resultSet.
                      var object = resultSet[0];
                      var point = object.get("location");
                      var distanceToMyLocation = object.get("_calculated")[putDistanceInto];
                  },
                  failure: function(queryPerformed, anErrorString) {
                      // do something with the error response
                  }
              };
              bucket.executeQuery(query, queryCallback);
    Parameters:
    {String} key
    Name of the key to inquire, which holds geo point.
    {KiiGeoPoint} center
    Geo point which specify center of the circle.
    {Number} radius
    Radius of the circle. unit is meter. value should be in range of ]0, 20000000]
    {String} putDistanceInto
    Used for retrieve distance from the center from the query result.Must match the pattern "^[a-zA-Z_][a-zA-Z0-9_]*$". If the specified value is null, query result will not contain the distance. Note: You can get the results in ascending order of distances from center. To do so, build the orderBy field by "_calculated.{specified value of putDistanceInto}" and pass it in KiiQuery#sortByAsc. Note that, descending order of distances is not supported. The unit of distance is meter.
    Throws:
    {String}
  • Specified key is not a string or an empty string.
  • center is not an object of KiiGeoPoint.
  • putDistanceInto is not a string or an empty string.
  • Returns:
    {KiiClause} KiiClaluse reference.

    <static> KiiClause.greaterThan(key, value)
    Create an expression of the form (key > value)
    Parameters:
    {String} key
    The key to compare
    {Object} value
    the value to compare

    <static> KiiClause.greaterThanOrEqual(key, value)
    Create an expression of the form (key >= value)
    Parameters:
    {String} key
    The key to compare
    {Object} value
    the value to compare

    <static> KiiClause.hasField(key, fieldType)
    Create an expression to returns all entities that have a specified field and type.
    Parameters:
    {String} key
    name of the specified field.
    {String} fieldType
    The type of the content of the field. The type of the content of the field must be provided, possible values are "STRING", "INTEGER", "DECIMAL" and "BOOLEAN".

    <static> KiiClause.inClause(key, values)
    Create an expression of the form (key in values)
    Parameters:
    {String} key
    The key to compare
    {Array} values
    to be compared with.

    <static> KiiClause.lessThan(key, value)
    Create an expression of the form (key < value)
    Parameters:
    {String} key
    The key to compare
    {Object} value
    the value to compare

    <static> KiiClause.lessThanOrEqual(key, value)
    Create an expression of the form (key <= value)
    Parameters:
    {String} key
    The key to compare
    {Object} value
    the value to compare

    <static> KiiClause.not(clause)
    Create a KiiClause with the NOT operator concatenating a KiiClause object

    Note: Query performance will be worse as the number of objects in bucket increases, so we recommend you avoid the NOT clause if possible.
    Parameters:
    {Object} clause
    KiiClause object to negate

    <static> KiiClause.notEquals(key, value)
    Create an expression of the form (key != value)
    Parameters:
    {String} key
    The key to compare
    {Object} value
    the value to compare

    <static> KiiClause.or(A)
    Create a KiiClause with the OR operator concatenating multiple KiiClause objects

    Note: Query performance will be worse as the number of objects in bucket increases, so we recommend you avoid the OR clause if possible.
      KiiClause clause = KiiClause.or(clause1, clause2, clause3, . . .)
    Parameters:
    {List} A
    variable-length list of KiiClause objects to concatenate

    <static> KiiClause.startsWith(key, value)
    Create an expression of the form (key STARTS WITH value)
    Parameters:
    {String} key
    The key to compare
    {Object} value
    the value to compare

    Documentation generated by JsDoc Toolkit 2.4.0 on Mon May 21 2018 05:13:32 GMT-0000 (UTC)