server

package
v0.0.0-...-1e5aed9 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateRouter

func CreateRouter(server *HTTPServer) (*mux.Router, error)

Types

type DB

type DB struct {
	*sqlx.DB
}

func (*DB) GetCellJson

func (db *DB) GetCellJson(layerID int, x, y float64) ([]byte, error)

func (*DB) GetTileRoot

func (db *DB) GetTileRoot(layerID int) (string, error)

func (*DB) GetWorldInfo

func (db *DB) GetWorldInfo(worldID int) (WorldInfo, error)

func (*DB) GetWorlds

func (db *DB) GetWorlds() ([]World, error)

func (*DB) Open

func (db *DB) Open(connectionString string) error

type HTTPServer

type HTTPServer struct {
	DB *DB
	// contains filtered or unexported fields
}

func NewHTTPServer

func NewHTTPServer(db *DB, tileRoot string) *HTTPServer

func (*HTTPServer) GetCells

func (s *HTTPServer) GetCells(w http.ResponseWriter, r *http.Request, vars map[string]string) error

func (*HTTPServer) GetTile

func (s *HTTPServer) GetTile(w http.ResponseWriter, r *http.Request, vars map[string]string) error

func (*HTTPServer) GetWorldLayerInfo

func (s *HTTPServer) GetWorldLayerInfo(w http.ResponseWriter, r *http.Request, vars map[string]string) error

func (*HTTPServer) GetWorlds

func (s *HTTPServer) GetWorlds(w http.ResponseWriter, r *http.Request, vars map[string]string) error

type HttpApiFunc

type HttpApiFunc func(w http.ResponseWriter, r *http.Request, vars map[string]string) error

type World

type World struct {
	ID   int    `json:"id" db:"world_id"`
	Name string `json:"name" db:"name"`
}

type WorldInfo

type WorldInfo struct {
	ID   int             `json:"id"`
	Name string          `json:"name"`
	MaxZ int             `json:"maxz"`
	Z    map[int]*ZLevel `json:"z"`
}

type WorldLayerInfo

type WorldLayerInfo struct {
	WorldID       int         `json:"worldId" db:"world_id"`
	LayerID       int         `json:"layerId" db:"layer_id"`
	MaxZ          int         `json:"maxz" db:"maxz"`
	Z             int         `json:"z" db:"z"`
	Type          string      `json:"type" db:"type"`
	WorldName     string      `json:"worldName" db:"world_name"`
	CharacterName null.String `json:"characterName" db:"character_name"`
}

type ZLevel

type ZLevel struct {
	TerrainLayer   null.Int       `json:"layerId"`
	SeenLayer      map[string]int `json:"seenLayers"`
	SeenSolidLayer map[string]int `json:"seenSolidLayers"`
}

Jump to

Keyboard shortcuts

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