From 5f9180efafe91a1ba3b2cdd0323f5a293fb5f076 Mon Sep 17 00:00:00 2001 From: Thomas Rudin Date: Tue, 8 Jan 2019 08:46:12 +0100 Subject: [PATCH] db interface --- db/accessor.go | 9 +++------ db/sqlite.go | 16 ++++++---------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/db/accessor.go b/db/accessor.go index f3b3e9b..fdb4269 100644 --- a/db/accessor.go +++ b/db/accessor.go @@ -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 } diff --git a/db/sqlite.go b/db/sqlite.go index dfd46f3..effa90f 100644 --- a/db/sqlite.go +++ b/db/sqlite.go @@ -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 }