generic_types

package
v0.0.0-...-c8ab140 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package generic_types contains underlying Go implementation of types that will be used in text templates to generate specific implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GenericMapItem

type GenericMapItem struct {
	Key   GenericMapKeyType
	Value GenericMapValueType
}

type GenericMapKeyType

type GenericMapKeyType int

GenericMapKeyType is a placeholder for types used as keys in maps or values in slices.

type GenericMapType

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

GenericMapType is a persistent key - value map

func NewGenericMapType

func NewGenericMapType(items ...GenericMapItem) *GenericMapType

NewGenericMapType returns a new GenericMapType containing all items in items.

func NewGenericMapTypeFromNativeMap

func NewGenericMapTypeFromNativeMap(m map[GenericMapKeyType]GenericMapValueType) *GenericMapType

NewGenericMapTypeFromNativeMap returns a new GenericMapType containing all items in m.

func (*GenericMapType) Delete

Delete returns a new GenericMapType without the element identified by key.

func (*GenericMapType) Len

func (m *GenericMapType) Len() int

Len returns the number of items in m.

func (*GenericMapType) Load

func (m *GenericMapType) Load(key GenericMapKeyType) (value GenericMapValueType, ok bool)

Load returns value identified by key. ok is set to true if key exists in the map, false otherwise.

func (*GenericMapType) Range

Range calls f repeatedly passing it each key and value as argument until either all elements have been visited or f returns false.

func (*GenericMapType) Store

Store returns a new GenericMapType containing value identified by key.

func (*GenericMapType) ToNativeMap

ToNativeMap returns a native Go map containing all elements of m.

type GenericMapValueType

type GenericMapValueType int

GenericMapValueType is a placeholder for types used as values in maps.

type GenericSetType

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

GenericSetType is a persistent set

func NewGenericSetType

func NewGenericSetType(items ...GenericMapKeyType) *GenericSetType

NewGenericSetType returns a new GenericSetType containing items.

func (*GenericSetType) Add

Add returns a new GenericSetType containing item.

func (*GenericSetType) Contains

func (s *GenericSetType) Contains(item GenericMapKeyType) bool

Contains returns true if item is present in s, false otherwise.

func (*GenericSetType) Delete

Delete returns a new GenericSetType without item.

func (*GenericSetType) Difference

func (s *GenericSetType) Difference(other *GenericSetType) *GenericSetType

Difference returns a new GenericSetType containing all elements present in s but not in other.

func (*GenericSetType) Equals

func (s *GenericSetType) Equals(other *GenericSetType) bool

Equals returns true if s and other contains the same elements, false otherwise.

func (*GenericSetType) Intersection

func (s *GenericSetType) Intersection(other *GenericSetType) *GenericSetType

Intersection returns a new GenericSetType containing all elements present in both s and other.

func (*GenericSetType) IsSubset

func (s *GenericSetType) IsSubset(other *GenericSetType) bool

IsSubset returns true if all elements in s are present in other, false otherwise.

func (*GenericSetType) IsSuperset

func (s *GenericSetType) IsSuperset(other *GenericSetType) bool

IsSuperset returns true if all elements in other are present in s, false otherwise.

func (*GenericSetType) Len

func (s *GenericSetType) Len() int

Len returns the number of elements in s.

func (*GenericSetType) Range

func (s *GenericSetType) Range(f func(GenericMapKeyType) bool)

Range calls f repeatedly passing it each element in s as argument until either all elements have been visited or f returns false.

func (*GenericSetType) SymmetricDifference

func (s *GenericSetType) SymmetricDifference(other *GenericSetType) *GenericSetType

SymmetricDifference returns a new GenericSetType containing all elements present in either s or other but not both.

func (*GenericSetType) ToNativeSlice

func (s *GenericSetType) ToNativeSlice() []GenericMapKeyType

ToNativeSlice returns a native Go slice containing all elements of s.

func (*GenericSetType) Union

func (s *GenericSetType) Union(other *GenericSetType) *GenericSetType

Union returns a new GenericSetType containing all elements present in either s or other.

type GenericType

type GenericType int

GenericType is a placeholder for types contained in vectors or slices.

type GenericVectorType

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

A GenericVectorType is an ordered persistent/immutable collection of items corresponding roughly to the use cases for a slice.

func NewGenericVectorType

func NewGenericVectorType(items ...GenericType) *GenericVectorType

NewGenericVectorType returns a new GenericVectorType containing the items provided in items.

func (*GenericVectorType) Append

func (v *GenericVectorType) Append(item ...GenericType) *GenericVectorType

Append returns a new vector with item(s) appended to it.

func (*GenericVectorType) Get

func (v *GenericVectorType) Get(i int) GenericType

Get returns the element at position i.

func (*GenericVectorType) Len

func (v *GenericVectorType) Len() int

Len returns the length of v.

func (*GenericVectorType) Range

func (v *GenericVectorType) Range(f func(GenericType) bool)

Range calls f repeatedly passing it each element in v in order as argument until either all elements have been visited or f returns false.

func (*GenericVectorType) Set

Set returns a new vector with the element at position i set to item.

func (*GenericVectorType) Slice

func (v *GenericVectorType) Slice(start, stop int) *GenericVectorTypeSlice

Slice returns a GenericVectorTypeSlice that refers to all elements [start,stop) in v.

func (*GenericVectorType) ToNativeSlice

func (v *GenericVectorType) ToNativeSlice() []GenericType

ToNativeSlice returns a Go slice containing all elements of v

type GenericVectorTypeSlice

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

GenericVectorTypeSlice is a slice type backed by a GenericVectorType.

func NewGenericVectorTypeSlice

func NewGenericVectorTypeSlice(items ...GenericType) *GenericVectorTypeSlice

NewGenericVectorTypeSlice returns a new NewGenericVectorTypeSlice containing the items provided in items.

func (*GenericVectorTypeSlice) Append

Append returns a new slice with item(s) appended to it.

func (*GenericVectorTypeSlice) Get

Get returns the element at position i.

func (*GenericVectorTypeSlice) Len

func (s *GenericVectorTypeSlice) Len() int

Len returns the length of s.

func (*GenericVectorTypeSlice) Range

func (s *GenericVectorTypeSlice) Range(f func(GenericType) bool)

Range calls f repeatedly passing it each element in s in order as argument until either all elements have been visited or f returns false.

func (*GenericVectorTypeSlice) Set

Set returns a new slice with the element at position i set to item.

func (*GenericVectorTypeSlice) Slice

func (s *GenericVectorTypeSlice) Slice(start, stop int) *GenericVectorTypeSlice

Slice returns a GenericVectorTypeSlice that refers to all elements [start,stop) in s.

Jump to

Keyboard shortcuts

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