types

package
v82.0.0-...-84d68f0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2017 License: AGPL-3.0, Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
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
)

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.

View Source
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

func CompareVals(op string, arg1, arg2 Val) bool

Should be used only in filtering arg1 by comparing with arg2. arg2 is reference Val to which arg1 is compared.

func Contains

func Contains(a *s2.Loop, b *s2.Loop) bool

Contains checks whether loop A contains loop B.

func EarthAngle

func EarthAngle(dist float64) s1.Angle

EarthAngle converts a to distance on earth in meters to an angle

func Encrypt

func Encrypt(plain string) (string, error)

func Equal

func Equal(a, b Val) (bool, error)

Equal returns true if a is equal to b.

func FilterGeoUids

func FilterGeoUids(uids *protos.List, values []*protos.TaskValue, q *GeoQueryData) *protos.List

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

func IndexGeoTokens(g geom.T) ([]string, error)

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

func Intersects(l1 *s2.Loop, l2 *s2.Loop) bool

Intersects returns true if the two loops intersect.

func IsGeoFunc

func IsGeoFunc(str string) bool

IsGeoFunc returns if a function is of geo type.

func Less

func Less(a, b Val) (bool, error)

Less returns true if a is strictly less than b.

func Marshal

func Marshal(from Val, to *Val) error

func ObjectValue

func ObjectValue(id TypeID, value interface{}) (*protos.Value, error)

ObjectValue converts into protos.Value.

func ParseTime

func ParseTime(val string) (time.Time, error)

func Sort

func Sort(v [][]Val, ul *protos.List, desc []bool) error

Sort sorts the given array in-place.

func SortWithFacet

func SortWithFacet(v [][]Val, ul *protos.List, l []*protos.Facets, desc []bool) error

Sort sorts the given array in-place.

func VerifyPassword

func VerifyPassword(plain, encrypted string) error

Types

type Area

type Area float64

Area denotes an area on Earth

func EarthArea

func EarthArea(a float64) Area

EarthArea converts an area on the unit sphere to an area on earth in sq. meters.

func (Area) String

func (a Area) String() string

String converts the area to human readable units

type GeoQueryData

type GeoQueryData struct {
	// contains filtered or unexported fields
}

GeoQueryData is internal data used by the geo query filter to additionally filter the geometries.

func GetGeoTokens

func GetGeoTokens(srcFunc *protos.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

func EarthDistance(angle s1.Angle) Length

EarthDistance converts an angle to distance on earth in meters.

func (Length) String

func (l Length) String() string

String converts the length to human readable units

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 protos.Posting_ValType

func TypeForName

func TypeForName(name string) (TypeID, bool)

TypeForName returns the type corresponding to the given name. If name is not recognized, it returns nil.

func (TypeID) IsScalar

func (t TypeID) IsScalar() bool

func (TypeID) Name

func (t TypeID) Name() string

type Val

type Val struct {
	Tid   TypeID
	Value interface{}
}

Val is a value with type information.

func Convert

func Convert(from Val, toID TypeID) (Val, error)

Convert converts the value to given scalar type.

func ValueForType

func ValueForType(id TypeID) Val

ValueForType returns the zero value for a type id

func (Val) MarshalJSON

func (v Val) MarshalJSON() ([]byte, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL