db100

package
v0.0.0-...-022ae59 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteUser

func DeleteUser(id int) error

func DoesUserExist

func DoesUserExist(username string) (bool, error)

func Initialisation

func Initialisation(dbc *global.DBConnection)

Types

type Box

type Box struct {
	BoxID       int    `gorm:"primary_key;AUTO_INCREMENT;not null"`
	StoreID     int    `gorm:"not null"`
	Items       []Item `gorm:"foreignkey:BoxID;association_foreignkey:BoxID"`
	Code        int    `gorm:"type:integer(13)"`
	Description string `gorm:"not null"`
	Weight      int    `gorm:"not null;default:0"`
}

func GetBoxes

func GetBoxes() ([]Box, error)

func (*Box) AddBoxItem

func (b *Box) AddBoxItem(item Item) error

func (*Box) Delete

func (b *Box) Delete() error

func (*Box) GetBoxItems

func (b *Box) GetBoxItems() ([]Item, error)

func (*Box) GetBoxItemsJoined

func (b *Box) GetBoxItemsJoined() ([]ItemslistEntry, error)

func (*Box) GetDetails

func (b *Box) GetDetails() error

func (*Box) GetFullDetails

func (b *Box) GetFullDetails() (BoxlistEntry, error)

func (*Box) Insert

func (b *Box) Insert() error

func (*Box) Update

func (b *Box) Update() error

type BoxlistEntry

type BoxlistEntry struct {
	BoxID       int
	Code        int
	Description string
	Weight      int
	StoreID     int
	Name        string
	Adress      string
	ManagerID   int
	Username    string
	Email       string
	Right       int
}

func GetBoxesJoined

func GetBoxesJoined() ([]BoxlistEntry, error)

type Equipment

type Equipment struct {
	EquipmentID int    `gorm:"primary_key;AUTO_INCREMENT;not null"`
	Name        string `gorm:"not null"`
}

func GetEquipment

func GetEquipment() ([]Equipment, error)

func (*Equipment) Delete

func (e *Equipment) Delete() error

func (*Equipment) GetDetails

func (e *Equipment) GetDetails() error

func (*Equipment) Insert

func (e *Equipment) Insert() error

func (*Equipment) Update

func (e *Equipment) Update() error

type Event

type Event struct {
	EventID      int           `gorm:"primary_key;AUTO_INCREMENT;not null"`
	Name         string        `gorm:"not null"`
	Start        time.Time     `gorm:"not null"`
	End          time.Time     `gorm:"not null"`
	Adress       string        `gorm:"not null"`
	Participants []Participant `gorm:"foreignkey:EventID;association_foreignkey:EventID"`
}

func GetEvents

func GetEvents() ([]Event, error)

func GetNextEvent

func GetNextEvent() (Event, error)

func (*Event) Delete

func (e *Event) Delete() error

func (*Event) GetDetails

func (e *Event) GetDetails() error

func (*Event) GetPackinglists

func (e *Event) GetPackinglists() ([]Packinglist, error)

func (*Event) GetParticipants

func (e *Event) GetParticipants() ([]Participant, error)

func (*Event) Insert

func (e *Event) Insert() error

func (*Event) Update

func (e *Event) Update() error

type Fault

type Fault struct {
	FaultID int         `gorm:"primary_key;AUTO_INCREMENT;not null"`
	ItemID  int         `gorm:"not null"`
	Status  FaultStatus `gorm:"not null"`
	Comment string      `gorm:"not null"`
}

func GetFaults

func GetFaults() ([]Fault, error)

func (*Fault) Delete

func (f *Fault) Delete() error

func (*Fault) GetDetails

func (f *Fault) GetDetails() error

func (*Fault) Insert

func (f *Fault) Insert() error

func (*Fault) Update

func (f *Fault) Update() error

type FaultStatus

type FaultStatus int
const (
	FaultStatusNew FaultStatus = 0 + iota
	FaultStatusInRepair
	FaultStatusFixed
	FaultStatusUnfixable
)

type Item

type Item struct {
	ItemID      int `gorm:"primary_key;AUTO_INCREMENT;not null"`
	BoxID       int
	EquipmentID int       `gorm:"not null"`
	Equipment   Equipment `gorm:"not null"`
	Code        int       `gorm:"type:integer(13)"`
	Description string
	Faults      []Fault `gorm:"foreignkey:ItemID;association_foreignkey:ItemID"`
}

func GetItems

func GetItems(storeless bool) ([]Item, error)

func (*Item) AddFault

func (i *Item) AddFault(f Fault) (Fault, error)

func (*Item) Delete

func (i *Item) Delete() error

func (*Item) GetDetails

func (i *Item) GetDetails() error

func (*Item) GetFaults

func (i *Item) GetFaults() ([]Fault, error)

func (*Item) GetFullDetails

func (i *Item) GetFullDetails() (ItemslistEntry, error)

func (*Item) Insert

func (i *Item) Insert() error

func (*Item) SetBox

func (i *Item) SetBox(id int) error

func (*Item) Update

func (i *Item) Update() error

type ItemslistEntry

