ordered

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Copyright 2026 Teradata

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Package ordered provides ordered map utilities (stub for github.com/charmbracelet/x/exp/ordered).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clamp

func Clamp[T ~int | ~int64 | ~float64](val, minVal, maxVal T) T

Clamp constrains a value within a range [min, max].

Types

type Map

type Map[K comparable, V any] struct {
	// contains filtered or unexported fields
}

Map is an ordered map.

func New

func New[K comparable, V any]() *Map[K, V]

New creates a new ordered map.

func (*Map[K, V]) Clear

func (m *Map[K, V]) Clear()

Clear clears the map.

func (*Map[K, V]) Delete

func (m *Map[K, V]) Delete(key K)

Delete deletes a value.

func (*Map[K, V]) Get

func (m *Map[K, V]) Get(key K) (V, bool)

Get gets a value.

func (*Map[K, V]) Keys

func (m *Map[K, V]) Keys() []K

Keys returns all keys in order.

func (*Map[K, V]) Len

func (m *Map[K, V]) Len() int

Len returns the map length.

func (*Map[K, V]) Range

func (m *Map[K, V]) Range(fn func(key K, value V) bool)

Range iterates over the map in order.

func (*Map[K, V]) Set

func (m *Map[K, V]) Set(key K, value V)

Set sets a value.

func (*Map[K, V]) Values

func (m *Map[K, V]) Values() []V

Values returns all values in order.

Jump to

Keyboard shortcuts

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