models

package
v0.0.0-...-39205ac Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash

func Hash(password string) ([]byte, error)

func VerifyPassword

func VerifyPassword(hashedPassword, password string) error

Types

type Department

type Department struct {
	ID        uint      `json:"id" gorm:"primarykey"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	Name      string    `json:"name"`
}

Department Database

type Employe

type Employe struct {
	ID           uint        `json:"id" gorm:"primarykey"`
	CreatedAt    time.Time   `json:"created_at"`
	UpdatedAt    time.Time   `json:"updated_at"`
	FirstName    string      `json:"firstname" validate:"required,min=2,max=30"`
	LastName     string      `json:"lastname" validate:"required,min=2,max=30"`
	Description  string      `json:"description,omitempty" validate:"omitempty,min=20,max=300"`
	BatchID      string      `json:"batch_id" gorm:"unique"`
	DepartmentID uint        `json:"department_id"`
	Violations   []Violation `json:"violations" gorm:"foreignKey:ID"`
	IsActive     bool        `json:"isactive"`
}

Employe Database

type HMI

type HMI struct {
	ID        uint           `json:"id" gorm:"primarykey"`
	CreatedAt time.Time      `json:"created_at"`
	UpdatedAt time.Time      `json:"updated_at"`
	MachineID uint           `json:"machine_id"`
	Name      string         `json:"name"`
	IP        pgtype.Inet    `json:"ip" gorm:"type:inet"`
	Port      int            `json:"port"`
	MAC       pgtype.Macaddr `json:"mac" gorm:"type:macaddr"`
	HMIUsers  []HMIUser      `json:"hmiusers" gorm:"foreignKey:ID"`
}

type HMIUser

type HMIUser struct {
	ID              uint      `json:"id" gorm:"primarykey"`
	CreatedAt       time.Time `json:"created_at"`
	UpdatedAt       time.Time `json:"updated_at"`
	HMIID           uint      `json:"hmi_id"`
	EmployeID       uint      `json:"employe_id"`
	PermissionLevel int       `json:"permission_level"`
}

type Line

type Line struct {
	ID        uint      `json:"id" gorm:"primarykey"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	Name      string    `json:"name"`
	Machines  []Machine `json:"machines" gorm:"foreignKey:ID"`
}

type Machine

type Machine struct {
	ID        uint      `json:"id" gorm:"primarykey"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	LineID    uint      `json:"line_id"`
	Name      string    `json:"name"`
	Stations  []Station `json:"stastions" gorm:"foreignKey:ID"`
	PLCs      []PLC     `json:"plcs" gorm:"foreignKey:ID"`
	HMIs      []HMI     `json:"hmis" gorm:"foreignKey:ID"`
	IsActive  bool      `json:"is_active"`
}

type PLC

type PLC struct {
	ID        uint           `json:"id" gorm:"primarykey"`
	CreatedAt time.Time      `json:"created_at"`
	UpdatedAt time.Time      `json:"updated_at"`
	MachineID uint           `json:"machine_id"`
	Name      string         `json:"name"`
	IP        pgtype.Inet    `json:"ip" gorm:"type:inet"`
	Port      int            `json:"port"`
	MAC       pgtype.Macaddr `json:"mac" gorm:"type:macaddr"`
}

type Station

type Station struct {
	ID          uint      `json:"id" gorm:"primarykey"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
	MachineID   uint      `json:"machine_id"`
	Name        string    `json:"name"`
	ShortName   string    `json:"short_name"`
	Description string    `json:"description"`
	IsActive    bool      `json:"is_active"`
}

type User

type User struct {
	ID        uint      `json:"id" gorm:"primarykey"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	Name      string    `json:"name" gorm:"unique" validate:"required,min=3,max=20"`
	Email     string    `json:"email" gorm:"unique" validate:"required,email"`
	Password  []byte    `json:"password" validate:"required"`
	IsAdmin   bool      `json:"is_admin"`
}

type Violation

type Violation struct {
	ID        uint      `json:"id" gorm:"primarykey"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	Text      string    `json:"text" validate:"required,min=20,max=300"`
}

Violations

Jump to

Keyboard shortcuts

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