-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ feat: byteutil - refactoring the byteutil.Buffer rename some methods
- Loading branch information
Showing
7 changed files
with
103 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,13 @@ | ||
package testutil | ||
|
||
import ( | ||
"bytes" | ||
"fmt" | ||
"github.com/gookit/goutil/byteutil" | ||
) | ||
|
||
// Buffer wrap and extends the bytes.Buffer | ||
type Buffer struct { | ||
bytes.Buffer | ||
} | ||
type Buffer = byteutil.Buffer | ||
|
||
// NewBuffer instance | ||
func NewBuffer() *Buffer { | ||
return &Buffer{} | ||
} | ||
|
||
// WriteString rewrite | ||
func (b *Buffer) WriteString(ss ...string) { | ||
for _, s := range ss { | ||
_, _ = b.Buffer.WriteString(s) | ||
} | ||
} | ||
|
||
// WriteAny method | ||
func (b *Buffer) WriteAny(vs ...any) { | ||
for _, v := range vs { | ||
_, _ = b.Buffer.WriteString(fmt.Sprint(v)) | ||
} | ||
} | ||
|
||
// Writeln method | ||
func (b *Buffer) Writeln(s string) { | ||
_, _ = b.Buffer.WriteString(s) | ||
_ = b.Buffer.WriteByte('\n') | ||
} | ||
|
||
// ResetAndGet buffer string. | ||
func (b *Buffer) ResetAndGet() string { | ||
s := b.String() | ||
b.Reset() | ||
return s | ||
func NewBuffer() *byteutil.Buffer { | ||
return byteutil.NewBuffer() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters