fm

package
v1.0.16 Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OrderedLevelRepo    = 2
	OrderedLevelHandler = 3
	OrderedLevelService = 9
)

Variables

This section is empty.

Functions

func CallOrderedInit

func CallOrderedInit()

func DirectPbwGet

func DirectPbwGet[T any](obj any, dval ...T) *T

func GetDefault

func GetDefault[T any](val *T, dval T) T

func GetFirst

func GetFirst[T any](ls []T, dval ...T) *T

func GrpcCall

func GrpcCall[T any, R any](clog clog.Instance, fn func(ctx context.Context, in *T, opts ...grpc.CallOption) (*R, error), req *T, header ...map[string]string) (*R, error)

func GrpcClient

func GrpcClient[T any](address string, fn func(cc grpc.ClientConnInterface) T) (T, error)

func GrpcHeader

func GrpcHeader(ctx context.Context) map[string]string

func IfHaveIn

func IfHaveIn[T comparable](val T, in ...T) bool

func IsNil

func IsNil(val any) bool

func MapCopy

func MapCopy[K comparable, V any](original map[K]V) map[K]V

func OrderedInit

func OrderedInit(level int, fn func())

func PbwDouble added in v1.0.9

func PbwDouble(val *float64) *wrapperspb.DoubleValue

func PbwFloat added in v1.0.9

func PbwFloat(val *float64) *wrapperspb.FloatValue

func PbwGet

func PbwGet[T any](obj any, dval ...T) (*T, bool)

func PbwInt32

func PbwInt32(val *int) *wrapperspb.Int32Value

func PbwString

func PbwString(val *string) *wrapperspb.StringValue

func Ptr

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

func PtrGetFirst

func PtrGetFirst[T any](ls []*T, dval ...*T) *T

func Ternary

func Ternary[T any](condition bool, a, b T) T

func Ternary2LR

func Ternary2LR[A any, B any](condition bool, l, r func() (A, B)) (A, B)

func TernaryR added in v1.0.5

func TernaryR[T any](condition bool, a T, b func() T) T

func Val

func Val[T any](condition bool, fn func() T) *T

Types

This section is empty.

Jump to

Keyboard shortcuts

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