goworld: github.com/xiaonanln/goworld/engine/common Index | Files

package common

import "github.com/xiaonanln/goworld/engine/common"

Index

Package Files

collections.go entityid_set.go hash.go types.go

Constants

const CLIENTID_LENGTH = uuid.UUID_LENGTH

CLIENTID_LENGTH is the length of Client IDs

const ENTITYID_LENGTH = uuid.UUID_LENGTH

ENTITYID_LENGTH is the length of Entity IDs

func Hash Uses

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

Hash return hash of the given data.

type ClientID Uses

type ClientID string

ClientID type

func GenClientID Uses

func GenClientID() ClientID

GenClientID generates a new Client ID

func (ClientID) IsNil Uses

func (id ClientID) IsNil() bool

IsNil returns if ClientID is nil

type EntityID Uses

type EntityID string

EntityID type

func GenEntityID Uses

func GenEntityID() EntityID

GenEntityID generates a new EntityID

func MustEntityID Uses

func MustEntityID(id string) EntityID

MustEntityID assures a string to be EntityID

func (EntityID) IsNil Uses

func (id EntityID) IsNil() bool

IsNil returns if EntityID is nil

type EntityIDSet Uses

type EntityIDSet map[EntityID]struct{}

EntityIDSet is the data structure for a set of entity IDs

func (EntityIDSet) Add Uses

func (es EntityIDSet) Add(id EntityID)

Add adds an entity ID to EntityIDSet

func (EntityIDSet) Contains Uses

func (es EntityIDSet) Contains(id EntityID) bool

Contains checks if entity ID is in EntityIDSet

func (EntityIDSet) Del Uses

func (es EntityIDSet) Del(id EntityID)

Del removes an entity ID from EntityIDSet

func (EntityIDSet) ForEach Uses

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

func (EntityIDSet) ToList Uses

func (es EntityIDSet) ToList() []EntityID

ToList convert EntityIDSet to a slice of entity IDs

type IntSet Uses

type IntSet map[int]struct{}

IntSet is a set of int

func (IntSet) Add Uses

func (is IntSet) Add(elem int)

Add adds the string to IntSet

func (IntSet) Contains Uses

func (is IntSet) Contains(elem int) bool

Contains checks if Stringset contains the string

func (IntSet) Remove Uses

func (is IntSet) Remove(elem int)

Remove removes the string from IntSet

func (IntSet) ToList Uses

func (is IntSet) ToList() []int

ToList convert IntSet to int slice

type StringList Uses

type StringList []string

StringList is a list of string (slice)

func (*StringList) Append Uses

func (sl *StringList) Append(elem string)

Append add the string to the end of StringList

func (*StringList) Find Uses

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

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

func (*StringList) Remove Uses

func (sl *StringList) Remove(elem string)

Remove removes the string from StringList

type StringSet Uses

type StringSet map[string]struct{}

StringSet is a set of strings

func (StringSet) Add Uses

func (ss StringSet) Add(elem string)

Add adds the string to StringSet

func (StringSet) Contains Uses

func (ss StringSet) Contains(elem string) bool

Contains checks if Stringset contains the string

func (StringSet) Remove Uses

func (ss StringSet) Remove(elem string)

Remove removes the string from StringList

func (StringSet) ToList Uses

func (ss StringSet) ToList() []string

ToList convert StringSet to string slice

type Uint16Set Uses

type Uint16Set map[uint16]struct{}

Uint16Set is a set of int

func (Uint16Set) Add Uses

func (is Uint16Set) Add(elem uint16)

Add adds the string to Uint16Set

func (Uint16Set) Contains Uses

func (is Uint16Set) Contains(elem uint16) bool

Contains checks if Stringset contains the string

func (Uint16Set) Remove Uses

func (is Uint16Set) Remove(elem uint16)

Remove removes the string from Uint16Set

func (Uint16Set) ToList Uses

func (is Uint16Set) ToList() []uint16

ToList convert Uint16Set to int slice

Package common imports 3 packages (graph) and is imported by 21 packages. Updated 2018-09-14. Refresh now. Tools for package owners.