persistence

package
v0.0.0-...-b6575a2 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2021 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DB     = "myevents"
	USERS  = "users"
	EVENTS = "events"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DatabaseHandler

type DatabaseHandler interface {
	AddEvent(Event) ([]byte, error)
	FindEvent([]byte) (Event, error)
	FindEventByName(string) (Event, error)
	FindAllEventsAvailable() ([]Event, error)
}

type Event

type Event struct {
	ID        bson.ObjectId `bson:"_id"`
	Name      string
	Duration  int
	StartDate int64
	EndDate   int64
	Location  Location
}

type Hall

type Hall struct {
	Name     string `json:"name"`
	Location string `json:"localtion,omitempty"`
	Capacity int    `json:"capacity"`
}

type Location

type Location struct {
	ID        string
	Name      string
	Address   string
	Country   string
	OpenTime  int
	CloseTime int
	Halls     []Hall
}

type MongoDBLayer

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

func NewMongoDBLayer

func NewMongoDBLayer(connection string) (*MongoDBLayer, error)

func (*MongoDBLayer) AddEvent

func (mgoLayer *MongoDBLayer) AddEvent(e Event) ([]byte, error)

func (*MongoDBLayer) FindAllEventsAvailable

func (mgoLayer *MongoDBLayer) FindAllEventsAvailable() ([]Event, error)

func (*MongoDBLayer) FindEvent

func (mgoLayer *MongoDBLayer) FindEvent(id []byte) (Event, error)

func (*MongoDBLayer) FindEventByName

func (mgoLayer *MongoDBLayer) FindEventByName(name string) (Event, error)

Jump to

Keyboard shortcuts

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