locate

package
v0.0.0-...-457ba4f Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	// 用户ID
	UID int64 `json:"uid"`
	// 事件类型
	Type EventType `json:"type"`
	// 实例ID
	InsID string `json:"ins_id"`
	// 实例类型
	InsKind string `json:"ins_kind"`
}

type EventType

type EventType int
const (
	SetLocation EventType = iota // 设置定位
	RemLocation                  // 移除定位
)

type Locator

type Locator interface {
	// Get 获取用户定位
	Get(ctx context.Context, uid int64, insKind string) (string, error)
	// Set 设置用户定位
	Set(ctx context.Context, uid int64, insKind string, insID string) error
	// Rem 移除用户定位
	Rem(ctx context.Context, uid int64, insKind string, insID string) error
	// Watch 监听用户定位变化
	Watch(ctx context.Context, insKinds ...string) (Watcher, error)
}

type Watcher

type Watcher interface {
	// Next 返回用户位置列表
	Next() ([]*Event, error)
	// Stop 停止监听
	Stop() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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