cache

package
v0.0.0-...-b6702c2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2018 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package cache provides a temporary persistence layer for development purposes

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

Cache provides access to collections and predefined CRUD functionality.

func New

func New() (cache *Cache)

New creates a new cache for mock DB calls

func (*Cache) AdminGetList

func (c *Cache) AdminGetList() (result []types.Admin, err error)

AdminGetList returns a list of all admins

func (*Cache) AdminSetLevel

func (c *Cache) AdminSetLevel(id bson.ObjectId, level int32) (err error)

AdminSetLevel creates, updates or removes an admin record based on level

func (*Cache) DeleteEverythingPermanently

func (c *Cache) DeleteEverythingPermanently() (err error)

DeleteEverythingPermanently should only be used during testing!

func (*Cache) PlayerCreate

func (c *Cache) PlayerCreate(player types.Player) (id bson.ObjectId, err error)

PlayerCreate creates a new player account in the database

func (*Cache) PlayerGetByID

func (c *Cache) PlayerGetByID(id bson.ObjectId) (player types.Player, err error)

PlayerGetByID returns a player object by ID

func (*Cache) PlayerGetByName

func (c *Cache) PlayerGetByName(name string) (player types.Player, err error)

PlayerGetByName returns a player object by name

func (*Cache) PlayerRemove

func (c *Cache) PlayerRemove(id bson.ObjectId) (err error)

PlayerRemove removes a player in the database by their ID

func (*Cache) PlayerUpdate

func (c *Cache) PlayerUpdate(id bson.ObjectId, player types.Player) (err error)

PlayerUpdate updates a player in the database by their ID

func (*Cache) ReportArchive

func (c *Cache) ReportArchive(id bson.ObjectId, archived bool) (err error)

ReportArchive sets archive status on a report

func (*Cache) ReportCreate

func (c *Cache) ReportCreate(report types.Report) (id bson.ObjectId, err error)

ReportCreate creates a report in the database

func (*Cache) ReportGet

func (c *Cache) ReportGet(id bson.ObjectId) (result types.Report, err error)

ReportGet returns a specific report given an id

func (*Cache) ReportGetList

func (c *Cache) ReportGetList(pageSize, page int, archived, noRead bool, by, of bson.ObjectId, from, to *time.Time) (result []types.Report, err error)

ReportGetList returns a list of reports based on search parameters

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL