database

package
v0.0.0-...-df3ea80 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DOW

type DOW string
const (
	Monday    DOW = "monday"
	Tuesday   DOW = "tuesday"
	Wednesday DOW = "wednesday"
	Thursday  DOW = "thursday"
	Friday    DOW = "friday"
	Saturday  DOW = "saturday"
	Sunday    DOW = "sunday"
)

type Database

type Database struct {
	DB     *gorm.DB
	Logger zerolog.Logger
}

func (*Database) CreateTimetable

func (d *Database) CreateTimetable(tt *types.Timetable) (*types.Timetable, error)

func (*Database) CreateWeekDay

func (d *Database) CreateWeekDay(timetableID uint, dow DOW, openingClosing [][2]string) ([]types.TimetableDay, error)

func (*Database) DeleteTimetable

func (d *Database) DeleteTimetable(id uint) error

func (*Database) DeleteWeekDay

func (d *Database) DeleteWeekDay(timetableID uint, dow DOW) error

func (*Database) GetTimetableByID

func (d *Database) GetTimetableByID(id uint, fullTimetable bool) (*types.Timetable, error)

func (*Database) GetWeekDay

func (d *Database) GetWeekDay(timetableID uint, dow DOW) ([]types.TimetableDay, error)

type Timetable

type Timetable struct {
	gorm.Model
	Name       string
	ValidFrom  time.Time
	ValidUntil sql.NullTime
}

func (*Timetable) TableName

func (t *Timetable) TableName() string

func (*Timetable) ToAPI

func (t *Timetable) ToAPI() *types.Timetable

type TimetableDay

type TimetableDay struct {
	gorm.Model
	TimetableID uint
	Dow         DOW
	Opening     string
	Closing     string
}

func (*TimetableDay) TableName

func (t *TimetableDay) TableName() string

func (*TimetableDay) ToAPI

func (t *TimetableDay) ToAPI() *types.TimetableDay

Jump to

Keyboard shortcuts

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