type ItemslistEntry struct {
	ItemID          int
	ItemCode        int
	ItemDescription string
	BoxID           int
	BoxCode         int
	BoxDescription  string
	BoxWeight       int
	StoreID         int
	StoreName       string
	StoreAddress    string
	StoreManagerID  int
	EquipmentID     int
	EquipmentName   string
}

func GetItemsJoined

func GetItemsJoined(storeless bool) ([]ItemslistEntry, error)

type Packinglist

type Packinglist struct {
	PackinglistID int    `gorm:"primary_key;AUTO_INCREMENT;not null"`
	Name          string `gorm:"not null"`
	EventID       int    `gorm:"foreignkey:EventID;not null"`
	Event         Event  `gorm:"not null"`
	Boxes         []Box  `gorm:"many2many:packinglist_boxes;"`
	Weight        int    `gorm:"not null;default:0"`
}

func GetPackinglists

func GetPackinglists() ([]Packinglist, error)

func (*Packinglist) AddPackinglistBox

func (p *Packinglist) AddPackinglistBox(b Box) error

func (*Packinglist) Delete

func (p *Packinglist) Delete() error

func (*Packinglist) FindSuitableBoxes

func (p *Packinglist) FindSuitableBoxes() ([]Box, error)

func (*Packinglist) GetDetails

func (p *Packinglist) GetDetails() error

func (*Packinglist) GetPackinglistBoxes

func (p *Packinglist) GetPackinglistBoxes() ([]Box, error)

func (*Packinglist) Insert

func (p *Packinglist) Insert() error

func (*Packinglist) RemovePackinglistBox

func (p *Packinglist) RemovePackinglistBox(b Box) error

func (*Packinglist) Update

func (p *Packinglist) Update() error

type Participant

type Participant struct {
	UserID    int       `gorm:"type:integer;primary_key;not null"`
	User      User      `gorm:"not null;foreignkey:UserID;association_foreignkey:UserID"`
	EventID   int       `gorm:"type:integer;primary_key;not null"`
	Arrival   time.Time `gorm:"not null"`
	Departure time.Time `gorm:"not null"`
}

func (*Participant) Delete

func (p *Participant) Delete() error

func (*Participant) GetDetails

func (p *Participant) GetDetails() error

func (*Participant) Insert

func (p *Participant) Insert() error

func (*Participant) Update

func (p *Participant) Update() error

type Store

type Store struct {
	StoreID   int    `gorm:"primary_key;AUTO_INCREMENT;not null"`
	Name      string `gorm:"not null"`
	Adress    string `gorm:"not null"`
	Manager   User   `gorm:"not null"`
	ManagerID int    `gorm:"foreignkey:ManagerID;not null"`
	Boxes     []Box  `gorm:"foreignkey:StoreID;association_foreignkey:StoreID"`
}

func GetStores

func GetStores() ([]Store, error)

func (*Store) AddStoreBox

func (s *Store) AddStoreBox(b Box) error

func (*Store) Delete

func (s *Store) Delete() error

func (*Store) GetDetails

func (s *Store) GetDetails() error

func (*Store) GetManager

func (s *Store) GetManager() (User, error)

func (*Store) GetStoreBoxes

func (s *Store) GetStoreBoxes() ([]Box, error)

func (*Store) Insert

func (s *Store) Insert() error

func (*Store) Update

func (s *Store) Update() error

type User

type User struct {
	UserID   int       `json:"id" gorm:"primary_key;AUTO_INCREMENT;not null"`
	Username string    `json:"username" gorm:"not null"`
	Password string    `json:"password" gorm:"not null"`
	Salt     string    `json:"-" gorm:"not null"`
	Email    string    `json:"email" gorm:"not null"`
	Right    UserRight `json:"userright" gorm:"not null"`
}

func GetUsers

func GetUsers() ([]User, error)

func (*User) GetDetails

func (u *User) GetDetails() error

func (*User) GetDetailstoUsername

func (u *User) GetDetailstoUsername() error

func (*User) Insert

func (u *User) Insert() error

func (*User) Patch

func (u *User) Patch(ou User) error

func (*User) Update

func (u *User) Update() error

type UserRight

type UserRight int
const (
	USERRIGHT_MEMBER UserRight = 1 + iota
	USERRIGHT_ADMIN
)

type Wishlist

type Wishlist struct {
	WishlistID int         `gorm:"primary_key;AUTO_INCREMENT;not null"`
	Name       string      `gorm:"not null"`
	Items      []Equipment `gorm:"many2many:wishlist_equipment;"`
}

func GetWishlists

func GetWishlists() ([]Wishlist, error)

func (*Wishlist) AddWishlistItem

func (w *Wishlist) AddWishlistItem(e Equipment) error

func (*Wishlist) Delete

func (w *Wishlist) Delete() error

func (*Wishlist) GetDetails

func (w *Wishlist) GetDetails() error

func (*Wishlist) GetWishlistItems

func (w *Wishlist) GetWishlistItems() ([]Equipment, error)

func (*Wishlist) Insert

func (w *Wishlist) Insert() error

func (*Wishlist) Update

func (w *Wishlist) Update() error

Jump to

Keyboard shortcuts

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