contracts

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: GPL-2.0 Imports: 0 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SafeInit added in v1.2.1

func SafeInit(v any)

SafeInit attempts to initialize the passed argument by calling its Init method, but only if the argument implements the Initer interface.

Types

type Checksum

type Checksum interface {
	// String returns the string representation form of the Checksum.
	// The String method is used to use the Checksum in functions
	// where it needs to be compared or hashed.
	String() string
}

Checksum is a unique identifier of an entity.

type Checksumer

type Checksumer interface {
	Checksum() Checksum   // Checksum returns the Checksum.
	SetChecksum(Checksum) // SetChecksum sets the Checksum.
}

Checksumer is implemented by every entity with a checksum.

type Equaler

type Equaler interface {
	// Equal returns whether the receiver is equal to the other entity.
	Equal(other any) bool
}

Equaler is implemented by any entity that can be compared with another entity of the same type. The Equal method should return true if the receiver is equal to the other entity.

type Initer

type Initer interface {
	Init() // Init initializes the object.
}

Initer implements the Init method, which initializes the object in addition to zeroing.

Jump to

Keyboard shortcuts

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