testmap

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthTestmap        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTestmap          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTestmap = fmt.Errorf("proto: unexpected end of group")
)

Functions

func InternBytesToString

func InternBytesToString(b []byte) string

InternBytesToString converts bytes to an interned string without allocation.

func InternString

func InternString(s string) string

InternString returns an interned version of the given string using Go's unique package.

func InternStringSlice

func InternStringSlice(slice []string)

InternStringSlice interns all strings in the slice in-place.

Types

type InternBuilder

type InternBuilder struct {
	// contains filtered or unexported fields
}

InternBuilder is a strings.Builder that automatically interns the final string.

func (*InternBuilder) String

func (ib *InternBuilder) String() string

String returns the interned string and resets the builder.

func (*InternBuilder) WriteByte

func (ib *InternBuilder) WriteByte(c byte) error

WriteByte writes a byte to the InternBuilder.

func (*InternBuilder) WriteString

func (ib *InternBuilder) WriteString(s string) (int, error)

WriteString writes a string to the InternBuilder.

type TestMapMessage

type TestMapMessage struct {
	// Map with both string keys and values - intern both
	Metadata map[string]string `` /* 157-byte string literal not displayed */
	// Map with string keys, int values - intern only keys
	Counters map[string]int64 `` /* 158-byte string literal not displayed */
	// Regular string field for comparison
	Name                 string   `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func TestMapMessageFromPool

func TestMapMessageFromPool() *TestMapMessage

TestMapMessageFromPool retrieves a TestMapMessage from the object pool.

func UnmarshalTestMapMessageFromPool

func UnmarshalTestMapMessageFromPool(data []byte) (*TestMapMessage, error)

UnmarshalTestMapMessageFromPool unmarshals data using a pooled TestMapMessage instance. The message is automatically returned to the pool if unmarshaling fails. Caller must call ReturnToPool() when done with the message.

func (*TestMapMessage) Descriptor

func (*TestMapMessage) Descriptor() ([]byte, []int)

func (*TestMapMessage) GetCounters

func (m *TestMapMessage) GetCounters() map[string]int64

func (*TestMapMessage) GetMetadata

func (m *TestMapMessage) GetMetadata() map[string]string

func (*TestMapMessage) GetName

func (m *TestMapMessage) GetName() string

func (*TestMapMessage) InternStrings

func (m *TestMapMessage) InternStrings()

InternStrings interns all string fields in TestMapMessage that are configured for interning.

func (*TestMapMessage) Marshal

func (m *TestMapMessage) Marshal() (dAtA []byte, err error)

func (*TestMapMessage) MarshalTo

func (m *TestMapMessage) MarshalTo(dAtA []byte) (int, error)

func (*TestMapMessage) MarshalToSizedBuffer

func (m *TestMapMessage) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*TestMapMessage) Poolable

func (*TestMapMessage) Poolable()

Poolable marks this message as supporting object pooling. This is used by gRPC interceptors and other pool-aware code.

func (*TestMapMessage) ProtoMessage

func (*TestMapMessage) ProtoMessage()

func (*TestMapMessage) Reset

func (m *TestMapMessage) Reset()

func (*TestMapMessage) ResetPool

func (m *TestMapMessage) ResetPool()

ResetPool resets the TestMapMessage fields while preserving slice capacities for pooling.

func (*TestMapMessage) ReturnToPool

func (m *TestMapMessage) ReturnToPool()

ReturnToPool returns the TestMapMessage to the object pool after resetting it. Messages larger than 65536 bytes are not pooled to prevent memory bloat.

func (*TestMapMessage) Size

func (m *TestMapMessage) Size() (n int)

func (*TestMapMessage) String

func (m *TestMapMessage) String() string

func (*TestMapMessage) Unmarshal

func (m *TestMapMessage) Unmarshal(dAtA []byte) error

func (*TestMapMessage) XXX_DiscardUnknown

func (m *TestMapMessage) XXX_DiscardUnknown()

func (*TestMapMessage) XXX_Marshal

func (m *TestMapMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TestMapMessage) XXX_Merge

func (m *TestMapMessage) XXX_Merge(src proto.Message)

func (*TestMapMessage) XXX_Size

func (m *TestMapMessage) XXX_Size() int

func (*TestMapMessage) XXX_Unmarshal

func (m *TestMapMessage) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL