feat: 补齐模块接口契约与管理 API 文档
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
package presence
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.asio.asia/nixevol/NixMsg/internal/app/port"
|
||||
"git.asio.asia/nixevol/NixMsg/internal/protocol"
|
||||
)
|
||||
|
||||
// Stub 是测试用假实现:全部视为离线。
|
||||
type Stub struct{}
|
||||
|
||||
func NewStub() *Stub { return &Stub{} }
|
||||
|
||||
func (s *Stub) Get(_ context.Context, ids []string) ([]StatusItem, error) {
|
||||
out := make([]StatusItem, 0, len(ids))
|
||||
for _, id := range ids {
|
||||
out = append(out, StatusItem{ID: id, Online: false, SinceMs: 0})
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (s *Stub) Directory(context.Context, *protocol.DirectoryList) ([]DirectoryItem, string, error) {
|
||||
return nil, "", nil
|
||||
}
|
||||
|
||||
func (s *Stub) Watch(context.Context, port.ConnID, string, *protocol.PresenceWatch) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *Stub) ClearWatch(port.ConnID) {}
|
||||
|
||||
func (s *Stub) SetOnline(context.Context, string, port.ConnID, int64) error { return nil }
|
||||
|
||||
func (s *Stub) SetOffline(context.Context, string, port.ConnID, int64) error { return nil }
|
||||
|
||||
func (s *Stub) IsOnline(string) bool { return false }
|
||||
|
||||
func (s *Stub) CurrentConn(string) (port.ConnID, bool) { return "", false }
|
||||
|
||||
var _ Service = (*Stub)(nil)
|
||||
Reference in New Issue
Block a user