storage

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2018 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is raised when a mandatory resource is not found in storage.
	ErrNotFound = errors.New("no results found")
)

Functions

This section is empty.

Types

type Ability

type Ability struct {
	ID            [16]byte
	Type          [16]byte
	Name          string
	MPConsumption uint64
	CD            uint32
	CurrentCD     uint32
	Components    []interface{}
}

func NewAbility

func NewAbility(a ability.A) *Ability

NewAbility convert a ability.A into a storage Ability.

func (Ability) Domain

func (a Ability) Domain() ability.A

Domain converts a storage Ability into a game Ability.

func (*Ability) Marshal

func (d *Ability) Marshal(buf []byte) ([]byte, error)

func (*Ability) Size

func (d *Ability) Size() (s uint64)

func (*Ability) Unmarshal

func (d *Ability) Unmarshal(buf []byte) (uint64, error)

type AbilityFeedback

type AbilityFeedback struct {
	ID         [16]byte
	AbilityID  [16]byte
	Components []interface{}
}

func NewAbilityFeedback

func NewAbilityFeedback(fb ability.Feedback) *AbilityFeedback

NewAbilityFeedback converts a game AbilityFeedback into a storage AbilityFeedback.

func (AbilityFeedback) Domain

func (a AbilityFeedback) Domain() ability.Feedback

Domain converts a storage AbilityFeedback into a game AbilityFeedback.

func (*AbilityFeedback) Marshal

func (d *AbilityFeedback) Marshal(buf []byte) ([]byte, error)

func (*AbilityFeedback) Size

func (d *AbilityFeedback) Size() (s uint64)

func (*AbilityFeedback) Unmarshal

func (d *AbilityFeedback) Unmarshal(buf []byte) (uint64, error)

type Account

type Account struct {
	ID       [16]byte
	Username string
	Password string
	Token    [16]byte
}

func NewAccount

func NewAccount(a account.A) *Account

NewAccount converts a domain account into a storage account.

func (*Account) Domain

func (a *Account) Domain(username string) (account.A, error)

Domain converts a storage user into a domain user.

func (*Account) Marshal

func (d *Account) Marshal(buf []byte) ([]byte, error)

func (*Account) Size

func (d *Account) Size() (s uint64)

func (*Account) Unmarshal

func (d *Account) Unmarshal(buf []byte) (uint64, error)

type BondPoint

type BondPoint struct {
	ID       [16]byte
	SectorID [16]byte
	X        float64
	Y        float64
	Z        float64
}

func (*BondPoint) Marshal

func (d *BondPoint) Marshal(buf []byte) ([]byte, error)

func (*BondPoint) Size

func (d *BondPoint) Size() (s uint64)

func (*BondPoint) Unmarshal

func (d *BondPoint) Unmarshal(buf []byte) (uint64, error)

type Cast

type Cast struct {
	AbilityID [16]byte
	Source    [16]byte
	Targets   [][16]byte
	Position  Vec3
}

func NewCast

func NewCast(c event.Cast) Cast

NewCast convert a event.Cast into a storage Cast.

func (Cast) Domain

func (c Cast) Domain() event.Cast

Domain converts a storage Cast into a game Cast.

func (*Cast) Marshal

func (d *Cast) Marshal(buf []byte) ([]byte, error)

func (*Cast) Size

func (d *Cast) Size() (s uint64)

func (*Cast) Unmarshal

func (d *Cast) Unmarshal(buf []byte) (uint64, error)

type DamageDirect

type DamageDirect struct {
	Amount uint64
	Type   uint8
}

func NewDamageDirect

func NewDamageDirect(c ability.DamageDirect) DamageDirect

NewDamageDirect converts a domain DamageDirect into a storage DamageDirect.

func (DamageDirect) Domain

func (c DamageDirect) Domain() ability.DamageDirect

Domain converts a storage DamageDirect into a domain DamageDirect.

func (*DamageDirect) Marshal

func (d *DamageDirect) Marshal(buf []byte) ([]byte, error)

func (*DamageDirect) Size

func (d *DamageDirect) Size() (s uint64)

