set

package
v2.1.8 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package set provides generic set data structure implementation and string utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains(array []string, str string) bool

Contains checks if a string is present in an array of strings.

func StringifyArray

func StringifyArray(node *syntax.Assign) []string

StringifyArray generates a string representation of an array in the given syntax.

node: A pointer to the syntax.Assign node representing the array. []string: An array of strings representing the stringified elements of the array.

func StringifyAssign

func StringifyAssign(node *syntax.Assign) (string, error)

StringifyAssign returns a string representation of the given *syntax.Assign node.

It takes a pointer to a *syntax.Assign node as its parameter. It returns a string and an error.

func StringifyFuncDecl

func StringifyFuncDecl(node *syntax.FuncDecl) (string, error)

StringifyFuncDecl converts a syntax.FuncDecl node to a string representation.

It takes a pointer to a syntax.FuncDecl node as a parameter and returns a string and an error.

Types

type Set

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

Set represents a simple set data structure implemented using a map.

func NewSet

func NewSet() *Set

NewSet creates a new Set.

It initializes a new Set with an empty map and returns a pointer to it. The returned Set is ready to use. Returns a pointer to the newly created Set.

func (*Set) Add

func (s *Set) Add(value string)

Add adds a value to the Set.

value: the value to be added.

func (*Set) Contains

func (s *Set) Contains(value string) bool

Contains checks if the given value is present in the set.

value: the value to check for. bool: true if the value is present, false otherwise.

func (*Set) Iter

func (s *Set) Iter() <-chan string

Iter returns a channel that iterates over the elements of the set.

It returns a channel of type string.

func (*Set) Remove

func (s *Set) Remove(value string)

Remove removes the specified value from the set.

value: the value to be removed from the set.

Jump to

Keyboard shortcuts

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