Documentation ¶
Overview ¶
Package store provides database functionalities
Index ¶
- Variables
- func Decode(data []byte, object interface{}) error
- func Encode(object interface{}) ([]byte, error)
- type BoltStore
- func (bs *BoltStore) Close() error
- func (bs *BoltStore) GetGameList(platform string) (map[int]string, error)
- func (bs *BoltStore) GetGameRecord(platform string, subid string) (*GameRecord, error)
- func (bs *BoltStore) GetSavedGameList(platform string) (map[int]string, error)
- func (bs *BoltStore) SaveGameList(platform string, games map[int]string) error
- func (bs *BoltStore) SaveGameRecord(platform string, subid string, r GameRecord) error
- type Config
- type DummyStore
- func (ds *DummyStore) Close() error
- func (ds *DummyStore) GetGameList(platform string) (map[int]string, error)
- func (ds *DummyStore) GetSavedGameList(platform string) (map[int]string, error)
- func (ds *DummyStore) SaveGameList(platform string, games map[int]string) error
- func (ds *DummyStore) SaveGameRecord(platform string, subid string, r GameRecord) error
- type GameRecord
- type GameStore
Constants ¶
This section is empty.
Variables ¶
var (
// StoreGameListKey is sub-key name placing full game list of a platform
StoreGameListKey = "index"
)
Functions ¶
Types ¶
type BoltStore ¶
type BoltStore struct { LogLevel string Buckets []string // contains filtered or unexported fields }
BoltStore represents a bolt store for game database
func NewBoltStore ¶
NewBoltStore creates a bolt store
func (*BoltStore) GetGameList ¶
GetGameList index from bolt store
func (*BoltStore) GetGameRecord ¶
func (bs *BoltStore) GetGameRecord(platform string, subid string) (*GameRecord, error)
GetGameRecord from bolt store
func (*BoltStore) GetSavedGameList ¶
GetSavedGameList from bolt store
func (*BoltStore) SaveGameList ¶
SaveGameList to badger store
func (*BoltStore) SaveGameRecord ¶
func (bs *BoltStore) SaveGameRecord(platform string, subid string, r GameRecord) error
SaveGameRecord to badger store
type DummyStore ¶
type DummyStore struct {
LogLevel string
}
DummyStore represents a dummy store for game database
func NewDummyStore ¶
func NewDummyStore(cfg Config) (*DummyStore, error)
NewDummyStore creates a dummy store
func (*DummyStore) GetGameList ¶
func (ds *DummyStore) GetGameList(platform string) (map[int]string, error)
GetGameList from dummy store, pretend to have most of games
func (*DummyStore) GetSavedGameList ¶
func (ds *DummyStore) GetSavedGameList(platform string) (map[int]string, error)
GetSavedGameList from dummy store, pretend to have most of games
func (*DummyStore) SaveGameList ¶
func (ds *DummyStore) SaveGameList(platform string, games map[int]string) error
SaveGameList to dummy store
func (*DummyStore) SaveGameRecord ¶
func (ds *DummyStore) SaveGameRecord(platform string, subid string, r GameRecord) error
SaveGameRecord to dummy store
type GameRecord ¶
type GameRecord struct { Name string ID int RequiredAge int Description string About string Languages string Developers []string Publishers []string }
GameRecord represents detailed game information
type GameStore ¶
type GameStore interface { Close() error SaveGameList(platform string, games map[int]string) error GetGameList(platform string) (map[int]string, error) GetSavedGameList(platform string) (map[int]string, error) SaveGameRecord(platform string, subid string, r GameRecord) error }
GameStore represents general interfaces of store package. Implementations are corresponding to different databases.