MCPcopy Create free account
hub / github.com/astercloud/aster / GetHistory

Method GetHistory

pkg/core/room.go:278–286  ·  view source on GitHub ↗

GetHistory 获取消息历史

()

Source from the content-addressed store, hash-verified

276
277// GetHistory 获取消息历史
278func (r *Room) GetHistory() []RoomMessage {
279 r.mu.RLock()
280 defer r.mu.RUnlock()
281
282 // 返回副本
283 history := make([]RoomMessage, len(r.history))
284 copy(history, r.history)
285 return history
286}
287
288// ClearHistory 清空消息历史
289func (r *Room) ClearHistory() {

Callers 4

TestRoom_SayFunction · 0.95
TestRoom_BroadcastFunction · 0.95
TestRoom_SendToFunction · 0.95
TestRoom_ClearHistoryFunction · 0.95

Calls 1

copyFunction · 0.85

Tested by 4

TestRoom_SayFunction · 0.76
TestRoom_BroadcastFunction · 0.76
TestRoom_SendToFunction · 0.76
TestRoom_ClearHistoryFunction · 0.76