operationV2

package
v1.50.2 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2025 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var APP struct {
	Match Match
}

Functions

func OrError

func OrError(target bool, trueValue, falseValue error) error

OrError 三元运算符 → 处理错误

Types

type AttrFalseFn

type AttrFalseFn[T any] struct {
	// contains filtered or unexported fields
}

func FalseFn

func FalseFn[T any](falseFn func() T) AttrFalseFn[T]

func (AttrFalseFn[T]) Register

func (my AttrFalseFn[T]) Register(ternary *Ternary[T])

type AttrFalseValue

type AttrFalseValue[T any] struct {
	// contains filtered or unexported fields
}

func FalseValue

func FalseValue[T any](falseValue T) AttrFalseValue[T]

func (AttrFalseValue[T]) Register

func (my AttrFalseValue[T]) Register(ternary *Ternary[T])

type AttrMatchItem added in v1.50.0

type AttrMatchItem struct {
	// contains filtered or unexported fields
}

func MatchItem added in v1.50.0

func MatchItem(target any, fn func(val any)) AttrMatchItem

func (AttrMatchItem) Register added in v1.50.0

func (my AttrMatchItem) Register(match *Match)

type AttrTrueFn

type AttrTrueFn[T any] struct {
	// contains filtered or unexported fields
}

func TrueFn

func TrueFn[T any](trueFn func() T) AttrTrueFn[T]

func (AttrTrueFn[T]) Register

func (my AttrTrueFn[T]) Register(ternary *Ternary[T])

type AttrTrueValue

type AttrTrueValue[T any] struct {
	// contains filtered or unexported fields
}

func TrueValue

func TrueValue[T any](trueValue T) AttrTrueValue[T]

func (AttrTrueValue[T]) Register

func (my AttrTrueValue[T]) Register(ternary *Ternary[T])

type Match added in v1.50.0

type Match struct {
	// contains filtered or unexported fields
}

func (Match) Do added in v1.50.0

func (my Match) Do(target any)

func (Match) New added in v1.50.0

func (Match) New(attrs ...MatchAttributer) Match

func (Match) SetAttrs added in v1.50.0

func (my Match) SetAttrs(attrs ...MatchAttributer) Match

func (Match) SetDefault added in v1.50.0

func (my Match) SetDefault(fn func()) Match

type MatchAttributer added in v1.50.0

type MatchAttributer interface{ Register(match *Match) }

type Ternary

type Ternary[T any] struct {
	// contains filtered or unexported fields
}

func NewTernary

func NewTernary[T any](attrs ...TernaryAttributer[T]) Ternary[T]

func (Ternary[T]) DoByFunc

func (t Ternary[T]) DoByFunc(condition func() bool)

DoByFunc 执行回调 → 通过函数

func (Ternary[T]) DoByValue

func (t Ternary[T]) DoByValue(condition bool)

DoByValue 执行回调 → 通过值

func (Ternary[T]) GetByFunc

func (t Ternary[T]) GetByFunc(condition func() bool) T

GetByFunc 获取值 → 通过函数

func (Ternary[T]) GetByValue

func (t Ternary[T]) GetByValue(condition bool) T

GetByValue 获取值 → 通过值

func (Ternary[T]) Set

func (t Ternary[T]) Set(attrs ...TernaryAttributer[T]) Ternary[T]

type TernaryAttributer

type TernaryAttributer[T any] interface {
	Register(ternary *Ternary[T])
}

Jump to

Keyboard shortcuts

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