func (*DamageDirect) Unmarshal

func (d *DamageDirect) Unmarshal(buf []byte) (uint64, error)

type DamageDirectFeedback

type DamageDirectFeedback struct {
	Amount int64
}

func NewDamageDirectFeedback

func NewDamageDirectFeedback(fb ability.DamageDirectFeedback) DamageDirectFeedback

NewDamageDirectFeedback converts a game DamageDirectFeedback into a storage DamageDirectFeedback.

func (DamageDirectFeedback) Domain

Domain converts a DamageDirectFeedback storage into a DamageDirectFeedback domain.

func (*DamageDirectFeedback) Marshal

func (d *DamageDirectFeedback) Marshal(buf []byte) ([]byte, error)

func (*DamageDirectFeedback) Size

func (d *DamageDirectFeedback) Size() (s uint64)

func (*DamageDirectFeedback) Unmarshal

func (d *DamageDirectFeedback) Unmarshal(buf []byte) (uint64, error)

type DamageOverTime

type DamageOverTime struct {
	Amount    uint64
	Type      uint8
	Frequency uint64
	Duration  uint64
}

func NewDamageOverTime

func NewDamageOverTime(c ability.DamageOverTime) DamageOverTime

NewDamageOverTime converts a domain DamageOverTime into a storage DamageOverTime.

func (DamageOverTime) Domain

Domain converts a storage DamageOverTime into a domain DamageOverTime.

func (*DamageOverTime) Marshal

func (d *DamageOverTime) Marshal(buf []byte) ([]byte, error)

func (*DamageOverTime) Size

func (d *DamageOverTime) Size() (s uint64)

func (*DamageOverTime) Unmarshal

func (d *DamageOverTime) Unmarshal(buf []byte) (uint64, error)

type DamageOverTimeFeedback

type DamageOverTimeFeedback struct {
}

func NewDamageOverTimeFeedback

func NewDamageOverTimeFeedback(fb ability.DamageOverTimeFeedback) DamageOverTimeFeedback

NewDamageOverTimeFeedback converts a game DamageOverTimeFeedback into a storage DamageOverTimeFeedback.

func (DamageOverTimeFeedback) Domain

Domain converts a DamageOverTimeFeedback storage into a DamageOverTimeFeedback domain.

func (*DamageOverTimeFeedback) Marshal

func (d *DamageOverTimeFeedback) Marshal(buf []byte) ([]byte, error)

func (*DamageOverTimeFeedback) Size

func (d *DamageOverTimeFeedback) Size() (s uint64)

func (*DamageOverTimeFeedback) Unmarshal

func (d *DamageOverTimeFeedback) Unmarshal(buf []byte) (uint64, error)

type Entity

type Entity struct {
	ID       [16]byte
	Type     [16]byte
	Name     string
	HP       uint64
	MP       uint64
	SectorID [16]byte
	X        float64
	Y        float64
	Z        float64
}

func NewEntity

func NewEntity(e entity.E) *Entity

NewEntity convert a entity.E into a storage Entity.

func (Entity) Domain

func (e Entity) Domain() entity.E

Domain converts a storage Entity into a game Entity.

func (*Entity) Marshal

func (d *Entity) Marshal(buf []byte) ([]byte, error)

func (*Entity) Size

func (d *Entity) Size() (s uint64)

func (*Entity) Unmarshal

func (d *Entity) Unmarshal(buf []byte) (uint64, error)

type Event

type Event struct {
	ID     [16]byte
	Source [16]byte
	TS     int64
	Action interface{}
}

func NewEvent

func NewEvent(ev event.E) *Event

NewEvent converts a domain event to a storage event.

func (Event) Domain

func (e Event) Domain() event.E

Domain converts a storage user into a domain user.

func (*Event) Marshal

func (d *Event) Marshal(buf []byte) ([]byte, error)

func (*Event) Size

func (d *Event) Size() (s uint64)

func (*Event) Unmarshal

func (d *Event) Unmarshal(buf []byte) (uint64, error)

type Feedback

type Feedback struct {
	AbilityID [16]byte
	Source    [16]byte
	Target    [16]byte
}

