Show / Hide Table of Contents

Class ApplyFunctions

Functions to use within apply expressions. Minimal implementations provided for sanity checks, but this should be used primarily within expressions.

Inheritance
System.Object
ApplyFunctions
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Redis.OM.Aggregation.AggregationPredicates
Assembly: Redis.OM.dll
Syntax
public static class ApplyFunctions

Methods

| Improve this Doc View Source

Day(Int64)

Rounds the timestamp to midnight of the current day.

Declaration
public static long Day(long timestamp)
Parameters
Type Name Description
System.Int64 timestamp

the timestamp.

Returns
Type Description
System.Int64

the timestamp rounded to midnight.

| Improve this Doc View Source

DayOfMonth(Int64)

Gets the day of the month from the timestamp.

Declaration
public static long DayOfMonth(long timestamp)
Parameters
Type Name Description
System.Int64 timestamp

the timestamp.

Returns
Type Description
System.Int64

The day of the month.

| Improve this Doc View Source

DayOfWeek(Int64)

get's the day of the week from the timestamp.

Declaration
public static long DayOfWeek(long timestamp)
Parameters
Type Name Description
System.Int64 timestamp

the timestamp.

Returns
Type Description
System.Int64

the day of the week Sunday=0.

| Improve this Doc View Source

DayOfYear(Int64)

Gets the day of the year from the timestamp.

Declaration
public static long DayOfYear(long timestamp)
Parameters
Type Name Description
System.Int64 timestamp

the timestamp.

Returns
Type Description
System.Int64

The day of the year.

| Improve this Doc View Source

Exists(Object)

checks if the field exists on the object in redis.

Declaration
public static bool Exists(object field)
Parameters
Type Name Description
System.Object field

the field to check.

Returns
Type Description
System.Boolean

whether the field exists or not.

| Improve this Doc View Source

FormatTimestamp(Int64)

Formats the unix timestamp into a string timestamp.

Declaration
public static string FormatTimestamp(long timestamp)
Parameters
Type Name Description
System.Int64 timestamp

the timestamp.

Returns
Type Description
System.String

a formatted timestamp of %FT%TZ.

| Improve this Doc View Source

FormatTimestamp(Int64, String)

Formats the unix timestamp into a string timestamp.

Declaration
public static string FormatTimestamp(long timestamp, string format)
Parameters
Type Name Description
System.Int64 timestamp

the timestamp.

System.String format

The format to use strftime.

Returns
Type Description
System.String

a formatted timestamp of %FT%TZ.

| Improve this Doc View Source

GeoDistance(GeoLoc, GeoLoc)

calculates the distance between two points in meters.

Declaration
public static double GeoDistance(GeoLoc loc1, GeoLoc loc2)
Parameters
Type Name Description
GeoLoc loc1

first location.

GeoLoc loc2

second location.

Returns
Type Description
System.Double

the distance in meters.

| Improve this Doc View Source

GeoDistance(GeoLoc, Double, Double)

calculates the distance between two points in meters.

Declaration
public static double GeoDistance(GeoLoc loc1, double lon2, double lat2)
Parameters
Type Name Description
GeoLoc loc1

first location.

System.Double lon2

Second location's longitude.

System.Double lat2

Second location's latitude.

Returns
Type Description
System.Double

the distance in meters.

| Improve this Doc View Source

GeoDistance(GeoLoc, String)

calculates the distance between two points in meters.

Declaration
public static double GeoDistance(GeoLoc loc1, string loc2Str)
Parameters
Type Name Description
GeoLoc loc1

first location.

System.String loc2Str

second location.

Returns
Type Description
System.Double

the distance in meters.

| Improve this Doc View Source

GeoDistance(Double, Double, GeoLoc)

Calculates the distance between two points in meters.

Declaration
public static double GeoDistance(double lon1, double lat1, GeoLoc loc2)
Parameters
Type Name Description
System.Double lon1

first location's longitude.

System.Double lat1

first location's latitude.

GeoLoc loc2

second location.

Returns
Type Description
System.Double

the distance in meters.

| Improve this Doc View Source

