Blame view

go/src/themaru/vendor/github.com/gin-contrib/sse/writer.go 395 Bytes
476d2547e   김태훈   태마루 시스템 설정 / 업데이트...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
  package sse
  
  import "io"
  
  type stringWriter interface {
  	io.Writer
  	WriteString(string) (int, error)
  }
  
  type stringWrapper struct {
  	io.Writer
  }
  
  func (w stringWrapper) WriteString(str string) (int, error) {
  	return w.Writer.Write([]byte(str))
  }
  
  func checkWriter(writer io.Writer) stringWriter {
  	if w, ok := writer.(stringWriter); ok {
  		return w
  	} else {
  		return stringWrapper{writer}
  	}
  }