func NewFeedback

func NewFeedback(fb event.Feedback) Feedback

NewFeedback convert a event.Feedback into a storage Feedback.

func (Feedback) Domain

func (fb Feedback) Domain() event.Feedback

Domain converts a storage Feedback into a game Feedback.

func (*Feedback) Marshal

func (d *Feedback) Marshal(buf []byte) ([]byte, error)

func (*Feedback) Size

func (d *Feedback) Size() (s uint64)

func (*Feedback) Unmarshal

func (d *Feedback) Unmarshal(buf []byte) (uint64, error)

type HealDirect

type HealDirect struct {
	Amount uint64
	Type   uint8
}

func NewHealDirect

func NewHealDirect(c ability.HealDirect) HealDirect

NewHealDirect converts a domain HealDirect into a storage HealDirect.

func (HealDirect) Domain

func (c HealDirect) Domain() ability.HealDirect

Domain converts a storage HealDirect into a domain HealDirect.

func (*HealDirect) Marshal

func (d *HealDirect) Marshal(buf []byte) ([]byte, error)

func (*HealDirect) Size

func (d *HealDirect) Size() (s uint64)

func (*HealDirect) Unmarshal

func (d *HealDirect) Unmarshal(buf []byte) (uint64, error)

type HealDirectFeedback

type HealDirectFeedback struct {
	Amount int64
}

func NewHealDirectFeedback

func NewHealDirectFeedback(fb ability.HealDirectFeedback) HealDirectFeedback

NewHealDirectFeedback converts a game HealDirectFeedback into a storage HealDirectFeedback.

func (HealDirectFeedback) Domain

Domain converts a HealDirectFeedback storage into a HealDirectFeedback domain.

func (*HealDirectFeedback) Marshal

func (d *HealDirectFeedback) Marshal(buf []byte) ([]byte, error)

func (*HealDirectFeedback) Size

func (d *HealDirectFeedback) Size() (s uint64)

func (*HealDirectFeedback) Unmarshal

func (d *HealDirectFeedback) Unmarshal(buf []byte) (uint64, error)

type HealOverTime

type HealOverTime struct {
	Amount    uint64
	Type      uint8
	Frequency uint64
	Duration  uint64
}

func NewHealOverTime

func NewHealOverTime(c ability.HealOverTime) HealOverTime

NewHealOverTime converts a domain HealOverTime into a storage HealOverTime.

func (HealOverTime) Domain

func (c HealOverTime) Domain() ability.HealOverTime

Domain converts a storage HealOverTime into a domain HealOverTime.

func (*HealOverTime) Marshal

func (d *HealOverTime) Marshal(buf []byte) ([]byte, error)

func (*HealOverTime) Size

func (d *HealOverTime) Size() (s uint64)

func (*HealOverTime) Unmarshal

func (d *HealOverTime) Unmarshal(buf []byte) (uint64, error)

type HealOverTimeFeedback

type HealOverTimeFeedback struct {
}

func NewHealOverTimeFeedback

func NewHealOverTimeFeedback(fb ability.HealOverTimeFeedback) HealOverTimeFeedback

NewHealOverTimeFeedback converts a game HealOverTimeFeedback into a storage HealOverTimeFeedback.

func (HealOverTimeFeedback) Domain

Domain converts a HealOverTimeFeedback storage into a HealOverTimeFeedback domain.

func (*HealOverTimeFeedback) Marshal

func (d *HealOverTimeFeedback) Marshal(buf []byte) ([]byte, error)

func (*HealOverTimeFeedback) Size

func (d *HealOverTimeFeedback) Size() (s uint64)

func (*HealOverTimeFeedback) Unmarshal

func (d *HealOverTimeFeedback) Unmarshal(buf []byte) (uint64, error)

type Listener

type Listener struct {
	ID     [16]byte
	Action uint8
	Pool   [16]byte
}

func NewListener

func NewListener(listener event.Listener) *Listener

NewListener converts a domain listener to a storage listener.

func (Listener) Domain

func (l Listener) Domain() event.Listener

Domain converts a storage user into a domain user.

