common

package
v0.0.0-...-1c1c5e2 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const CLIENTID_LENGTH = uuid.UUID_LENGTH

CLIENTID_LENGTH is the length of Client IDs

View Source
const ENTITYID_LENGTH = uuid.UUID_LENGTH

ENTITYID_LENGTH is the length of Entity IDs

Variables

This section is empty.

Functions

func Hash

func Hash(data []byte, seed uint32) uint32

Hash return hash of the given data.

Types

type ClientID

type ClientID string

ClientID type

func GenClientID

func GenClientID() ClientID

GenClientID generates a new Client ID

func (ClientID) IsNil

func (id ClientID) IsNil() bool

IsNil returns if ClientID is nil

type EntityID

type EntityID string

EntityID type

func GenEntityID

func GenEntityID() EntityID

GenEntityID generates a new EntityID

func MustEntityID

func MustEntityID(id string) EntityID

MustEntityID assures a string to be EntityID

func (EntityID) IsNil

func (id EntityID) IsNil() bool

IsNil returns if EntityID is nil

type EntityIDSet

type EntityIDSet map[EntityID]struct{}

EntityIDSet is the data structure for a set of entity IDs

func (EntityIDSet) Add

func (es EntityIDSet) Add(id EntityID)

Add adds an entity ID to EntityIDSet

func (EntityIDSet) Contains

func (es EntityIDSet) Contains(id EntityID) bool

Contains checks if entity ID is in EntityIDSet

func (EntityIDSet) Del

func (es EntityIDSet) Del(id EntityID)

Del removes an entity ID from EntityIDSet

func (EntityIDSet) ForEach

func (es EntityIDSet) ForEach(cb func(eid EntityID) bool)

func (EntityIDSet) ToList

func (es EntityIDSet) ToList() []EntityID

ToList convert EntityIDSet to a slice of entity IDs

type IntSet

type IntSet map[int]struct{}

IntSet is a set of int

func (IntSet) Add

func (is IntSet) Add(elem int)

Add adds the string to IntSet

func (IntSet) Contains

func (is IntSet) Contains(elem int) bool

Contains checks if Stringset contains the string

func (IntSet) Remove

func (is IntSet) Remove(elem int)

Remove removes the string from IntSet

func (IntSet) ToList

func (is IntSet) ToList() []int

ToList convert IntSet to int slice

type StringList

type StringList []string

StringList is a list of string (slice)

func (*StringList) Append

func (sl *StringList) Append(elem string)

Append add the string to the end of StringList

func (*StringList) Find

func (sl *StringList) Find(s string) int

Find get the index of string in StringList, returns -1 if not found

func (*StringList) Remove

func (sl *StringList) Remove(elem string)

Remove removes the string from StringList

type StringSet

type StringSet map[string]struct{}

StringSet is a set of strings

func (StringSet) Add

func (ss StringSet) Add(elem string)

Add adds the string to StringSet

func (StringSet) Contains

func (ss StringSet) Contains(elem string) bool

Contains checks if Stringset contains the string

func (StringSet) Remove

func (ss StringSet) Remove(elem string)

Remove removes the string from StringList

func (StringSet) ToList

func (ss StringSet) ToList() []string

ToList convert StringSet to string slice

type Uint16Set

type Uint16Set map[uint16]struct{}

Uint16Set is a set of int

func (Uint16Set) Add

func (is Uint16Set) Add(elem uint16)

Add adds the string to Uint16Set

func (Uint16Set) Contains

func (is Uint16Set) Contains(elem uint16) bool

Contains checks if Stringset contains the string

func (Uint16Set) Remove

func (is Uint16Set) Remove(elem uint16)

Remove removes the string from Uint16Set

func (Uint16Set) ToList

func (is Uint16Set) ToList() []uint16

ToList convert Uint16Set to int slice

Jump to

Keyboard shortcuts

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