Add Go examples for message updates, deletes, and appends#3351
Conversation
Adds Go code examples to the updates-deletes.mdx docs page for all five operations: updateMessage, deleteMessage, appendMessage, getMessage, and getMessageVersions. These are now supported as of ably-go v1.4.0.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
m-hulbert
left a comment
There was a problem hiding this comment.
Tested everything, but hit 2 issues - all the others worked fine.
| err := channel.AppendMessageAsync(&ably.Message{ | ||
| Serial: *result.Serial, | ||
| Data: fragment, | ||
| }, nil) |
There was a problem hiding this comment.
My Go admittedly isn't the best, but this fails when I test it - according to Claude because:
The crash is at realtime_channel.go:908 where the SDK does:
onAck(result, nil)
…unconditionally, with no nil check. When the server ACKs the append, the SDK invokes that nil function — segfault.
| pages := channel.GetMessageVersions(serial, nil) | ||
| page, err := pages.Next(context.Background()) | ||
| if err != nil { | ||
| panic(err) | ||
| } | ||
| fmt.Printf("Found %d versions\n", len(page.Items)) | ||
| ``` |
There was a problem hiding this comment.
I had to use the version below because HistoryRequest has no direct Next.
pages, err := channel.GetMessageVersions(serial, nil).Pages(context.Background())
if err != nil {
panic(err)
}
for pages.Next(context.Background()) {
items := pages.Items()
fmt.Printf("Found %d versions on this page\n", len(items))
for _, msg := range items {
fmt.Printf(" %s: %v\n", msg.Serial, msg.Data)
}
}
if err := pages.Err(); err != nil {
panic(err)
}
Summary
Adds Go code examples to the Updates, deletes and appends docs page, covering all five operations:
updateMessage— update an existing message by serialdeleteMessage— soft-delete a message by serialappendMessage— incrementally append data to a message (usingAppendMessageAsyncfor non-blocking pipelining)getMessage— retrieve the latest version of a message by serialgetMessageVersions— paginate through the full version history of a messageThese operations are now supported in the Go SDK as of ably-go v1.4.0.
Test plan
🤖 Generated with Claude Code