model

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: May 20, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValidationErr

func IsValidationErr(err error) bool

IsValidationErr returns true if err is a validation error

Types

type Client

type Client struct {
	ID   uint   `gorm:"primary_key"`
	Name string `gorm:"not null;unique"`
}

Client struct

func (*Client) Validate

func (client *Client) Validate() error

Validate validates the client

type Pager

type Pager struct {
	ID         uint   `gorm:"primary_key"`
	Name       string `gorm:"not null;unique"`
	EasyCallID uint   `gorm:"not null;unique"`
}

Pager struct

func (*Pager) Validate added in v1.1.0

func (pager *Pager) Validate() error

Validate validates the pager

type Patient

type Patient struct {
	ID               uint   `gorm:"primary_key"`
	SocialSecurityNo string `gorm:"column:ssn;not null;unique"`
	Name             string `gorm:"not null"`
	Pager            Pager  `gorm:"save_associations:false"`
	PagerID          uint
	Client           Client `gorm:"save_associations:false"`
	ClientID         uint
	Status           PatientStatus `gorm:"not null" sql:"default:\"pending\""`
	Active           bool          `gorm:"not null" sql:"default:false"`
}

Patient struct

func (*Patient) Validate

func (patient *Patient) Validate(pagers []*Pager) error

Validate validates the patient

type PatientStatus

type PatientStatus string

PatientStatus hold the state of the Patient

const (
	// PatientStatusPending is for when the patient is pending
	PatientStatusPending PatientStatus = "pending"
	// PatientStatusCall is for when the patient's pager gets called
	PatientStatusCall PatientStatus = "call"
	// PatientStatusCalled is for when the patient's pager has been called
	PatientStatusCalled PatientStatus = "called"
	// PatientStatusFinished is for when the patient is finished with his medical examination
	PatientStatusFinished PatientStatus = "finished"
)

enumerates all states a patient can be in

type Token

type Token struct {
	ID     uint   `gorm:"primary_key"`
	Raw    string `gorm:"not null;unique"`
	User   User   `gorm:"save_associations:false"`
	UserID uint
}

Token struct

type User

type User struct {
	ID       uint   `gorm:"primary_key"`
	Username string `gorm:"not null;unique"`
	Password string `gorm:"not null"`
	Client   Client `gorm:"save_associations:false"`
	ClientID uint   `gorm:"unique"`
}

User struct

func (*User) Validate

func (user *User) Validate(clients []*Client) error

Validate validates the user

func (*User) ValidatePasswordChange

func (user *User) ValidatePasswordChange() error

ValidatePasswordChange validates the user requirements when changing password

Jump to

Keyboard shortcuts

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