typex

package
v2.0.0-alpha.17 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NotFound = new(struct{})

Functions

func DoBlock

func DoBlock(fn func())

func DoBlock1

func DoBlock1[T any](fn func() T) T

func StrOf

func StrOf(s ...string) []string

Types

type Ctx

type Ctx map[string]any

func (Ctx) ToTuple

func (c Ctx) ToTuple() Tuple

type KV

type KV struct {
	K string `json:"key"`
	V any    `json:"value"`
}

type List

type List []any

type Map

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

func (*Map[T]) Del

func (t *Map[T]) Del(key string)

func (*Map[T]) Each

func (t *Map[T]) Each(fn func(name string, val T))

func (*Map[T]) Get

func (t *Map[T]) Get(key string) T

func (*Map[T]) Has

func (t *Map[T]) Has(key string) bool

func (*Map[T]) Keys

func (t *Map[T]) Keys() []string

func (*Map[T]) Load

func (t *Map[T]) Load(key string) (T, bool)

func (*Map[T]) Map

func (t *Map[T]) Map() map[string]T

func (*Map[T]) Set

func (t *Map[T]) Set(key string, val T)

type PriorityQueue

type PriorityQueue []*PriorityQueueItem

PriorityQueue implements the heap.Interface.

func (*PriorityQueue) Head

func (pq *PriorityQueue) Head() *PriorityQueueItem

Head returns the first item of a PriorityQueue without removing it.

func (PriorityQueue) Len

func (pq PriorityQueue) Len() int

Len returns the PriorityQueue length.

func (PriorityQueue) Less

func (pq PriorityQueue) Less(i, j int) bool

Less is the items less comparator.

func (*PriorityQueue) Pop

func (pq *PriorityQueue) Pop() any

Pop implements the heap.Interface.Pop. Removes and returns element Len() - 1.

func (*PriorityQueue) PopItem

func (pq *PriorityQueue) PopItem() *PriorityQueueItem

func (*PriorityQueue) Push

func (pq *PriorityQueue) Push(x any)

Push implements the heap.Interface.Push. Adds x as element Len().

func (*PriorityQueue) PushItem

func (pq *PriorityQueue) PushItem(x *PriorityQueueItem)

func (*PriorityQueue) Remove

func (pq *PriorityQueue) Remove(i int) any

Remove removes and returns the element at Index i from the PriorityQueue.

func (PriorityQueue) Swap

func (pq PriorityQueue) Swap(i, j int)

Swap exchanges the indexes of the items.

type PriorityQueueItem

type PriorityQueueItem struct {
	Value    any
	Priority int64
	Index    int
}

type Queue

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

func QueueOf

func QueueOf(val ...any) *Queue

func (*Queue) Del

func (t *Queue) Del(index uint32)

func (*Queue) First

func (t *Queue) First() any

func (*Queue) Get

func (t *Queue) Get(index uint32) any

func (*Queue) Last

func (t *Queue) Last() any

func (*Queue) List

func (t *Queue) List() []any

func (*Queue) Pop

func (t *Queue) Pop() any

func (*Queue) PopFirst

func (t *Queue) PopFirst() any

func (*Queue) Push

func (t *Queue) Push(val any)

type RwMap

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

func (*RwMap) Del

func (t *RwMap) Del(key string)

func (*RwMap) Each

func (t *RwMap) Each(fn func(name string, val any))

func (*RwMap) Get

func (t *RwMap) Get(key string) any

func (*RwMap) Has

func (t *RwMap) Has(key string) bool

func (*RwMap) Keys

func (t *RwMap) Keys() []string

func (*RwMap) Load

func (t *RwMap) Load(key string) (any, bool)

func (*RwMap) Map

func (t *RwMap) Map() map[string]any

func (*RwMap) Range

func (t *RwMap) Range(fn func(name string, val any) bool)

func (*RwMap) Set

func (t *RwMap) Set(key string, val any)

type Set

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

func SetOf

func SetOf(val ...any) *Set

func (*Set) Add

func (t *Set) Add(v any)

func (*Set) Each

func (t *Set) Each(fn any)

func (*Set) Has

func (t *Set) Has(v any) bool

func (*Set) Len

func (t *Set) Len() uint32

func (*Set) List

func (t *Set) List() (val []any)

func (*Set) Map

func (t *Set) Map(data any) (err error)

type SyncMap

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

func (*SyncMap) Delete

func (t *SyncMap) Delete(key any)

func (*SyncMap) Each

func (t *SyncMap) Each(fn any) (err error)

func (*SyncMap) Get

func (t *SyncMap) Get(key any) any

func (*SyncMap) Has

func (t *SyncMap) Has(key any) (ok bool)

func (*SyncMap) Load

func (t *SyncMap) Load(key any) (value any, ok bool)

func (*SyncMap) LoadAndDelete

func (t *SyncMap) LoadAndDelete(key any) (value any, ok bool)

func (*SyncMap) Map

func (t *SyncMap) Map(fn func(val any) any)

func (*SyncMap) MapTo

func (t *SyncMap) MapTo(data any) (err error)

func (*SyncMap) Range

func (t *SyncMap) Range(f func(key, value any) bool)

func (*SyncMap) Set

func (t *SyncMap) Set(key, value any)

type Tuple

type Tuple []KV

func (Tuple) ToCtx

func (t Tuple) ToCtx() Ctx

type YamlListType

type YamlListType[T any] []T

func (*YamlListType[T]) UnmarshalYAML

func (p *YamlListType[T]) UnmarshalYAML(value *yaml.Node) error

Jump to

Keyboard shortcuts

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