GeoDistance(Double, Double, Double, Double)

Calculates the distance between two points. Minimal implementation taken from Stackoverflow. https://stackoverflow.com/a/51839058/7299345.

Declaration
public static double GeoDistance(double longitude, double latitude, double otherLongitude, double otherLatitude)
Parameters
Type Name Description
System.Double longitude

first location longitude.

System.Double latitude

first location latitude.

System.Double otherLongitude

second location longitude.

System.Double otherLatitude

second location's latitude.

Returns
Type Description
System.Double

distance in meters.

| Improve this Doc View Source

GeoDistance(Double, Double, String)

Calculates the distance between two points in meters.

Declaration
public static double GeoDistance(double lon1, double lat1, string loc2Str)
Parameters
Type Name Description
System.Double lon1

first location's longitude.

System.Double lat1

first location's latitude.

System.String loc2Str

second location.

Returns
Type Description
System.Double

distance in meters.

| Improve this Doc View Source

GeoDistance(String, GeoLoc)

calculates the distance between two points in meters.

Declaration
public static double GeoDistance(string loc1Str, GeoLoc loc2)
Parameters
Type Name Description
System.String loc1Str

First location.

GeoLoc loc2

Second location.

Returns
Type Description
System.Double

the distance in meters.

| Improve this Doc View Source

GeoDistance(String, Double, Double)

calculates the distance between two points in meters.

Declaration
public static double GeoDistance(string loc1Str, double lon2, double lat2)
Parameters
Type Name Description
System.String loc1Str

First location.

System.Double lon2

Second location longitude.

System.Double lat2

Second location latitude.

Returns
Type Description
System.Double

the distance in meters.

| Improve this Doc View Source

GeoDistance(String, String)

calculates the distance between two points in meters.

Declaration
public static double GeoDistance(string loc1Str, string loc2Str)
Parameters
Type Name Description
System.String loc1Str

First location.

System.String loc2Str

Second location.

Returns
Type Description
System.Double

the distance in meters.

| Improve this Doc View Source

Hour(Int64)

Rounds the timestamp to the beginning of the current hour.

Declaration
public static long Hour(long timestamp)
Parameters
Type Name Description
System.Int64 timestamp

the timestamp.

Returns
Type Description
System.Int64

the timestamp rounded to the current hour.

| Improve this Doc View Source

Minute(Int64)

Rounds the timestamp to the beginning of the current minute.

Declaration
public static long Minute(long timestamp)
Parameters
Type Name Description
System.Int64 timestamp

the timestamp.

Returns
Type Description
System.Int64

the timestamp rounded to the current minute.

| Improve this Doc View Source

Month(Int64)

Rounds the timestamp to the beginning of the current month.

Declaration
public static long Month(long timestamp)
Parameters
Type Name Description
System.Int64 timestamp

the timestamp.

Returns
Type Description
System.Int64

The timestamp rounded to the beginning of the current month.

| Improve this Doc View Source

MonthOfYear(Int64)

Gets the month from the timestamp.

Declaration
public static long MonthOfYear(long timestamp)
Parameters
Type Name Description
System.Int64 timestamp

the timestamp.

Returns
Type Description
System.Int64

the month.

| Improve this Doc View Source

ParseTime(String)

parses a unix timestamp from the provided string.

Declaration
public static long ParseTime(string timestamp)
Parameters
Type Name Description
System.String timestamp

the timestamp in %FT%TZ format.

Returns
Type Description
System.Int64

the unix timestamp.

| Improve this Doc View Source

ParseTime(String, String)

Formats the unix timestamp into a string timestamp.

Declaration
public static long ParseTime(string timestamp, string format)
Parameters
Type Name Description
System.String timestamp

the timestamp.

System.String format

The format to use strftime.

Returns
Type Description
System.Int64

a formatted timestamp of %FT%TZ.

| Improve this Doc View Source

Year(Int64)

Gets the year from the timestamp.

Declaration
public static long Year(long timestamp)
Parameters
Type Name Description
System.Int64 timestamp

the timestamp.

Returns
Type Description
System.Int64

the year.

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX