csync

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: 2 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 csync provides concurrent data structures.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

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

Map is a concurrent-safe map.

func NewMap

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

NewMap creates a new concurrent 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 removes a value from the map.

func (*Map[K, V]) Get

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

Get retrieves a value from the map.

func (*Map[K, V]) Seq

func (m *Map[K, V]) Seq(fn func(K, V) bool)

Seq iterates over map entries using a callback.

func (*Map[K, V]) Seq2

func (m *Map[K, V]) Seq2() iter.Seq2[K, V]

Seq2 returns an iterator over key-value pairs.

func (*Map[K, V]) Set

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

Set stores a value in the map.

func (*Map[K, V]) Values

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

Values returns an iterator over values only.

type Slice

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

Slice is a concurrent-safe slice.

func NewSlice

func NewSlice[T any]() *Slice[T]

NewSlice creates a new concurrent-safe slice.

func (*Slice[T]) Append

func (s *Slice[T]) Append(item T)

Append appends an item to the slice.

func (*Slice[T]) Clear

func (s *Slice[T]) Clear()

Clear removes all items from the slice.

func (*Slice[T]) Get

func (s *Slice[T]) Get(index int) (T, bool)

Get returns the item at the given index.

func (*Slice[T]) Items

func (s *Slice[T]) Items() []T

Items returns a copy of all items.

func (*Slice[T]) Len

func (s *Slice[T]) Len() int

Len returns the length of the slice.

func (*Slice[T]) Range

func (s *Slice[T]) Range(fn func(int, T) bool)

Range iterates over the slice.

func (*Slice[T]) Seq

func (s *Slice[T]) Seq() iter.Seq[T]

Seq returns an iterator over the slice items.

func (*Slice[T]) Set

func (s *Slice[T]) Set(items []T)

Set replaces all items in the slice.

func (*Slice[T]) SetSlice

func (s *Slice[T]) SetSlice(items []T)

SetSlice replaces all items in the slice (alias for Set).

Jump to

Keyboard shortcuts

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