slot

package
v0.0.0-...-e6b7f3d Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidSlot = errors.New("invalid slot")
)
View Source
var Table = "slots"

Functions

func ValidID

func ValidID(ctx context.Context, dbConn *gorm.DB, slotID int) bool

ValidID checks if a slot ID is contained in the DB

Types

type Slot

type Slot struct {
	ID        int       `json:"id" gorm:"primary_key;unique;not null"`
	Hours     string    `json:"hours" gorm:"not null"`
	IsActive  bool      `json:"is_active" gorm:"default:false;not null"`
	CreatedAt time.Time `json:"created_at" gorm:"default:CURRENT_TIMESTAMP;not null"`
	UpdatedAt time.Time `json:"updated_at" gorm:"default:CURRENT_TIMESTAMP;not null"`
}

Slot contains the schema for specific identity

func Read

func Read(ctx context.Context, dbConn *gorm.DB) ([]*Slot, error)

Read operates as controller to list slots

func UpdateActive

func UpdateActive(ctx context.Context, dbConn *gorm.DB, slotID, status string) (*Slot, error)

UpdateActive operates as controller to activate or deactivate an existing slot

Jump to

Keyboard shortcuts

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