asset

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxItemNameLen        = 256
	MaxItemDescriptionLen = 4096

	DefaultItemFilterLimit = 50
	MaxItemFilterLimit     = 100
)
View Source
const (
	LocationTypeRoom = LocationType(iota)
	LocationTypePlayer
	LocationTypeItem
)
View Source
const (
	MaxLinkNameLen        = 256
	MaxLinkDescriptionLen = 4096

	DefaultLinkFilterLimit = 50
	MaxLinkFilterLimit     = 100
)
View Source
const (
	MaxPlayerNameLen        = 256
	MaxPlayerDescriptionLen = 4096

	DefaultPlayerFilterLimit = 50
	MaxPlayerFilterLimit     = 100
)
View Source
const (
	MaxRoomNameLen        = 256
	MaxRoomDescriptionLen = 4096

	DefaultRoomFilterLimit = 50
	MaxRoomFilterLimit     = 100
)

Variables

View Source
var (
	NilLinkID = LinkID(uuid.Nil)
)
View Source
var (
	NilLocationID = LocationID(uuid.Nil)
)
View Source
var (
	NilPlayerID = PlayerID(uuid.Nil)
)
View Source
var (
	NilRoomID = RoomID(uuid.Nil)
)

Functions

This section is empty.

Types

type Item

type Item struct {
	ID          ItemID
	Name        string
	Description string
	OwnerID     PlayerID
	LocationID  ItemLocationID
	Created     arcade.Timestamp
	Updated     arcade.Timestamp
}

Item is the internal representation of an item.

type ItemChange

type ItemChange struct {
	Name        string
	Description string
	OwnerID     PlayerID
	LocationID  ItemLocationID
}

ItemChange holds information to change an item.

type ItemCreate

type ItemCreate struct {
	ItemChange
}

ItemCreate is used to create an item.

type ItemFilter

type ItemFilter struct {
	// OwnerID filters for items owned by the given player.
	OwnerID PlayerID

	// LocationID filters for items in the given location.
	LocationID ItemLocationID

	// Offset is used to restrict to a subset of the results,
	// indicating the initial offset into the set of results.
	Offset uint

	// Limit is used to restrict to a subset of the results,
	// indicating the maximum number of results to return.
	Limit uint
}

ItemFilter is used to filter results from a list of all items.

type ItemID

type ItemID uuid.UUID

ItemID is the unique identifier of an item.

func (ItemID) ID

func (i ItemID) ID() LocationID

func (*ItemID) Scan

func (i *ItemID) Scan(src any) error

func (ItemID) String

func (i ItemID) String() string

func (ItemID) Type

func (i ItemID) Type() LocationType

func (ItemID) Value

func (i ItemID) Value() (driver.Value, error)

type ItemLocationID

type ItemLocationID interface {
	ID() LocationID
	Type() LocationType
}

ItemLocationID defines the expected behavior of an object that contain an item.

type ItemUpdate

type ItemUpdate struct {
	ItemChange
}

ItemUpdate is used to update an item.

type Link struct {
	ID            LinkID
	Name          string
	Description   string
	OwnerID       PlayerID
	LocationID    RoomID
	DestinationID RoomID
	Created       arcade.Timestamp
	Updated       arcade.Timestamp
}

Link is the internal representation of a link.

type LinkChange

type LinkChange struct {
	Name          string
	Description   string
	OwnerID       PlayerID
	LocationID    RoomID
	DestinationID RoomID
}

LinkChange holds information to change an item.

type LinkCreate

type LinkCreate struct {
	LinkChange
}

LinkCreate is used to create an item.

type LinkFilter

type LinkFilter struct {
	// OwnerID filters for links owned by a given link.
	OwnerID PlayerID

	// LocationID filters for links located in a location link.
	LocationID RoomID

	// DestinationID filters for links connected to the given destination.
	DestinationID RoomID

	// Offset is used to restrict to a subset of the results,
	// indicating the initial offset into the set of results.
	Offset uint

	// Limit is used to restrict to a subset of the results,
	// indicating the maximum number of results to return.
	Limit uint
}

