storage

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: 6 Imported by: 0

Documentation

Overview

Package storage provides a persistence layer for package server to use for storing, accessing and processing data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Host string
	Port string
	Name string
	User string
	Pass string
}

Config describes how to connect to the database

type Manager

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

Manager provides access to collections and predefined CRUD functionality.

func New

func New(config Config) (mgr *Manager, err error)

New constructs a new storage manager with the given configuration. This attempts to connect to a database endpoint

func (*Manager) AdminGetList

func (mgr *Manager) AdminGetList() (result []types.Admin, err error)

AdminGetList returns a list of all admins

func (*Manager) AdminSetLevel

func (mgr *Manager) AdminSetLevel(id bson.ObjectId, level int32) (err error)

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

func (*Manager) DeleteEverythingPermanently

func (mgr *Manager) DeleteEverythingPermanently() error

DeleteEverythingPermanently should only be used during testing!

func (*Manager) PlayerCreate

func (mgr *Manager) PlayerCreate(player types.Player) (id bson.ObjectId, err error)

PlayerCreate creates a new player account in the database

func (*Manager) PlayerGetByID

func (mgr *Manager) PlayerGetByID(id bson.ObjectId) (player types.Player, err error)

PlayerGetByID returns a player object by ID

func (*Manager) PlayerGetByName

func (mgr *Manager) PlayerGetByName(name string) (player types.Player, err error)

PlayerGetByName returns a player object by name

func (*Manager) PlayerRemove

func (mgr *Manager) PlayerRemove(id bson.ObjectId) (err error)

PlayerRemove removes a player in the database by their ID

func (*Manager) PlayerUpdate

func (mgr *Manager) PlayerUpdate(id bson.ObjectId, player types.Player) (err error)

PlayerUpdate updates a player in the database by their ID

func (*Manager) ReportArchive

func (mgr *Manager) ReportArchive(id bson.ObjectId, archived bool) (err error)

ReportArchive sets archive status on a report

func (*Manager) ReportCreate

func (mgr *Manager) ReportCreate(report types.Report) (id bson.ObjectId, err error)

ReportCreate creates a report in the database

func (*Manager) ReportGet

func (mgr *Manager) ReportGet(id bson.ObjectId) (result types.Report, err error)

ReportGet returns a specific report given an id

func (*Manager) ReportGetList

func (mgr *Manager) 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