Documentation
¶
Index ¶
- func Params(condition bool, format string, args ...any)
- func State(condition bool, format string, args ...any)
- func Unexpected(format string, args ...any)
- func Unexpected1[T any](format string, args ...any) T
- func Unexpected2[T1, T2 any](format string, args ...any) (T1, T2)
- func Unexpected3[T1, T2, T3 any](format string, args ...any) (T1, T2, T3)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Params ¶
Params panics with an error containing a formatted message if the condition is false. This assertion ensures that the parameters satisfy the condition.
func State ¶
State panics with an error containing a formatted message if the condition is false. This assertion ensures that the state of an object satisfies the condition.
func Unexpected ¶
Unexpected panics with an error containing a formatted message when it is called. This assertion represents that reaching this code is unexpected.
func Unexpected1 ¶
Unexpected1 panics with an error containing a formatted message when it is called. This assertion represents that reaching this code is unexpected. This function call can be used as a value to be returned, for example: ```go type Enum int
const (
Enum0 Enum = iota Enum1
)
func F(enum Enum) string {
switch enum {
case Enum0:
return "A"
case Enum1:
return "B"
default:
return Unexpected1[string]("unexpected enum value")
}
}
func Unexpected2 ¶
Unexpected2 panics with an error containing a formatted message when it is called. This assertion represents that reaching this code is unexpected. This function call can be used as values to be returned, for example: ```go type Enum int
const (
Enum0 Enum = iota Enum1
)
func F(enum Enum) (string, int) {
switch enum {
case Enum0:
return "A", int(enum)
case Enum1:
return "B", int(enum)
default:
return Unexpected2[string, int]("unexpected enum value")
}
}
func Unexpected3 ¶
Unexpected3 panics with an error containing a formatted message when it is called. This assertion represents that reaching this code is unexpected. This function call can be used as values to be returned, for example: ```go type Enum int
const (
Enum0 Enum = iota Enum1
)
func F(enum Enum) (string, int, bool) {
switch enum {
case Enum0:
return "A", int(enum), true
case Enum1:
return "B", int(enum), false
default:
return Unexpected3[string, int, bool]("unexpected enum value")
}
}
Types ¶
This section is empty.