func (*Listener) Marshal

func (d *Listener) Marshal(buf []byte) ([]byte, error)

func (*Listener) Size

func (d *Listener) Size() (s uint64)

func (*Listener) Unmarshal

func (d *Listener) Unmarshal(buf []byte) (uint64, error)

type Move

type Move struct {
	Source   [16]byte
	Target   [16]byte
	Position Vec3
}

func NewMove

func NewMove(m event.Move) Move

NewMove convert a event.Move into a storage Move.

func (Move) Domain

func (m Move) Domain() event.Move

Domain converts a storage Move into a game Move.

func (*Move) Marshal

func (d *Move) Marshal(buf []byte) ([]byte, error)

func (*Move) Size

func (d *Move) Size() (s uint64)

func (*Move) Unmarshal

func (d *Move) Unmarshal(buf []byte) (uint64, error)

type Recurrer

type Recurrer struct {
	ID       [16]byte
	EntityID [16]byte
	TokenID  [16]byte
	Action   uint8
	Pool     [16]byte
}

func NewRecurrer

func NewRecurrer(recurrer event.Recurrer) *Recurrer

NewRecurrer converts a domain recurrer to a storage recurrer.

func (Recurrer) Domain

func (r Recurrer) Domain() event.Recurrer

Domain converts a storage user into a domain user.

func (*Recurrer) Marshal

func (d *Recurrer) Marshal(buf []byte) ([]byte, error)

func (*Recurrer) Size

func (d *Recurrer) Size() (s uint64)

func (*Recurrer) Unmarshal

func (d *Recurrer) Unmarshal(buf []byte) (uint64, error)

type Sector

type Sector struct {
	ID         [16]byte
	X          float64
	Y          float64
	Z          float64
	BondPoints []BondPoint
}

func NewSector

func NewSector(sector sector.S) *Sector

NewSector converts a domain sector into a storage sector.

func (*Sector) Domain

func (s *Sector) Domain() sector.S

Domain converts a storage sector into a domain sector.

func (*Sector) Marshal

func (d *Sector) Marshal(buf []byte) ([]byte, error)

func (*Sector) Size

func (d *Sector) Size() (s uint64)

func (*Sector) Unmarshal

func (d *Sector) Unmarshal(buf []byte) (uint64, error)

type SectorEntities

type SectorEntities struct {
	SectorID  [16]byte
	EntityIDs [][16]byte
}

func NewSectorEntities

func NewSectorEntities(se sector.Entities) *SectorEntities

NewSectorEntities converts a domain se into a storage se.

func (*SectorEntities) Domain

func (se *SectorEntities) Domain() sector.Entities

Domain converts a storage sector entities into a domain sector entities.

func (*SectorEntities) Marshal

func (d *SectorEntities) Marshal(buf []byte) ([]byte, error)

func (*SectorEntities) Size

func (d *SectorEntities) Size() (s uint64)

func (*SectorEntities) Unmarshal

func (d *SectorEntities) Unmarshal(buf []byte) (uint64, error)

type Token

type Token struct {
	ID       [16]byte
	IP       string
	Account  [16]byte
	Ping     uint64
	CorePool [16]byte
	SyncPool [16]byte
	PC       [16]byte
	Entity   [16]byte
}

func NewToken

func NewToken(tok account.Token) *Token

NewToken converts a domain token into a storage token.

func (*Token) Domain

func (t *Token) Domain() (account.Token, error)

Domain converts a storage token into a domain token.

func (*Token) Marshal

func (d *Token) Marshal(buf []byte) ([]byte, error)

func (*Token) Size

func (d *Token) Size() (s uint64)

func (*Token) Unmarshal

func (d *Token) Unmarshal(buf []byte) (uint64, error)

type Vec3

type Vec3 struct {
	X float64
	Y float64
	Z float64
}

func (*Vec3) Marshal

func (d *Vec3) Marshal(buf []byte) ([]byte, error)

func (*Vec3) Size

func (d *Vec3) Size() (s uint64)

func (*Vec3) Unmarshal

func (d *Vec3) Unmarshal(buf []byte) (uint64, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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