mirror of
https://gitee.com/dromara/mayfly-go
synced 2026-02-02 19:05:48 +08:00
18 lines
276 B
Go
18 lines
276 B
Go
package writerx
|
|
|
|
import (
|
|
"io"
|
|
)
|
|
|
|
type StringWriter struct {
|
|
io.Writer
|
|
}
|
|
|
|
func (sw *StringWriter) WriteString(s string) (n int, err error) {
|
|
return sw.Writer.Write([]byte(s))
|
|
}
|
|
|
|
func NewStringWriter(writer io.Writer) *StringWriter {
|
|
return &StringWriter{Writer: writer}
|
|
}
|