registry

package
v0.0.0-...-00c2f43 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseJson

type BaseJson struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

type Device

type Device struct {
	ID          uuid.UUID `gorm:"index:;primaryKey;type:char(36)"`
	Name        string    `gorm:"not null; unique"`
	Description string

	Manufacturer *Manufacturer
	Location     *Location
	Type         *Type

	ManufacturerId string `gorm:"not null;type:char(36)"`
	LocationId     string `gorm:"not null;type:char(36)"`
	TypeId         string `gorm:"not null;type:char(36)"`
	Quantity       int    `gorm:"not null; check:quantity > 0"`
	Contents       string `gorm:"type:text"`
	gorm.Model
}

func DeviceFromJson

func DeviceFromJson(device JsonDevice, db *gorm.DB) (*Device, error)

func (*Device) Validate

func (device *Device) Validate(db *gorm.DB) error

func (*Device) VerifyContents

func (device *Device) VerifyContents(db *gorm.DB) error

type JsonDevice

type JsonDevice struct {
	ID           string   `json:"id"`
	Name         string   `json:"name"`
	Description  string   `json:"description"`
	Location     string   `json:"location"`
	Manufacturer string   `json:"manufacturer"`
	Type         string   `json:"type"`
	Quantity     int      `json:"quantity"`
	Contents     []string `json:"contents"`
}

type JsonLocation

type JsonLocation BaseJson

type JsonManufacturer

type JsonManufacturer BaseJson

type JsonType

type JsonType BaseJson

type Location

type Location struct {
	ID          uuid.UUID `gorm:"primaryKey; not null;type:char(36)"`
	Name        string    `gorm:"not null; unique"`
	Description string
	gorm.Model
}

func (*Location) Validate

func (location *Location) Validate(db *gorm.DB) error

type Manufacturer

type Manufacturer struct {
	ID          uuid.UUID `json:"id" gorm:"primaryKey; not null;type:char(36)"`
	Name        string    `json:"name" gorm:"not null; unique"`
	Description string    `json:"description"`
	gorm.Model
}

func (*Manufacturer) Validate

func (manufacturer *Manufacturer) Validate(db *gorm.DB) error

type Type

type Type struct {
	ID          uuid.UUID `gorm:"primaryKey; not null;type:char(36)"`
	Name        string    `gorm:"not null; unique"`
	Description string
	gorm.Model
}

func (*Type) BeforeCreate

func (t *Type) BeforeCreate(db *gorm.DB) (err error)

func (*Type) Validate

func (t *Type) Validate(db *gorm.DB) error

Jump to

Keyboard shortcuts

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