patterns

package
v1.28.5 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: MIT Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder added in v1.26.5

type Builder[T any] interface {
	Build() T
}

Builder pattern

type Comparable added in v1.28.4

type Comparable[T any] interface {
	// Compare l<r:<0, l=r: 0, l>r:>0
	Compare(rhs T) int
}

Comparable pattern

type Iteratable

type Iteratable[T any] interface {
	Iterator(ctx context.Context) <-chan T
}

Object that can be iterated If iteration is terminated before the end, ctx MUST be cancelled to avoid goroutine/channel leak example ctx,cancel := context.WithCancel(context.Background()) defer cancel()

for i := range it.Iterator(ctx) {
  /* Loop can be safely terminated early */
}

type NamedObject

type NamedObject interface {
	Name() string
}

Object with a name

type NamedObjectImpl

type NamedObjectImpl string

func (NamedObjectImpl) Name

func (n NamedObjectImpl) Name() string

Jump to

Keyboard shortcuts

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