forked from fl00r/go-tarantool-1.6
-
Couldn't load subscription status.
- Fork 60
Open
Description
Summary
In v3, we want to unexport both fields of the Stream struct to enforce encapsulation and prevent misuse. Access to the stream ID should be provided via a method instead.
Current Definition
type Stream struct {
Id uint64
Conn *Connection
}Both fields are public, which allows unsafe direct access or mutation (e.g., stream.Conn = nil).
Proposed Change
type Stream struct {
id uint64
conn *Connection
}
func (s *Stream) Id() uint64 { return s.id }
// No accessor for conn — it's internal only.- Make both fields unexported (
id,conn). - Add a read-only
Id()method to expose the stream ID. - Do not expose
conn—users should never need to access the underlying connection directly.
Checklist
- Update
Streamstruct fields to be unexported. - Add
Id()method. - Update internal code to use
s.id/s.conn. - Verify no external code relies on direct field access (this is a v3 breaking change).
(meaning add CHANGELOG.md and MIGRATION.md records)
Metadata
Metadata
Assignees
Labels
No labels