Files
phishingclub/backend/vendor/github.com/enetx/g/string_builder.go
Ronni Skansing 07c8adaf76 update vendor deps
Signed-off-by: Ronni Skansing <rskansing@gmail.com>
2025-11-06 23:31:08 +01:00

38 lines
1.4 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package g
import "strings"
// Builder wraps strings.Builder and provides additional type-safe methods
// for use with the custom types String and Int.
type Builder struct{ builder strings.Builder }
// NewBuilder creates a new instance of Builder.
func NewBuilder() *Builder { return new(Builder) }
// Write appends the given byte slice to the builder.
func (b *Builder) Write(bs []byte) (int, error) { return b.builder.Write(bs) }
// WriteString appends the given String to the builder.
func (b *Builder) WriteString(str String) (int, error) { return b.builder.WriteString(str.Std()) }
// WriteByte appends the given byte to the builder.
func (b *Builder) WriteByte(c byte) error { return b.builder.WriteByte(c) }
// WriteRune appends the given rune to the builder.
func (b *Builder) WriteRune(r rune) (int, error) { return b.builder.WriteRune(r) }
// Grow increases the builders capacity by at least n bytes.
func (b *Builder) Grow(n Int) { b.builder.Grow(n.Std()) }
// Cap returns the builders current capacity.
func (b *Builder) Cap() Int { return Int(b.builder.Cap()) }
// Len returns the number of bytes currently in the builder.
func (b *Builder) Len() Int { return Int(b.builder.Len()) }
// Reset clears the contents of the builder.
func (b *Builder) Reset() { b.builder.Reset() }
// String returns the accumulated string as a custom String type.
func (b *Builder) String() String { return String(b.builder.String()) }