go fmt
This commit is contained in:
parent
75bf921b54
commit
bd2f794af8
@ -19,15 +19,15 @@ type Tile struct {
|
|||||||
|
|
||||||
type MapObject struct {
|
type MapObject struct {
|
||||||
//mapblock position
|
//mapblock position
|
||||||
MBPos *coords.MapBlockCoords `json:"mapblock"`
|
MBPos *coords.MapBlockCoords `json:"mapblock"`
|
||||||
|
|
||||||
//block position
|
//block position
|
||||||
X int `json:"x"`
|
X int `json:"x"`
|
||||||
Y int `json:"y"`
|
Y int `json:"y"`
|
||||||
Z int `json:"z"`
|
Z int `json:"z"`
|
||||||
|
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
Mtime int64 `json:"mtime"`
|
Mtime int64 `json:"mtime"`
|
||||||
Attributes map[string]string `json:"attributes"`
|
Attributes map[string]string `json:"attributes"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ type SearchQuery struct {
|
|||||||
//mapblock position
|
//mapblock position
|
||||||
Pos1 coords.MapBlockCoords `json:"pos1"`
|
Pos1 coords.MapBlockCoords `json:"pos1"`
|
||||||
Pos2 coords.MapBlockCoords `json:"pos2"`
|
Pos2 coords.MapBlockCoords `json:"pos2"`
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type DBAccessor interface {
|
type DBAccessor interface {
|
||||||
|
@ -17,7 +17,6 @@ and o.posx <= ? and o.posy <= ? and o.posz <= ?
|
|||||||
order by o.id
|
order by o.id
|
||||||
`
|
`
|
||||||
|
|
||||||
|
|
||||||
func (db *Sqlite3Accessor) GetMapData(q SearchQuery) ([]*MapObject, error) {
|
func (db *Sqlite3Accessor) GetMapData(q SearchQuery) ([]*MapObject, error) {
|
||||||
rows, err := db.db.Query(getMapDataPosQuery,
|
rows, err := db.db.Query(getMapDataPosQuery,
|
||||||
q.Type,
|
q.Type,
|
||||||
@ -43,7 +42,6 @@ func (db *Sqlite3Accessor) GetMapData(q SearchQuery) ([]*MapObject, error) {
|
|||||||
var posx, posy, posz int
|
var posx, posy, posz int
|
||||||
var key, value string
|
var key, value string
|
||||||
|
|
||||||
|
|
||||||
err = rows.Scan(&id, &Type, &mtime,
|
err = rows.Scan(&id, &Type, &mtime,
|
||||||
&x, &y, &z, &posx, &posy, &posz,
|
&x, &y, &z, &posx, &posy, &posz,
|
||||||
&key, &value,
|
&key, &value,
|
||||||
|
@ -5,7 +5,6 @@ import (
|
|||||||
_ "github.com/mattn/go-sqlite3"
|
_ "github.com/mattn/go-sqlite3"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
func NewSqliteAccessor(filename string) (*Sqlite3Accessor, error) {
|
func NewSqliteAccessor(filename string) (*Sqlite3Accessor, error) {
|
||||||
//TODO: flag/config for unsafe db access
|
//TODO: flag/config for unsafe db access
|
||||||
db, err := sql.Open("sqlite3", filename+"?_timeout=500&_journal_mode=MEMORY&_synchronous=OFF")
|
db, err := sql.Open("sqlite3", filename+"?_timeout=500&_journal_mode=MEMORY&_synchronous=OFF")
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package mapobjectdb
|
package mapobjectdb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"mapserver/coords"
|
"mapserver/coords"
|
||||||
"os"
|
"os"
|
||||||
"fmt"
|
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user