offset

package
v0.0.0-...-a26ebea Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMustBePositive = validation.NewError(
	"offset_must_be_positive",
	"the offset value must be a positive number",
)

ErrMustBePositive is the validation check error returned when an offset is a negative number.

Functions

This section is empty.

Types

type Offset

type Offset int64

Offset represents the position of a message within a topic+partition.

func Generate

func Generate(rand *rand.Rand) Offset

Generate a random Offset value.

func New

New creates and validates a new Offset from the given int64.

func (Offset) Check

func (o Offset) Check() validation.ErrorGroup

Check runs default validation checks for the Offset.

func (Offset) Equals

func (o Offset) Equals(v any) bool

Equals compares two Offset instances for equality.

Interface: comparison.Equaler

func (Offset) Generate

func (Offset) Generate(rand *rand.Rand, size int) reflect.Value

Generate random Offset values.

Interface: quick.Generator

func (Offset) MarshalBinary

func (o Offset) MarshalBinary() (data []byte, err error)

MarshalBinary converts the Offset instance to binary form.

Interface: encoding.BinaryMarshaler

func (Offset) MarshalBinaryWriter

func (o Offset) MarshalBinaryWriter(w io.Writer) (err error)

MarshalBinaryWriter populates the io.Writer with Offset data in its binary form.

func (Offset) MarshalJSON

func (o Offset) MarshalJSON() (data []byte, err error)

MarshalJSON converts the Offset instance to JSON form.

Interface: json.Marshaler

func (Offset) String

func (o Offset) String() string

String value of the Offset.

Interface: fmt.Stringer.

func (*Offset) UnmarshalBinary

func (o *Offset) UnmarshalBinary(data []byte) (err error)

UnmarshalBinary converts the binary form to a Offset instance.

Interface: encoding.BinaryUnmarshaler

func (*Offset) UnmarshalBinaryReader

func (o *Offset) UnmarshalBinaryReader(r io.Reader) (err error)

UnmarshalBinaryReader populates Offset from an io.Reader returning the binary form.

func (*Offset) UnmarshalJSON

func (o *Offset) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON converts the JSON form to a Offset instance.

Interface: json.Unmarshal

Jump to

Keyboard shortcuts

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