util

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// value related to RFC 1123 and 952.
	LabelHostnameLength = 63
)

Variables

View Source
var ErrInvalidUserName = errors.New("invalid user name")

Functions

func ArrContains

func ArrContains[T comparable](arr []T, obj T) bool

func ArrContainsAny added in v1.3.0

func ArrContainsAny[T comparable](arr []T, objs []T) bool

func CheckHttpError

func CheckHttpError(funcName string, resp *http.Response) error

func GetObjectID

func GetObjectID(id *string) *primitive.ObjectID

func GetObjectIDs

func GetObjectIDs(ids []*string) *[]*primitive.ObjectID

func IsNil

func IsNil(i any) bool

func NormalizeToFQDNRules added in v1.3.2

func NormalizeToFQDNRules(name string, stripEmailDomain bool) (string, error)

NormalizeToFQDNRules will replace forbidden chars in user it can also return an error if the user doesn't respect RFC 952 and 1123.

func Ptr

func Ptr[T any](obj T) *T

func ToJsonString

func ToJsonString[T interface{}](obj T) string

func UnPtrString

func UnPtrString(s *string) string

func UnPtrs

func UnPtrs[T any](objs []*T) []T

Types

type BsonMap

type BsonMap struct {
	bson.M
}

func (*BsonMap) Set

func (m *BsonMap) Set(key string, value any) *BsonMap

func (*BsonMap) SetNotNull

func (m *BsonMap) SetNotNull(key string, value any) *BsonMap

func (*BsonMap) ToBsonM

func (m *BsonMap) ToBsonM() *bson.M

Jump to

Keyboard shortcuts

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