Versions in this module Expand all Collapse all v0 v0.12.0 Apr 28, 2024 Changes in this version + var FormatBounds = OutputFormat(newCmd("BOUNDS")) + var FormatCount = OutputFormat(newCmd("COUNT")) + var FormatHashes = func(precision int) OutputFormat + var FormatIDs = OutputFormat(newCmd("IDS")) + var FormatPoints = OutputFormat(newCmd("POINTS")) + type Bounds struct + NE Point + SW Point + type Chan struct + Command []string + Key string + Meta map[string]string + Name string + type Channels struct + func (ch *Channels) Chans(ctx context.Context, pattern string) ([]Chan, error) + func (ch *Channels) DelChan(ctx context.Context, name string) error + func (ch *Channels) PDelChan(ctx context.Context, pattern string) error + func (ch *Channels) PSubscribe(ctx context.Context, handler EventHandler, pattern string) error + func (ch *Channels) SetChan(name string, query GeofenceQueryBuilder) SetChannelQueryBuilder + func (ch *Channels) Subscribe(ctx context.Context, handler EventHandler, Channels ...string) error + type Client struct + Channels *Channels + Geofence *Geofence + Keys *Keys + Scripting *Scripting + Search *Search + Server *Server + Webhooks *Hooks + func New(cfg Config) (*Client, error) + func NewWithExecutor(exec Executor, debug bool) (*Client, error) + func (client *Client) Close() error + func (client *Client) Execute(ctx context.Context, command string, args ...string) ([]byte, error) + func (client *Client) ExecuteStream(ctx context.Context, handler func([]byte) error, command string, ...) error + func (client *Client) HealthZ(ctx context.Context) error + func (client *Client) Ping(ctx context.Context) error + type Config struct + Address string + ConnectionPoolSize int + Debug bool + Password *string + type DetectAction string + const Cross + const Enter + const Exit + const Inside + const Outside + type EventHandler interface + HandleEvent func(event *GeofenceEvent) error + type EventHandlerFunc func(event *GeofenceEvent) error + func (e EventHandlerFunc) HandleEvent(event *GeofenceEvent) error + type Executor interface + Close func() error + Execute func(ctx context.Context, command string, args ...string) ([]byte, error) + ExecuteStream func(ctx context.Context, handler func([]byte) error, command string, ...) error + type FSetQueryBuilder struct + func (query FSetQueryBuilder) Do(ctx context.Context) error + func (query FSetQueryBuilder) Field(name string, value float64) FSetQueryBuilder + func (query FSetQueryBuilder) IfExists() FSetQueryBuilder + type Geofence struct + func (gf *Geofence) Intersects(key string) GeofenceAreaSelector + func (gf *Geofence) Nearby(key string, lat, lon, meters float64) GeofenceQueryBuilder + func (gf *Geofence) Roam(key, target, pattern string, meters int, nodewell bool) GeofenceQueryBuilder + func (gf *Geofence) Within(key string) GeofenceAreaSelector + type GeofenceAreaSelector struct + func (selector GeofenceAreaSelector) Bounds(minlat, minlon, maxlat, maxlon float64) GeofenceQueryBuilder + func (selector GeofenceAreaSelector) Circle(lat, lon, meters float64) GeofenceQueryBuilder + func (selector GeofenceAreaSelector) Feature(ft *geojson.Feature) GeofenceQueryBuilder + func (selector GeofenceAreaSelector) FeatureCollection(fc *geojson.FeatureCollection) GeofenceQueryBuilder + func (selector GeofenceAreaSelector) Geometry(gm *geojson.Geometry) GeofenceQueryBuilder + func (selector GeofenceAreaSelector) Get(key, objectID string) GeofenceQueryBuilder + func (selector GeofenceAreaSelector) Hash(hash string) GeofenceQueryBuilder + func (selector GeofenceAreaSelector) Quadkey(quadkey string) GeofenceQueryBuilder + func (selector GeofenceAreaSelector) Tile(x, y, z int) GeofenceQueryBuilder + type GeofenceEvent struct + Bounds *Bounds + Command string + Detect string + Faraway *RoamObject + Fields map[string]float64 + Group string + Hash *string + Hook string + ID string + Key string + Nearby *RoamObject + Object *Object + Point *Point + Time time.Time + type GeofenceQueryBuilder struct + func (query GeofenceQueryBuilder) Actions(actions ...DetectAction) GeofenceQueryBuilder + func (query GeofenceQueryBuilder) Clip() GeofenceQueryBuilder + func (query GeofenceQueryBuilder) Commands(notifyCommands ...NotifyCommand) GeofenceQueryBuilder + func (query GeofenceQueryBuilder) Cursor(cursor int) GeofenceQueryBuilder + func (query GeofenceQueryBuilder) Distance() GeofenceQueryBuilder + func (query GeofenceQueryBuilder) Do(ctx context.Context, handler EventHandler) error + func (query GeofenceQueryBuilder) Format(fmt OutputFormat) GeofenceQueryBuilder + func (query GeofenceQueryBuilder) Limit(limit int) GeofenceQueryBuilder + func (query GeofenceQueryBuilder) Match(pattern string) GeofenceQueryBuilder + func (query GeofenceQueryBuilder) NoFields() GeofenceQueryBuilder + func (query GeofenceQueryBuilder) Sparse(sparse int) GeofenceQueryBuilder + func (query GeofenceQueryBuilder) Where(field string, min, max float64) GeofenceQueryBuilder + func (query GeofenceQueryBuilder) WhereEval(script string, args ...string) GeofenceQueryBuilder + func (query GeofenceQueryBuilder) WhereEvalSHA(sha string, args ...string) GeofenceQueryBuilder + func (query GeofenceQueryBuilder) Wherein(field string, values ...float64) GeofenceQueryBuilder + type GetBoundsResponse struct + Bounds Bounds + Fields map[string]float64 + type GetHashResponse struct + Fields map[string]float64 + Hash string + type GetObjectResponse struct + Fields map[string]float64 + Object Object + type GetPointResponse struct + Fields map[string]float64 + Point Point + type Hook struct + Endpoints []string + type Hooks struct + func (hooks *Hooks) DelHook(ctx context.Context, name string) error + func (hooks *Hooks) Hooks(ctx context.Context, pattern string) ([]Hook, error) + func (hooks *Hooks) PDelHook(ctx context.Context, pattern string) error + func (hooks *Hooks) SetHook(name, endpoint string, query GeofenceQueryBuilder) SetHookQueryBuilder + type InwAreaSelector struct + func (selector InwAreaSelector) Bounds(minlat, minlon, maxlat, maxlon float64) InwQueryBuilder + func (selector InwAreaSelector) Circle(lat, lon, meters float64) InwQueryBuilder + func (selector InwAreaSelector) Feature(ft *geojson.Feature) InwQueryBuilder + func (selector InwAreaSelector) FeatureCollection(fc *geojson.FeatureCollection) InwQueryBuilder + func (selector InwAreaSelector) Geometry(gm *geojson.Geometry) InwQueryBuilder + func (selector InwAreaSelector) Get(key, objectID string) InwQueryBuilder + func (selector InwAreaSelector) Hash(hash string) InwQueryBuilder + func (selector InwAreaSelector) Quadkey(quadkey string) InwQueryBuilder + func (selector InwAreaSelector) Tile(x, y, z int) InwQueryBuilder + type InwQueryBuilder struct + func (query InwQueryBuilder) Clip() InwQueryBuilder + func (query InwQueryBuilder) Cursor(cursor int) InwQueryBuilder + func (query InwQueryBuilder) Distance() InwQueryBuilder + func (query InwQueryBuilder) Do(ctx context.Context) (*SearchResponse, error) + func (query InwQueryBuilder) Format(fmt OutputFormat) InwQueryBuilder + func (query InwQueryBuilder) Limit(limit int) InwQueryBuilder + func (query InwQueryBuilder) Match(pattern string) InwQueryBuilder + func (query InwQueryBuilder) NoFields() InwQueryBuilder + func (query InwQueryBuilder) Sparse(sparse int) InwQueryBuilder + func (query InwQueryBuilder) Where(field string, min, max float64) InwQueryBuilder + func (query InwQueryBuilder) WhereEval(script string, args ...string) InwQueryBuilder + func (query InwQueryBuilder) WhereEvalSHA(sha string, args ...string) InwQueryBuilder + func (query InwQueryBuilder) Wherein(field string, values ...float64) InwQueryBuilder + type JSetQueryBuilder struct + func (query JSetQueryBuilder) Do(ctx context.Context) error + func (query JSetQueryBuilder) Raw() JSetQueryBuilder + func (query JSetQueryBuilder) Str() JSetQueryBuilder + type KeyStats struct + InMemorySize int + NumObjects int + NumPoints int + type Keys struct + func (ks *Keys) Bounds(ctx context.Context, key string) ([][][]float64, error) + func (ks *Keys) Del(ctx context.Context, key, objectID string) error + func (ks *Keys) Drop(ctx context.Context, key string) error + func (ks *Keys) Expire(ctx context.Context, key, objectID string, seconds int) error + func (ks *Keys) FSet(key, objectID string) FSetQueryBuilder + func (ks *Keys) Get(key, objectID string) KeysGetQueryBuilder + func (ks *Keys) JDel(ctx context.Context, key, objectID, path string) error + func (ks *Keys) JGet(ctx context.Context, key, objectID, path string) ([]byte, error) + func (ks *Keys) JSet(key, objectID, path, value string) JSetQueryBuilder + func (ks *Keys) Keys(ctx context.Context, pattern string) ([]string, error) + func (ks *Keys) PDel(ctx context.Context, key, pattern string) error + func (ks *Keys) Persist(ctx context.Context, key, objectID string) error + func (ks *Keys) Rename(ctx context.Context, key, newKey string) error + func (ks *Keys) RenameNX(ctx context.Context, key, newKey string) error + func (ks *Keys) Set(key, objectID string) SetAreaSelector + func (ks *Keys) Stats(ctx context.Context, keys ...string) ([]KeyStats, error) + func (ks *Keys) TTL(ctx context.Context, key, objectID string) (int, error) + type KeysGetQueryBuilder struct + func (q KeysGetQueryBuilder) Bounds(ctx context.Context) (*GetBoundsResponse, error) + func (q KeysGetQueryBuilder) Hash(ctx context.Context, precision int) (*GetHashResponse, error) + func (q KeysGetQueryBuilder) Object(ctx context.Context) (*GetObjectResponse, error) + func (q KeysGetQueryBuilder) Point(ctx context.Context) (*GetPointResponse, error) + func (q KeysGetQueryBuilder) WithFields() KeysGetQueryBuilder + type Meta struct + Name string + Value string + type NotifyCommand string + const Del + const Drop + const Set + type Object struct + Feature *geojson.Feature + FeatureCollection *geojson.FeatureCollection + Geometry *geojson.Geometry + String *string + func (ob *Object) UnmarshalJSON(data []byte) error + type OutputFormat cmd + type Point struct + Lat float64 + Lon float64 + type RoamObject struct + ID string + Key string + Meters float64 + Object Object + type ScanQueryBuilder struct + func (query ScanQueryBuilder) Asc() ScanQueryBuilder + func (query ScanQueryBuilder) Cursor(cursor int) ScanQueryBuilder + func (query ScanQueryBuilder) Desc() ScanQueryBuilder + func (query ScanQueryBuilder) Do(ctx context.Context) (*SearchResponse, error) + func (query ScanQueryBuilder) Format(fmt OutputFormat) ScanQueryBuilder + func (query ScanQueryBuilder) Limit(limit int) ScanQueryBuilder + func (query ScanQueryBuilder) Match(pattern string) ScanQueryBuilder + func (query ScanQueryBuilder) NoFields() ScanQueryBuilder + func (query ScanQueryBuilder) Where(field string, min, max float64) ScanQueryBuilder + func (query ScanQueryBuilder) Wherein(field string, values ...float64) ScanQueryBuilder + type Scripting struct + func (sc *Scripting) Eval(ctx context.Context, script string, keys []string, args []string) ([]byte, error) + func (sc *Scripting) EvalNA(ctx context.Context, script string, keys []string, args []string) ([]byte, error) + func (sc *Scripting) EvalNASHA(ctx context.Context, sha string, keys []string, args []string) ([]byte, error) + func (sc *Scripting) EvalRO(ctx context.Context, script string, keys []string, args []string) ([]byte, error) + func (sc *Scripting) EvalROSHA(ctx context.Context, sha string, keys []string, args []string) ([]byte, error) + func (sc *Scripting) EvalSHA(ctx context.Context, sha string, keys []string, args []string) ([]byte, error) + func (sc *Scripting) ScriptExists(ctx context.Context, shas ...string) ([]int, error) + func (sc *Scripting) ScriptFlush(ctx context.Context) error + func (sc *Scripting) ScriptLoad(ctx context.Context, script string) error + type Search struct + func (search *Search) Intersects(key string) InwAreaSelector + func (search *Search) Nearby(key string, lat, lon, meters float64) InwQueryBuilder + func (search *Search) Scan(key string) ScanQueryBuilder + func (search *Search) Search(key string) SearchQueryBuilder + func (search *Search) Within(key string) InwAreaSelector + type SearchQueryBuilder struct + func (query SearchQueryBuilder) Asc() SearchQueryBuilder + func (query SearchQueryBuilder) Cursor(cursor int) SearchQueryBuilder + func (query SearchQueryBuilder) Desc() SearchQueryBuilder + func (query SearchQueryBuilder) Do(ctx context.Context) (*SearchResponse, error) + func (query SearchQueryBuilder) FormatCount() SearchQueryBuilder + func (query SearchQueryBuilder) FormatIDs() SearchQueryBuilder + func (query SearchQueryBuilder) Limit(limit int) SearchQueryBuilder + func (query SearchQueryBuilder) Match(pattern string) SearchQueryBuilder + func (query SearchQueryBuilder) NoFields() SearchQueryBuilder + func (query SearchQueryBuilder) Where(field string, min, max float64) SearchQueryBuilder + func (query SearchQueryBuilder) Wherein(field string, values ...float64) SearchQueryBuilder + type SearchResponse struct + Bounds []struct{ ... } + Count int + Cursor int + Fields []string + Hashes []struct{ ... } + IDs []string + Objects []struct{ ... } + Points []struct{ ... } + type Server struct + func (sv *Server) FlushDB(ctx context.Context) error + type SetAreaSelector struct + func (selector SetAreaSelector) Bounds(lat1, lon1, lat2, lon2 float64) SetQueryBuilder + func (selector SetAreaSelector) Feature(ft *geojson.Feature) SetQueryBuilder + func (selector SetAreaSelector) FeatureCollection(fc *geojson.FeatureCollection) SetQueryBuilder + func (selector SetAreaSelector) Geometry(gm *geojson.Geometry) SetQueryBuilder + func (selector SetAreaSelector) Hash(hash string) SetQueryBuilder + func (selector SetAreaSelector) Point(lat, lon float64) SetQueryBuilder + func (selector SetAreaSelector) PointZ(lat, lon, z float64) SetQueryBuilder + func (selector SetAreaSelector) String(str string) SetQueryBuilder + type SetChannelQueryBuilder struct + func (query SetChannelQueryBuilder) Do(ctx context.Context) error + func (query SetChannelQueryBuilder) Expiration(seconds int) SetChannelQueryBuilder + func (query SetChannelQueryBuilder) Meta(name, value string) SetChannelQueryBuilder + type SetHookQueryBuilder struct + func (query SetHookQueryBuilder) Do(ctx context.Context) error + func (query SetHookQueryBuilder) Endpoint(endpoint string) SetHookQueryBuilder + func (query SetHookQueryBuilder) Expiration(seconds int) SetHookQueryBuilder + func (query SetHookQueryBuilder) Meta(name, value string) SetHookQueryBuilder + type SetQueryBuilder struct + func (query SetQueryBuilder) Do(ctx context.Context) error + func (query SetQueryBuilder) Expiration(seconds int) SetQueryBuilder + func (query SetQueryBuilder) Field(name string, value float64) SetQueryBuilder + func (query SetQueryBuilder) IfExists() SetQueryBuilder + func (query SetQueryBuilder) IfNotExists() SetQueryBuilder