logic

package
v0.0.0-...-96023b5 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareAny

func CompareAny(a, b any) int

CompareAny compares two variables of any type.

func CompareBooleans

func CompareBooleans(a, b bool) int

CompareBooleans compares two boolean values.

func CompareFloats

func CompareFloats(x, y float64) int

CompareFloats is a helper function to compare two float values and return the appropriate comparison result.

func CompareInts

func CompareInts(x, y int64) int

CompareInts is a helper function to compare two int values and return the appropriate comparison result.

func CompareNumbers

func CompareNumbers(a, b any) (int, error)

CompareNumbers compares two numbers (of any compatible numeric type) and returns an int as expected by the sort package.

func ComparePointers

func ComparePointers(a, b interface{}) int

ComparePointers compares two pointers.

func CompareStrings

func CompareStrings(a, b string) int

CompareStrings compares two string values.

func ConvertToType

func ConvertToType(input any, targetType string) any

func IsNumeric

func IsNumeric(a reflect.Type) bool

func MatchesCondition

func MatchesCondition(trav gdbi.Traveler, cond *gripql.HasCondition) bool

func MatchesHasExpression

func MatchesHasExpression(trav gdbi.Traveler, stmt *gripql.HasExpression) bool

Types

type Jump

type Jump struct {
	Mark string
	Stmt *gripql.HasExpression
	Emit bool
	// contains filtered or unexported fields
}

func (*Jump) GetJumpOutput

func (s *Jump) GetJumpOutput() chan gdbi.Traveler

func (*Jump) Init

func (s *Jump) Init()

func (*Jump) Process

func (s *Jump) Process(ctx context.Context, man gdbi.Manager, in gdbi.InPipe, out gdbi.OutPipe) context.Context

type JumpMark

type JumpMark struct {
	Name string
	// contains filtered or unexported fields
}

MarkJump creates mark where jump instruction can send travelers

func (*JumpMark) AddInput

func (s *JumpMark) AddInput(in chan gdbi.Traveler)

func (*JumpMark) Process

func (s *JumpMark) Process(ctx context.Context, man gdbi.Manager, in gdbi.InPipe, out gdbi.OutPipe) context.Context

Process runs Selector

type KVSorter

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

func (*KVSorter[T]) Add

func (ks *KVSorter[T]) Add(value T)

Add implements gdbi.Sorter.

func (*KVSorter[T]) Close

func (ks *KVSorter[T]) Close() error

Close implements gdbi.Sorter.

func (*KVSorter[T]) Sorted

func (ks *KVSorter[T]) Sorted() chan T

Sorted implements gdbi.Sorter.

type MemSorter

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

func (*MemSorter[T]) Add

func (m *MemSorter[T]) Add(value T)

Add implements Sorter.

func (*MemSorter[T]) Close

func (m *MemSorter[T]) Close() error

Close implements Sorter.

func (*MemSorter[T]) Sorted

func (m *MemSorter[T]) Sorted() chan T

Sorted implements Sorter.

type SortConf

type SortConf[SortType any] interface {
	FromBytes([]byte) (SortType, error)
	ToBytes(a SortType) []byte // ToBytes used for marshaling with gob
	Compare(a, b SortType) int
}

type Sorter

type Sorter[T any] interface {
	Add(T)
	Sorted() chan T
	Close() error
}

func NewKVSorter

func NewKVSorter[T any](path string, conf SortConf[T]) Sorter[T]

func NewMemSorter

func NewMemSorter[T any](conf SortConf[T]) Sorter[T]

Jump to

Keyboard shortcuts

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