Started with db abstraction in seeder.

This commit is contained in:
Sascha L. Teichmann
2022-02-27 21:02:16 +01:00
parent 481cf6e517
commit 34d01762f0
4 changed files with 18 additions and 22 deletions

View File

@ -52,7 +52,7 @@ var BackgroundColor = color.RGBA{R: 0xff, G: 0xff, B: 0xff, A: 0xff}
type BaseTileUpdateFunc func(x, y int, hash []byte) bool
type BaseTileCreator struct {
client *RedisClient
client DBClient
colors *Colors
renderer *Renderer
yOrder *YOrder
@ -64,7 +64,7 @@ type BaseTileCreator struct {
}
func NewBaseTileCreator(
client *RedisClient,
client DBClient,
colors *Colors,
bg color.RGBA,
yMin, yMax int16,

10
common/dbclient.go Normal file
View File

@ -0,0 +1,10 @@
package common
// Copyright 2022 by Sascha L. Teichmann
// Use of this source code is governed by the MIT license
// that can be found in the LICENSE file.
type DBClient interface {
QueryCuboid(cuboid Cuboid, fn func(*Block) *Block) (count int, err error)
Close() error
}