jet/internal/utils/must/must.go
Eli Ribble 41fe97d336
Fix the imports I botched really badly
Apparently I don't understand how go modules work.
2026-05-14 20:56:20 +00:00

41 lines
1,010 B
Go

package must
import (
"source.gleipnir.technology/Gleipnir/jet/v2/internal/utils/is"
"reflect"
)
// BeTrue panics when condition is false
func BeTrue(condition bool, errorStr string) {
if !condition {
panic(errorStr)
}
}
// BeTypeKind panics with errorStr error, if v interface is not of reflect kind
func BeTypeKind(v interface{}, kind reflect.Kind, errorStr string) {
if reflect.TypeOf(v).Kind() != kind {
panic(errorStr)
}
}
// ValueBeOfTypeKind panics with errorStr error, if v value is not of reflect kind
func ValueBeOfTypeKind(v reflect.Value, kind reflect.Kind, errorStr string) {
if v.Kind() != kind {
panic(errorStr)
}
}
// TypeBeOfKind panics with errorStr error, if v type is not of reflect kind
func TypeBeOfKind(v reflect.Type, kind reflect.Kind, errorStr string) {
if v.Kind() != kind {
panic(errorStr)
}
}
// BeInitializedPtr panics with errorStr if val interface is nil
func BeInitializedPtr(val interface{}, errorStr string) {
if is.Nil(val) {
panic(errorStr)
}
}