db

package
v0.0.0-...-43b3d42 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCalendar

func AddCalendar(cal Calendar) error

AddCalendar creates a new bucket for a tool if it doesn't exist

func DeleteCalendar

func DeleteCalendar(cal Calendar) error

DeleteCalendar removes the bucket for a tool if it exists

func Init

func Init(dbPath string) error

Init opens or creates the database

Types

type Calendar

type Calendar string

A Calendar is how we will split events by tools. there could be a laser calendar or a 3d printer calendar

func FetchCalendars

func FetchCalendars() ([]Calendar, error)

FetchCalendars shows a list of the current calendars

func (Calendar) AddEvent

func (cal Calendar) AddEvent(e Event) error

AddEvent adds an event to a calendar

func (Calendar) DeleteEvent

func (cal Calendar) DeleteEvent(id int) error

DeleteEvent removes an evnet from the calendar bucket

func (Calendar) FetchEvent

func (cal Calendar) FetchEvent(id int) (Event, error)

FetchEvent gets on event form a calendar by id

func (Calendar) FetchEvents

func (cal Calendar) FetchEvents() ([]Event, error)

FetchEvents returns all events for a calendar in a slice

type Event

type Event struct {
	ID          int       `json:"id,omitempty"`
	StartTime   time.Time `json:"start_time,omitempty"`
	EndTime     time.Time `json:"end_time,omitempty"`
	Description string    `json:"description,omitempty"`
	Owner       string    `json:"owner,omitempty"`
}

An Event is an allocation of time held by a user. Events go on calendars

func NewEvent

func NewEvent(eventMap map[string]string) Event

NewEvent creates a new Event from the redis map TODO is this still needed?

Jump to

Keyboard shortcuts

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