models

package
v0.0.0-...-50b1eba Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DB is the application business database
	DB *gorm.DB
)

Functions

func CreateAdmin

func CreateAdmin(siteName string) *admin.Admin

CreateAdmin creates an admin based on the models

Types

type Employee

type Employee struct {
	gorm.Model
	Name          string
	Languages     []*Language `gorm:"many2many:employee_languages;"`
	HomeAddresses []HomeAddress
}

Employee has and belongs to many languages, use `employee_languages` as join table

type HomeAddress

type HomeAddress struct {
	gorm.Model
	Name       string
	City       string
	EmployeeID uint
}

HomeAddress as a many to one relationship with Employee

type Language

type Language struct {
	gorm.Model
	Name      string
	Employees []*Employee `gorm:"many2many:employee_languages;"`
}

Language and belongs to many languages, use `employee_languages` as join table

Jump to

Keyboard shortcuts

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