internal

package
v0.0.0-...-62e415d Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func CheckedClose

func CheckedClose(c io.Closer, err *error)

CheckedClose is a helper function to close a resource and return an error if it fails. It is intended to be used in a defer statement.

func Counter

func Counter(start int) iter.Seq[int]

func DecimalRequiredBytes

func DecimalRequiredBytes(precision int) int

DecimalRequiredBytes returns the required number of bytes to store a decimal value of the given precision. If the precision is outside the range (0, 40], this returns -1 as it is invalid.

func DecimalSchema

func DecimalSchema(precision, scale int) avro.Schema

func Difference

func Difference(a, b []string) []string

Helper function to find the difference between two slices (a - b).

func Must

func Must[T any](v T, err error) T

func NewManifestEntrySchema

func NewManifestEntrySchema(partitionType avro.Schema, version int) (avro.Schema, error)

func NewManifestFileSchema

func NewManifestFileSchema(version int) (avro.Schema, error)

func NullableSchema

func NullableSchema(schema avro.Schema) avro.Schema

func PackingIterator

func PackingIterator[T any](itr iter.Seq[T], targetWeight int64, lookback int, weightFunc func(T) int64, largestBinFirst bool) iter.Seq[[]T]

func RecoverError

func RecoverError(err *error)

func SliceEqualHelper

func SliceEqualHelper[T interface{ Equals(T) bool }](s1, s2 []T) bool

SliceEqualHelper compares the equality of two slices whose elements have an Equals method

func WithElementID

func WithElementID(id int) avro.SchemaOption

func WithFieldID

func WithFieldID(id int) avro.SchemaOption

Types

type Bin

type Bin[T any] struct {
	// contains filtered or unexported fields
}

func (*Bin[T]) Add

func (b *Bin[T]) Add(item T, weight int64)

func (*Bin[T]) CanAdd

func (b *Bin[T]) CanAdd(weight int64) bool

func (*Bin[T]) Weight

func (b *Bin[T]) Weight() int64

type CountingWriter

type CountingWriter struct {
	Count int64
	W     io.Writer
}

func (*CountingWriter) Write

func (w *CountingWriter) Write(p []byte) (int, error)

type MockFS

type MockFS struct {
	mock.Mock
}

func (*MockFS) Create

func (m *MockFS) Create(name string) (io.FileWriter, error)

func (*MockFS) Open

func (m *MockFS) Open(name string) (io.File, error)

func (*MockFS) Remove

func (m *MockFS) Remove(name string) error

func (*MockFS) WriteFile

func (m *MockFS) WriteFile(name string, content []byte) error

type MockFSReadFile

type MockFSReadFile struct {
	MockFS
	ErrOnClose bool
}

func (*MockFSReadFile) ReadFile

func (m *MockFSReadFile) ReadFile(name string) ([]byte, error)

type MockFile

type MockFile struct {
	Contents   *bytes.Reader
	ErrOnClose bool
	// contains filtered or unexported fields
}

func (*MockFile) Close

func (m *MockFile) Close() error

func (*MockFile) Read

func (m *MockFile) Read(p []byte) (int, error)

func (*MockFile) ReadAt

func (m *MockFile) ReadAt(p []byte, off int64) (n int, err error)

func (*MockFile) ReadFrom

func (m *MockFile) ReadFrom(r sio.Reader) (n int64, err error)

func (*MockFile) Seek

func (m *MockFile) Seek(offset int64, whence int) (n int64, err error)

func (*MockFile) Stat

func (m *MockFile) Stat() (fs.FileInfo, error)

func (*MockFile) Write

func (m *MockFile) Write(p []byte) (n int, err error)

type SlicePacker

type SlicePacker[T any] struct {
	TargetWeight    int64
	Lookback        int
	LargestBinFirst bool
}

func (*SlicePacker[T]) Pack

func (s *SlicePacker[T]) Pack(items []T, weightFunc func(T) int64) [][]T

func (*SlicePacker[T]) PackEnd

func (s *SlicePacker[T]) PackEnd(items []T, weightFunc func(T) int64) [][]T

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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