location

package
v0.0.0-...-0cfb223 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const Collection = "locations"

Collection indicates the MongoDB location collection

Variables

This section is empty.

Functions

func Create

func Create(loc *Location) error

Create creates a new entity

func GetAll

func GetAll(opts *Options) (*model.Result, error)

GetAll returns a result based on filters

func GetByAvailability

func GetByAvailability(a bool, opts *Options) (*model.Result, error)

GetByAvailability returns a result based on availability

func GetByText

func GetByText(q string, opts *Options) (*model.Result, error)

GetByText returns a result based on given keyword

func Remove

func Remove(id string) error

Remove removes an entity

func Replace

func Replace(id string, loc *Location) error

Replace replaces the data of an existing entity

Types

type Boss

type Boss struct {
	Name        string  `json:"name" bson:"name"`
	Description string  `json:"description" bson:"description"`
	Chance      float64 `json:"chance" bson:"chance"`
	Followers   int64   `json:"followers" bson:"followers"`
}

Boss describes a boss of a location

type Exit

type Exit struct {
	Name             string  `json:"name" bson:"name"`
	Description      string  `json:"description" bson:"description"`
	Chance           float64 `json:"chance" bson:"chance"`
	MinimumTime      int64   `json:"minTime" bson:"minTime"`
	MaximumTime      int64   `json:"maxTime" bson:"maxTime"`
	ExfiltrationTime int64   `json:"exfilTime" bson:"exfilTime"`
	Requirement      string  `json:"requirement,omitempty" bson:"requirement,omitempty"`
}

Exit describes an exit of a location

type Location

type Location struct {
	ID             objectID  `json:"_id" bson:"_id"`
	Name           string    `json:"name" bson:"name"`
	Description    string    `json:"description" bson:"description"`
	MinimumPlayers int64     `json:"minPlayers" bson:"minPlayers"`
	MaximumPlayers int64     `json:"maxPlayers" bson:"maxPlayers"`
	EscapeTime     int64     `json:"escapeTime" bson:"escapeTime"`
	Insurance      bool      `json:"insurance" bson:"insurance"`
	Available      bool      `json:"available" bson:"available"`
	Exits          []Exit    `json:"exits" bson:"exits"`
	Bosses         []Boss    `json:"bosses" bson:"bosses"`
	Modified       timestamp `json:"_modified" bson:"_modified"`
}

Location describes the entity of a location

func GetByID

func GetByID(id string) (*Location, error)

GetByID returns the entity of the given ID

func (*Location) Validate

func (l *Location) Validate() error

Validate validates the fields of a location

type Options

type Options struct {
	Sort   bson.D
	Limit  int64
	Offset int64
}

Options represents the options for a database operation

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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