db interface

This commit is contained in:
Thomas Rudin 2019-01-08 08:46:12 +01:00
parent ab660ca622
commit 5f9180efaf
2 changed files with 9 additions and 16 deletions

View File

@ -9,10 +9,7 @@ type Block struct {
type DBAccessor interface {
IsMigrated() (bool, error)
Migrate() error
FindLatestBlocks(time int64, limit int) []Block
//Block range lookup
FindBlocks(posx int, posz int, posystart int, posyend int) []Block
GetXRange(posystart int, posyend int) (int, int)
GetZRange(posystart int, posyend int) (int, int)
FindLatestBlocks(mintime int64, limit int) []Block, error
FindBlocks(posx int, posz int, posystart int, posyend int) []Block, error
CountBlocks(x1, x2, y1, y2, z1, z2 int) int, error
}

View File

@ -11,22 +11,18 @@ func (db *Sqlite3Accessor) Migrate() error {
return nil
}
func (db *Sqlite3Accessor) FindLatestBlocks(time int64, limit int) []Block {
func (db *Sqlite3Accessor) FindLatestBlocks(mintime int64, limit int) ([]Block, error) {
return make([]Block, 0)
}
func (db *Sqlite3Accessor) FindBlocks(posx int, posz int, posystart int, posyend int) []Block {
func (db *Sqlite3Accessor) FindBlocks(posx int, posz int, posystart int, posyend int) ([]Block, error) {
return make([]Block, 0)
}
func (db *Sqlite3Accessor) GetXRange(posystart int, posyend int) (int, int) {
return 0, 0
func (db *Sqlite3Accessor) CountBlocks(x1, x2, y1, y2, z1, z2 int) (int, error) {
return 0
}
func (db *Sqlite3Accessor) GetZRange(posystart int, posyend int) (int, int) {
return 0, 0
}
func NewSqliteAccessor(filename string) {
func NewSqliteAccessor(filename string) (*Sqlite3Accessor, error) {
return nil, nil
}