mapserver/mapobjectdb/accessor.go

45 lines
738 B
Go
Raw Normal View History

2019-01-18 17:51:10 +03:00
package mapobjectdb
2019-01-18 15:50:59 +03:00
import (
"mapserver/coords"
)
2019-01-21 17:13:33 +03:00
type Tile struct {
Pos *coords.TileCoords
Data []byte
Mtime int64
}
2019-01-18 17:51:10 +03:00
type MapObject struct {
2019-01-18 15:50:59 +03:00
//mapblock position
2019-01-18 17:10:46 +03:00
MBPos coords.MapBlockCoords
2019-01-18 17:18:42 +03:00
2019-01-18 15:50:59 +03:00
//block position
X, Y, Z int
2019-01-18 17:10:46 +03:00
2019-01-18 17:18:42 +03:00
Type string
Data string
Mtime int64
2019-01-18 15:50:59 +03:00
}
type SearchQuery struct {
//block position (not mapblock)
Pos1, Pos2 coords.MapBlockCoords
2019-01-18 17:10:46 +03:00
Type string
2019-01-18 15:50:59 +03:00
}
type DBAccessor interface {
Migrate() error
2019-01-21 17:13:33 +03:00
//Generic map objects (poi, etc)
2019-01-18 17:51:10 +03:00
GetMapData(q SearchQuery) ([]MapObject, error)
2019-01-18 17:10:46 +03:00
RemoveMapData(pos coords.MapBlockCoords) error
2019-01-18 17:51:10 +03:00
AddMapData(data MapObject) error
2019-01-21 17:13:33 +03:00
//tile data
GetTile(pos *coords.TileCoords) (*Tile, error)
SetTile(tile *Tile) error
RemoveTile(pos *coords.TileCoords) error
2019-01-18 15:50:59 +03:00
}