examples

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: 4 Imported by: 0

Documentation

Overview

Package examples contains a couple of examples of generated peds collections

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IntVector

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

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

func NewIntVector

func NewIntVector(items ...int) *IntVector

NewIntVector returns a new IntVector containing the items provided in items.

func (*IntVector) Append

func (v *IntVector) Append(item ...int) *IntVector

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

func (*IntVector) Get

func (v *IntVector) Get(i int) int

Get returns the element at position i.

func (*IntVector) Len

func (v *IntVector) Len() int

Len returns the length of v.

func (*IntVector) Range

func (v *IntVector) Range(f func(int) 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 (*IntVector) Set

func (v *IntVector) Set(i int, item int) *IntVector

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

func (*IntVector) Slice

func (v *IntVector) Slice(start, stop int) *IntVectorSlice

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

func (*IntVector) ToNativeSlice

func (v *IntVector) ToNativeSlice() []int

ToNativeSlice returns a Go slice containing all elements of v

type IntVectorSlice

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

IntVectorSlice is a slice type backed by a IntVector.

func NewIntVectorSlice

func NewIntVectorSlice(items ...int) *IntVectorSlice

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

func (*IntVectorSlice) Append

func (s *IntVectorSlice) Append(items ...int) *IntVectorSlice

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

func (*IntVectorSlice) Get

func (s *IntVectorSlice) Get(i int) int

Get returns the element at position i.

func (*IntVectorSlice) Len

func (s *IntVectorSlice) Len() int

Len returns the length of s.

func (*IntVectorSlice) Range

func (s *IntVectorSlice) Range(f func(int) 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 (*IntVectorSlice) Set

func (s *IntVectorSlice) Set(i int, item int) *IntVectorSlice

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

func (*IntVectorSlice) Slice

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

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

type Person

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

Person is a custom example type that represents a person

type PersonBySsn

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

PersonBySsn is a persistent key - value map

func NewPersonBySsn

func NewPersonBySsn(items ...PersonBySsnItem) *PersonBySsn

NewPersonBySsn returns a new PersonBySsn containing all items in items.

func NewPersonBySsnFromNativeMap

func NewPersonBySsnFromNativeMap(m map[string]Person) *PersonBySsn

NewPersonBySsnFromNativeMap returns a new PersonBySsn containing all items in m.

func (*PersonBySsn) Delete

func (m *PersonBySsn) Delete(key string) *PersonBySsn

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

func (*PersonBySsn) Len

func (m *PersonBySsn) Len() int

Len returns the number of items in m.

func (*PersonBySsn) Load

func (m *PersonBySsn) Load(key string) (value Person, ok bool)

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

func (*PersonBySsn) Range

func (m *PersonBySsn) Range(f func(string, Person) bool)

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

func (*PersonBySsn) Store

func (m *PersonBySsn) Store(key string, value Person) *PersonBySsn

Store returns a new PersonBySsn containing value identified by key.

func (*PersonBySsn) ToNativeMap

func (m *PersonBySsn) ToNativeMap() map[string]Person

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

type PersonBySsnItem

type PersonBySsnItem struct {
	Key   string
	Value Person
}

type Persons

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

Persons is a persistent set

func NewPersons

func NewPersons(items ...Person) *Persons

NewPersons returns a new Persons containing items.

func (*Persons) Add

func (s *Persons) Add(item Person) *Persons

Add returns a new Persons containing item.

func (*Persons) Contains

func (s *Persons) Contains(item Person) bool

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

func (*Persons) Delete

func (s *Persons) Delete(item Person) *Persons

Delete returns a new Persons without item.

func (*Persons) Difference

func (s *Persons) Difference(other *Persons) *Persons

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

func (*Persons) Equals

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

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

func (*Persons) Intersection

func (s *Persons) Intersection(other *Persons) *Persons

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

func (*Persons) IsSubset

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

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

func (*Persons) IsSuperset

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

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

func (*Persons) Len

func (s *Persons) Len() int

Len returns the number of elements in s.

func (*Persons) Range

func (s *Persons) Range(f func(Person) 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 (*Persons) SymmetricDifference

func (s *Persons) SymmetricDifference(other *Persons) *Persons

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

func (*Persons) ToNativeSlice

func (s *Persons) ToNativeSlice() []Person

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

func (*Persons) Union

func (s *Persons) Union(other *Persons) *Persons

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

Jump to

Keyboard shortcuts

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