Skip to content

Commit 2484b30

Browse files
committed
Doc fixes
1 parent 30422ae commit 2484b30

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

event.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func (e *Event) Type(t string) *Event {
3434
return e
3535
}
3636

37-
// Type sets the event's retry: field
37+
// Retry sets the event's retry: field
3838
func (e *Event) Retry(t uint64) *Event {
3939
e.retry = t
4040
e.bufSet = false
@@ -49,7 +49,7 @@ func (e *Event) Data(dat string) *Event {
4949
return e
5050
}
5151

52-
// Adds data to the event without overwriting
52+
// AppendData adds data to the event without overwriting
5353
func (e *Event) AppendData(dat string) *Event {
5454
e.WriteString(dat)
5555
return e
@@ -118,6 +118,8 @@ func (e *Event) Write(p []byte) (int, error) {
118118
return len(p), nil
119119
}
120120

121+
// WriteString adds string data to the event.
122+
// Equivilant to calling Write([]byte(string))
121123
func (e *Event) WriteString(p string) {
122124
// split event on newlines
123125
split := strings.Split(p, "\n")

event_factory.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ type EventFactory interface {
1010
New() *Event
1111
}
1212

13-
// EventIdFactory is an event factory that creates events with
13+
// EventIDFactory is an event factory that creates events with
1414
// sequential ID fields.
1515
// If NewFunc is set, the factory uses it to create events before setting
1616
// their IDs
1717
// If NewFunc is not set, NewFact will be used. If neither is set, a new
1818
// event is created from scratch
19-
type EventIdFactory struct {
19+
type EventIDFactory struct {
2020
NewFact EventFactory
2121
NewFunc func() *Event
2222
Next uint64

stream.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ import (
66
"sync"
77
)
88

9+
// Stream abstracts several client connections together and allows
10+
// for event multiplexing and topics.
11+
// A stream also implements an http.Handler to easily register incoming
12+
// http requests as new clients.
913
type Stream struct {
1014
clients list.List
1115
listLock sync.RWMutex
@@ -174,7 +178,7 @@ func (s *Stream) TopicHandler(topics []string) http.HandlerFunc {
174178
}
175179
}
176180

177-
// Register a function to be called when a client connects to this stream's
181+
// ClientConnectHook sets a function to be called when a client connects to this stream's
178182
// HTTP handler.
179183
// Only one handler may be registered. Further calls overwrite the previous.
180184
func (s *Stream) ClientConnectHook(fn func(*http.Request, *Client)) {

0 commit comments

Comments
 (0)