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 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

Package common imports 3 packages (graph) and is imported by 19 packages. Updated 2018-07-04. Refresh now. Tools for package owners.