Documentation ¶
Index ¶
- Constants
- func CompareVals(op string, arg1, arg2 Val) bool
- func Contains(a *s2.Loop, b *s2.Loop) bool
- func EarthAngle(dist float64) s1.Angle
- func Encrypt(plain string) (string, error)
- func Equal(a, b Val) (bool, error)
- func FilterGeoUids(uids *intern.List, values []*intern.TaskValue, q *GeoQueryData) *intern.List
- func IndexGeoTokens(g geom.T) ([]string, error)
- func Intersects(l1 *s2.Loop, l2 *s2.Loop) bool
- func IsGeoFunc(str string) bool
- func Less(a, b Val) (bool, error)
- func Marshal(from Val, to *Val) error
- func ObjectValue(id TypeID, value interface{}) (*api.Value, error)
- func ParseTime(val string) (time.Time, error)
- func Sort(v [][]Val, ul *intern.List, desc []bool) error
- func SortWithFacet(v [][]Val, ul *intern.List, l []*intern.Facets, desc []bool) error
- func VerifyPassword(plain, encrypted string) error
- type Area
- type GeoQueryData
- type Length
- type QueryType
- type TypeID
- type Val
Constants ¶
const ( // MinCellLevel is the smallest cell level (largest cell size) used by indexing MinCellLevel = 5 // Approx 250km x 380km // MaxCellLevel is the largest cell level (smallest cell size) used by indexing MaxCellLevel = 16 // Approx 120m x 180m // MaxCells is the maximum number of cells to use when indexing regions. MaxCells = 18 )
const ( BinaryID = TypeID(intern.Posting_BINARY) IntID = TypeID(intern.Posting_INT) FloatID = TypeID(intern.Posting_FLOAT) BoolID = TypeID(intern.Posting_BOOL) DateTimeID = TypeID(intern.Posting_DATETIME) StringID = TypeID(intern.Posting_STRING) GeoID = TypeID(intern.Posting_GEO) UidID = TypeID(intern.Posting_UID) PasswordID = TypeID(intern.Posting_PASSWORD) DefaultID = TypeID(intern.Posting_DEFAULT) )
Note: These ids are stored in the posting lists to indicate the type of the data. The order *cannot* be changed without breaking existing data. When adding a new type *always* add to the end of this list. Never delete anything from this list even if it becomes unused.
const EarthRadiusMeters = 1000 * 6371
EarthRadiusMeters is the radius of the earth in meters (in a spherical earth model).
Variables ¶
This section is empty.
Functions ¶
func CompareVals ¶
Should be used only in filtering arg1 by comparing with arg2. arg2 is reference Val to which arg1 is compared.
func EarthAngle ¶
EarthAngle converts a to distance on earth in meters to an angle
func FilterGeoUids ¶
FilterGeoUids filters the uids based on the corresponding values and GeoQueryData. The uids are obtained through the index. This second pass ensures that the values actually match the query criteria.
func IndexGeoTokens ¶
IndexTokens returns the tokens to be used in a geospatial index for the given geometry. If the geometry is not supported it returns an error.
func Intersects ¶
Intersects returns true if the two loops intersect.
func ObjectValue ¶
ObjectValue converts into api.Value.
func SortWithFacet ¶
Sort sorts the given array in-place.
func VerifyPassword ¶
Types ¶
type Area ¶
type Area float64
Area denotes an area on Earth
type GeoQueryData ¶
type GeoQueryData struct {
// contains filtered or unexported fields
}
GeoQueryData is intern.data used by the geo query filter to additionally filter the geometries.
func GetGeoTokens ¶
func GetGeoTokens(srcFunc *intern.SrcFunction) ([]string, *GeoQueryData, error)
GetGeoTokens returns the corresponding index keys based on the type of function.
func (GeoQueryData) MatchesFilter ¶
func (q GeoQueryData) MatchesFilter(g geom.T) bool
MatchesFilter applies the query filter to a geo value
type Length ¶
type Length float64
Length denotes a length on Earth
func EarthDistance ¶
EarthDistance converts an angle to distance on earth in meters.
type QueryType ¶
type QueryType byte
QueryType indicates the type of geo query.
const ( // QueryTypeWithin finds all points that are within the given geometry QueryTypeWithin QueryType = iota // QueryTypeContains finds all polygons that contain the given point QueryTypeContains // QueryTypeIntersects finds all objects that intersect the given geometry QueryTypeIntersects // QueryTypeNear finds all points that are within the given distance from the given point. QueryTypeNear )
type TypeID ¶
type TypeID intern.Posting_ValType
func TypeForName ¶
TypeForName returns the type corresponding to the given name. If name is not recognized, it returns nil.
func (TypeID) Enum ¶
func (t TypeID) Enum() intern.Posting_ValType
type Val ¶
type Val struct { Tid TypeID Value interface{} }
Val is a value with type information.
func ValueForType ¶
ValueForType returns the zero value for a type id