Documentation
¶
Index ¶
- Constants
- func NewItemFilter(r *http.Request) (assets.ItemFilter, error)
- func NewLinkFilter(r *http.Request) (assets.LinkFilter, error)
- func NewPlayerFilter(r *http.Request) (assets.PlayerFilter, error)
- func NewRoomFilter(r *http.Request) (assets.RoomFilter, error)
- func TranslateItem(i *assets.Item) rest.Item
- func TranslateItemRequest(i rest.ItemRequest) (assets.ItemChange, error)
- func TranslateLink(l *assets.Link) rest.Link
- func TranslateLinkRequest(l rest.LinkRequest) (assets.LinkChange, error)
- func TranslatePlayer(p *assets.Player) rest.Player
- func TranslatePlayerRequest(p rest.PlayerRequest) (assets.PlayerChange, error)
- func TranslateRoom(r *assets.Room) rest.Room
- func TranslateRoomRequest(r rest.RoomRequest) (assets.RoomChange, error)
- type ItemManager
- type ItemsService
- func (s ItemsService) Create(w http.ResponseWriter, r *http.Request)
- func (s ItemsService) Get(w http.ResponseWriter, r *http.Request)
- func (s ItemsService) List(w http.ResponseWriter, r *http.Request)
- func (ItemsService) Name() string
- func (s ItemsService) Register(router *mux.Router)
- func (s ItemsService) Remove(w http.ResponseWriter, r *http.Request)
- func (ItemsService) Shutdown()
- func (s ItemsService) Update(w http.ResponseWriter, r *http.Request)
- type LinkManager
- type LinksService
- func (s LinksService) Create(w http.ResponseWriter, r *http.Request)
- func (s LinksService) Get(w http.ResponseWriter, r *http.Request)
- func (s LinksService) List(w http.ResponseWriter, r *http.Request)
- func (LinksService) Name() string
- func (s LinksService) Register(router *mux.Router)
- func (s LinksService) Remove(w http.ResponseWriter, r *http.Request)
- func (LinksService) Shutdown()
- func (s LinksService) Update(w http.ResponseWriter, r *http.Request)
- type PlayerManager
- type PlayersService
- func (s PlayersService) Create(w http.ResponseWriter, r *http.Request)
- func (s PlayersService) Get(w http.ResponseWriter, r *http.Request)
- func (s PlayersService) List(w http.ResponseWriter, r *http.Request)
- func (PlayersService) Name() string
- func (s PlayersService) Register(router *mux.Router)
- func (s PlayersService) Remove(w http.ResponseWriter, r *http.Request)
- func (PlayersService) Shutdown()
- func (s PlayersService) Update(w http.ResponseWriter, r *http.Request)
- type RoomManager
- type RoomsService
- func (s RoomsService) Create(w http.ResponseWriter, r *http.Request)
- func (s RoomsService) Get(w http.ResponseWriter, r *http.Request)
- func (s RoomsService) List(w http.ResponseWriter, r *http.Request)
- func (RoomsService) Name() string
- func (s RoomsService) Register(router *mux.Router)
- func (s RoomsService) Remove(w http.ResponseWriter, r *http.Request)
- func (RoomsService) Shutdown()
- func (s RoomsService) Update(w http.ResponseWriter, r *http.Request)
Constants ¶
const (
V1ItemsRoute string = "/v1/items"
)
const (
V1LinksRoute string = "/v1/links"
)
const (
V1PlayersRoute string = "/v1/players"
)
const (
V1RoomsRoute string = "/v1/rooms"
)
Variables ¶
This section is empty.
Functions ¶
func NewItemFilter ¶
func NewItemFilter(r *http.Request) (assets.ItemFilter, error)
NewItemFilter creates an assets items filter from the the given request's query parameters.
func NewLinkFilter ¶
func NewLinkFilter(r *http.Request) (assets.LinkFilter, error)
NewLinkFilter creates an assets links filter from the the given request's URL query parameters.
func NewPlayerFilter ¶
func NewPlayerFilter(r *http.Request) (assets.PlayerFilter, error)
NewPlayerFilter creates an assets players filter from the given request's URL query parameters.
func NewRoomFilter ¶
func NewRoomFilter(r *http.Request) (assets.RoomFilter, error)
NewRoomFilter creates an assets rooms filter from the given request's URL query parameters.
func TranslateItem ¶
TranslateItem translates an assets item to a network item.
func TranslateItemRequest ¶
func TranslateItemRequest(i rest.ItemRequest) (assets.ItemChange, error)
TranslateItemRequest translates a network asset item request to an assets item request.
func TranslateLink ¶
TranslateLink translates an asset link to a network link.
func TranslateLinkRequest ¶
func TranslateLinkRequest(l rest.LinkRequest) (assets.LinkChange, error)
TranslateLinkRequest translates a network link request to an assets link request.
func TranslatePlayer ¶
TranslatePlayer translates an arcade player to a network player.
func TranslatePlayerRequest ¶
func TranslatePlayerRequest(p rest.PlayerRequest) (assets.PlayerChange, error)
TranslatesPlayerRequest translates a network request to an assets player request.
func TranslateRoom ¶
TranslateRoom translates an assets room to a network room.
func TranslateRoomRequest ¶
func TranslateRoomRequest(r rest.RoomRequest) (assets.RoomChange, error)
TranslateRoomRequest translates a network room request to an assets room request.
Types ¶
type ItemManager ¶
type ItemManager interface {
List(context.Context, assets.ItemFilter) ([]*assets.Item, error)
Get(context.Context, assets.ItemID) (*assets.Item, error)
Create(context.Context, assets.ItemCreate) (*assets.Item, error)
Update(context.Context, assets.ItemID, assets.ItemUpdate) (*assets.Item, error)
Remove(context.Context, assets.ItemID) error
}
ItemManager defines the expected behavior of the item manager in the domain layer.
type ItemsService ¶
type ItemsService struct {
Manager ItemManager
}
ItemService services item related network requests.
func (ItemsService) Create ¶
func (s ItemsService) Create(w http.ResponseWriter, r *http.Request)
Create handles a request to create an item.
func (ItemsService) Get ¶
func (s ItemsService) Get(w http.ResponseWriter, r *http.Request)
Get handles a request to retrieve an item.
func (ItemsService) List ¶
func (s ItemsService) List(w http.ResponseWriter, r *http.Request)
List handles a request to retrieve multiple items.
func (ItemsService) Register ¶
func (s ItemsService) Register(router *mux.Router)
Register sets up the http handler for this service with the given router.
func (ItemsService) Remove ¶
func (s ItemsService) Remove(w http.ResponseWriter, r *http.Request)
Remove handles a request to remove an item.
func (ItemsService) Shutdown ¶
func (ItemsService) Shutdown()
Shutdown is a no-op since there no long running processes for this service.
func (ItemsService) Update ¶
func (s ItemsService) Update(w http.ResponseWriter, r *http.Request)
Update handles a request to update an item.
type LinkManager ¶
type LinkManager interface {
List(context.Context, assets.LinkFilter) ([]*assets.Link, error)
Get(context.Context, assets.LinkID) (*assets.Link, error)
Create(context.Context, assets.LinkCreate) (*assets.Link, error)
Update(context.Context, assets.LinkID, assets.LinkUpdate) (*assets.Link, error)
Remove(context.Context, assets.LinkID) error
}
LinkManager defines the expected behavior of the link manager in the domain layer.
type LinksService ¶
type LinksService struct {
Manager LinkManager
}
LinkService services link related network requests.
func (LinksService) Create ¶
func (s LinksService) Create(w http.ResponseWriter, r *http.Request)
Create handles a request to create a link.
func (LinksService) Get ¶
func (s LinksService) Get(w http.ResponseWriter, r *http.Request)
Get handles a request to retrieve a link.
func (LinksService) List ¶
func (s LinksService) List(w http.ResponseWriter, r *http.Request)
List handles a request to retrieve multiple links.
func (LinksService) Register ¶
func (s LinksService) Register(router *mux.Router)
Register sets up the http handler for this service with the given router.
func (LinksService) Remove ¶
func (s LinksService) Remove(w http.ResponseWriter, r *http.Request)
Remove handles a request to remove a link.
func (LinksService) Shutdown ¶
func (LinksService) Shutdown()
Shutdown is a no-op since there no long running processes for this service.
func (LinksService) Update ¶
func (s LinksService) Update(w http.ResponseWriter, r *http.Request)
Update handles a request to update a link.
type PlayerManager ¶
type PlayerManager interface {
List(context.Context, assets.PlayerFilter) ([]*assets.Player, error)
Get(context.Context, assets.PlayerID) (*assets.Player, error)
Create(context.Context, assets.PlayerCreate) (*assets.Player, error)
Update(context.Context, assets.PlayerID, assets.PlayerUpdate) (*assets.Player, error)
Remove(context.Context, assets.PlayerID) error
}
PlayerManager defines the expected behavior of the player manager in the domain layer.
type PlayersService ¶
type PlayersService struct {
Manager PlayerManager
}
PlayerService services player related network requests.
func (PlayersService) Create ¶
func (s PlayersService) Create(w http.ResponseWriter, r *http.Request)
Create handles a request to create a player.
func (PlayersService) Get ¶
func (s PlayersService) Get(w http.ResponseWriter, r *http.Request)
Get handles a request to retrieve a player.
func (PlayersService) List ¶
func (s PlayersService) List(w http.ResponseWriter, r *http.Request)
List handles a request to retrieve multiple players.
func (PlayersService) Name ¶
func (PlayersService) Name() string
Name returns the name of the service.
func (PlayersService) Register ¶
func (s PlayersService) Register(router *mux.Router)
Register sets up the http handler for this service with the given router.
func (PlayersService) Remove ¶
func (s PlayersService) Remove(w http.ResponseWriter, r *http.Request)
Remove handles a request to remove a player.
func (PlayersService) Shutdown ¶
func (PlayersService) Shutdown()
Shutdown is a no-op since there no long running processes for this service.
func (PlayersService) Update ¶
func (s PlayersService) Update(w http.ResponseWriter, r *http.Request)
Update handles a request to update a player.
type RoomManager ¶
type RoomManager interface {
List(context.Context, assets.RoomFilter) ([]*assets.Room, error)
Get(context.Context, assets.RoomID) (*assets.Room, error)
Create(context.Context, assets.RoomCreate) (*assets.Room, error)
Update(context.Context, assets.RoomID, assets.RoomUpdate) (*assets.Room, error)
Remove(context.Context, assets.RoomID) error
}
RoomManager defines the expected behavior of the room manager in the domain layer.
type RoomsService ¶
type RoomsService struct {
Manager RoomManager
}
RoomService services room related network requests.
func (RoomsService) Create ¶
func (s RoomsService) Create(w http.ResponseWriter, r *http.Request)
Create handles a request to create a room.
func (RoomsService) Get ¶
func (s RoomsService) Get(w http.ResponseWriter, r *http.Request)
Get handles a request to retrieve a room.
func (RoomsService) List ¶
func (s RoomsService) List(w http.ResponseWriter, r *http.Request)
List handles a request to retrieve multiple rooms.
func (RoomsService) Register ¶
func (s RoomsService) Register(router *mux.Router)
Register sets up the http handler for this service with the given router.
func (RoomsService) Remove ¶
func (s RoomsService) Remove(w http.ResponseWriter, r *http.Request)
Remove handles a request to remove a room.
func (RoomsService) Shutdown ¶
func (RoomsService) Shutdown()
Shutdown is a no-op since there no long running processes for this service.
func (RoomsService) Update ¶
func (s RoomsService) Update(w http.ResponseWriter, r *http.Request)
Update handles a request to update a room.