LinkFilter is used to filter results from a List.

type LinkID

type LinkID uuid.UUID

LinkID is the unique identifier of a link.

func (*LinkID) Scan

func (l *LinkID) Scan(src any) error

func (LinkID) String

func (l LinkID) String() string

func (LinkID) Value

func (l LinkID) Value() (driver.Value, error)

type LinkUpdate

type LinkUpdate struct {
	LinkChange
}

LinkUpdate is used to update an item.

type LocationID

type LocationID uuid.UUID

LocationID provides the ID of the item's location.

func (*LocationID) Scan

func (l *LocationID) Scan(src any) error

func (LocationID) String

func (l LocationID) String() string

func (LocationID) Value

func (l LocationID) Value() (driver.Value, error)

type LocationType

type LocationType uint8

LocationType provides the type of location, room, player, or item.

func (LocationType) String

func (t LocationType) String() string

type Player

type Player struct {
	ID          PlayerID
	Name        string
	Description string
	HomeID      RoomID
	LocationID  RoomID
	Created     arcade.Timestamp
	Updated     arcade.Timestamp
}

Player is the internal representation of the data related to a player.

type PlayerChange

type PlayerChange struct {
	Name        string
	Description string
	HomeID      RoomID
	LocationID  RoomID
}

PlayerChange holds information to change an item.

type PlayerCreate

type PlayerCreate struct {
	PlayerChange
}

PlayerCreate is used to create an item.

type PlayerFilter

type PlayerFilter struct {
	// LocationID filters for players in a given location.
	LocationID RoomID

	// Offset is used to restrict to a subset of the results,
	// indicating the initial offset into the set of results.
	Offset uint

	// Limit is used to restrict to a subset of the results,
	// indicating the maximum number of results to return.
	Limit uint
}

PlayerFilter is used to filter results from List.

type PlayerID

type PlayerID uuid.UUID

PlayerID is the unique identifier of an player.

func (PlayerID) ID

func (p PlayerID) ID() LocationID

func (*PlayerID) Scan

func (p *PlayerID) Scan(src any) error

func (PlayerID) String

func (p PlayerID) String() string

func (PlayerID) Type

func (p PlayerID) Type() LocationType

func (PlayerID) Value

func (p PlayerID) Value() (driver.Value, error)

type PlayerUpdate

type PlayerUpdate struct {
	PlayerChange
}

PlayerUpdate is used to update an item.

type Room

type Room struct {
	ID          RoomID
	Name        string
	Description string
	OwnerID     PlayerID
	ParentID    RoomID
	Created     arcade.Timestamp
	Updated     arcade.Timestamp
}

Room is the internal representation of the data related to a room.

type RoomChange

type RoomChange struct {
	Name        string
	Description string
	OwnerID     PlayerID
	ParentID    RoomID
}

RoomChange holds information to change an item.

type RoomCreate

type RoomCreate struct {
	RoomChange
}

RoomCreate is used to create an item.

type RoomFilter

type RoomFilter struct {
	// OwnerID filters for rooms owned by a given room.
	OwnerID PlayerID

	// ParentID filters for rooms located in a parent room (non-recursive).
	ParentID RoomID

	// Offset is used to restrict to a subset of the results,
	// indicating the initial offset into the set of results.
	Offset uint

	// Limit is used to restrict to a subset of the results,
	// indicating the maximum number of results to return.
	Limit uint
}

RoomFilter is used to filter results from a List.

type RoomID

type RoomID uuid.UUID

RoomID is the unique identifier of an room.

func (RoomID) ID

func (r RoomID) ID() LocationID

func (*RoomID) Scan

func (r *RoomID) Scan(src any) error

func (RoomID) String

func (r RoomID) String() string

func (RoomID) Type

func (r RoomID) Type() LocationType

func (RoomID) Value

func (r RoomID) Value() (driver.Value, error)

type RoomUpdate

type RoomUpdate struct {
	RoomChange
}

RoomUpdate is used to update an item.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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