Skip to main content
Module

x/soda/mod.ts>Where

SODA (Socrata) Client for Deno/Node
Latest
class Where
import { Where } from "https://deno.land/x/soda@0.4.5/mod.ts";

Constructors

new
Where(expr: string, params: SupportTypeElement[])

Properties

private
expr: string
private
params: SupportTypeElement[]
readonly
value: string

Methods

toString(): string

Static Methods

and(...expr: (null | undefined | Where)[]): Where
between(
field:
| string
| FieldObject<DataType.Number>
| FieldObject<DataType.FloatingTimestamp>
| FieldObject<DataType.FixedTimestamp>
| FieldObject<DataType.Text>
,
startValue: any,
endValue: any,
): Where

Select records where the value of a field is between two values

Works with the following datatypes:

  • Number
  • Floating timestamp
  • Fixed timestamp
  • Text
eq(field: string | FieldImpl, value: any): Where
expr(expr: string, ...params: SupportTypeElement[]): Where
field(name: string | FieldImpl)
from(data: Record<string, SupportTypeElement>): Where

eq from object

gt(field: string | FieldImpl, value: BasicType): Where
gte(field: string | FieldImpl, value: BasicType): Where
in(field: string | FieldImpl, ...values: any[]): Where
intersects(field:
| string
| FieldObject<DataType.Point>
| FieldObject<DataType.Polygon>
| FieldObject<DataType.Line>
| FieldObject<DataType.MultiPoint>
| FieldObject<DataType.MultiLine>
| FieldObject<DataType.MultiPolygon>
, value: string
): Where

Allows you to compare two geospatial types to see if they intersect or overlap each other

Note: This function is only available on the 2.1 endpoint

isNotNull(field: string | FieldImpl): Where
isNull(field: string | FieldImpl): Where
like(field: string | FieldImpl, value: any): Where
lt(field: string | FieldImpl, value: BasicType): Where
lte(field: string | FieldImpl, value: BasicType): Where
ne(field: string | FieldImpl, value: SupportTypeElement): Where
notBetween(
field:
| string
| FieldObject<DataType.Number>
| FieldObject<DataType.FloatingTimestamp>
| FieldObject<DataType.FixedTimestamp>
| FieldObject<DataType.Text>
,
startValue: any,
endValue: any,
): Where
notIn(field: string | FieldImpl, ...values: any[]): Where
notLike(field: string | FieldImpl, value: any): Where
or(...expr: (null | undefined | Where)[]): Where
startsWith(field: string | FieldObject<DataType.Text>, value: string): Where

This function is used on fields of type Text to find records that start with a given string

withinBox(
field: string | FieldObject<DataType.Location>,
latNW: number,
lonNW: number,
latSE: number,
lonSE: number,
): Where

This function is used on fields of type Location to find records within a given box. This takes the form of a rectangle, with the northwest corner and southeast corner specified by latitude and longitude.

withinCircle(
field: string | FieldObject<DataType.Location>,
lat: number,
lon: number,
radius: number,
): Where

This function is used on fields of type Location to find records within a given circle