collection

package
v0.0.0-...-2e2bd14 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collection

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

Collection represents a collection of geojson objects.

func New

func New() *Collection

New creates an empty collection

func (*Collection) Bounds

func (c *Collection) Bounds() (minX, minY, maxX, maxY float64)

Bounds returns the bounds of all the items in the collection.

func (*Collection) Count

func (c *Collection) Count() int

Count returns the number of objects in collection.

func (*Collection) Delete

func (c *Collection) Delete(id string) (prev *object.Object)

Delete removes an object and returns it. If the object does not exist then the 'ok' return value will be false.

func (*Collection) Get

func (c *Collection) Get(id string) *object.Object

Get returns an object. If the object does not exist then the 'ok' return value will be false.

func (*Collection) Intersects

func (c *Collection) Intersects(
	gobj geojson.Object,
	sparse uint8,
	cursor Cursor,
	deadline *deadline.Deadline,
	iter func(o *object.Object) bool,
) bool

Intersects returns all object that are intersect an object or bounding box. Set obj to nil in order to use the bounding box.

func (*Collection) Nearby

func (c *Collection) Nearby(
	target geojson.Object,
	cursor Cursor,
	deadline *deadline.Deadline,
	iter func(o *object.Object, dist float64) bool,
) bool

Nearby returns the nearest neighbors

func (*Collection) PointCount

func (c *Collection) PointCount() int

PointCount returns the number of points (lat/lon coordinates) in collection.

func (*Collection) Scan

func (c *Collection) Scan(
	desc bool,
	cursor Cursor,
	deadline *deadline.Deadline,
	iterator func(obj *object.Object) bool,
) bool

Scan iterates though the collection ids.

func (*Collection) ScanExpires

func (c *Collection) ScanExpires(iter func(o *object.Object) bool)

ScanExpires returns a list of all objects that have expired.

func (*Collection) ScanGreaterOrEqual

func (c *Collection) ScanGreaterOrEqual(id string, desc bool,
	cursor Cursor,
	deadline *deadline.Deadline,
	iterator func(o *object.Object) bool,
) bool

ScanGreaterOrEqual iterates though the collection starting with specified id.

func (*Collection) ScanRange

func (c *Collection) ScanRange(
	start, end string,
	desc bool,
	cursor Cursor,
	deadline *deadline.Deadline,
	iterator func(o *object.Object) bool,
) bool

ScanRange iterates though the collection starting with specified id.

func (*Collection) SearchValues

func (c *Collection) SearchValues(
	desc bool,
	cursor Cursor,
	deadline *deadline.Deadline,
	iterator func(o *object.Object) bool,
) bool

SearchValues iterates though the collection values.

func (*Collection) SearchValuesRange

func (c *Collection) SearchValuesRange(start, end string, desc bool,
	cursor Cursor,
	deadline *deadline.Deadline,
	iterator func(o *object.Object) bool,
) bool

SearchValuesRange iterates though the collection values.

func (*Collection) Set

func (c *Collection) Set(obj *object.Object) (prev *object.Object)

Set adds or replaces an object in the collection and returns the fields array.

func (*Collection) StringCount

func (c *Collection) StringCount() int

StringCount returns the number of string values.

func (*Collection) TotalWeight

func (c *Collection) TotalWeight() int

TotalWeight calculates the in-memory cost of the collection in bytes.

func (*Collection) Within

func (c *Collection) Within(
	obj geojson.Object,
	sparse uint8,
	cursor Cursor,
	deadline *deadline.Deadline,
	iter func(o *object.Object) bool,
) bool

Within returns all object that are fully contained within an object or bounding box. Set obj to nil in order to use the bounding box.

type Cursor

type Cursor interface {
	Offset() uint64
	Step(count uint64)
}

Cursor allows for quickly paging through Scan, Within, Intersects, and Nearby

type String

type String string

func (String) AppendJSON

func (s String) AppendJSON(dst []byte) []byte

func (String) Center

func (s String) Center() geometry.Point

func (String) Contains

func (s String) Contains(obj geojson.Object) bool

func (String) Distance

func (s String) Distance(obj geojson.Object) float64

func (String) Empty

func (s String) Empty() bool

func (String) ForEach

func (s String) ForEach(iter func(geom geojson.Object) bool) bool

func (String) Intersects

func (s String) Intersects(obj geojson.Object) bool

func (String) JSON

func (s String) JSON() string

func (String) MarshalJSON

func (s String) MarshalJSON() ([]byte, error)

func (String) Members

func (s String) Members() string

func (String) NumPoints

func (s String) NumPoints() int

func (String) Rect

func (s String) Rect() geometry.Rect

func (String) Spatial

func (s String) Spatial() geojson.Spatial

func (String) String

func (s String) String() string

func (String) Valid

func (s String) Valid() bool

func (String) Within

func (s String) Within(obj geojson.Object) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