locations

package
v0.0.0-...-9af3b72 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteByUUID

func DeleteByUUID(uuid uuid.UUID) bool

Types

type Coord

type Coord struct {
	Lat  float64 `json:lat`
	Long float64 `json:long`
}

type Location

type Location struct {
	UUID     uuid.UUID `json:"uuid"`
	Host     uuid.UUID `json:"host"`
	Profile  Profile   `json:"profile"`
	Pictures [][]byte  `json:"pictures"`
	Active   bool      `json:"active"`
}

func AllLocations

func AllLocations() ([]*Location, error)

func LocationByUUID

func LocationByUUID(uuid uuid.UUID) (*Location, error)

func NewLocation

func NewLocation(host uuid.UUID, lp Profile) (*Location, error)

Create a Location

func (*Location) AddPicture

func (l *Location) AddPicture(picture []byte) error

func (*Location) RemovePicture

func (l *Location) RemovePicture(picIndex int) error

func (*Location) UpdateProfile

func (l *Location) UpdateProfile(lp Profile) error

type LocationStorage

type LocationStorage interface {
	Store(*Location) error
	Delete(uuid.UUID) error
	Load(uuid.UUID) (*Location, error)
	LoadAll() ([]*Location, error)
	LoadByPlayer(uuid.UUID) (*Location, error)
}

A storage interface for Locations

type Profile

type Profile struct {
	URL         string   `json:"url"`
	Coordinates Coord    `json:"coordinates"`
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Facilities  []string `json:"facilities"`
}

type RedisLocationStorage

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

func NewRedisLocationStorage

func NewRedisLocationStorage() *RedisLocationStorage

func (*RedisLocationStorage) Delete

func (rls *RedisLocationStorage) Delete(uuid uuid.UUID) error

func (*RedisLocationStorage) Load

func (rls *RedisLocationStorage) Load(uuid uuid.UUID) (*Location, error)

func (*RedisLocationStorage) LoadAll

func (rls *RedisLocationStorage) LoadAll() ([]*Location, error)

func (*RedisLocationStorage) LoadByPlayer

func (rls *RedisLocationStorage) LoadByPlayer(player uuid.UUID) (*Location, error)

func (*RedisLocationStorage) Store

func (rls *RedisLocationStorage) Store(l *Location) error

Jump to

Keyboard shortcuts

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