docs(cursor): justify the ignored json.Marshal error in Encode

Per the project's error-handling rule, an ignored error needs a comment. Marshalling the two-scalar payload struct cannot fail; document why the error is dropped. No behavior change.
This commit is contained in:
2026-06-20 00:33:33 +01:00
parent 5214ad2b66
commit d0f649a9b8
+2
View File
@@ -26,6 +26,8 @@ type payload struct {
// Encode creates an opaque cursor string from an offset and query hash.
func Encode(offset int, queryHash string) string {
p := payload{Offset: offset, QueryHash: queryHash}
// Marshalling a struct of two scalar fields (int, string) cannot fail, so the
// error is intentionally ignored.
b, _ := json.Marshal(p)
return base64.RawURLEncoding.EncodeToString(b)
}