Explorar o código

Working on groups

Andrea Fazzi %!s(int64=5) %!d(string=hai) anos
pai
achega
b24e452ca1
Modificáronse 2 ficheiros con 11 adicións e 0 borrados
  1. 9 0
      orm/group.go
  2. 2 0
      orm/teacher.go

+ 9 - 0
orm/group.go

@@ -0,0 +1,9 @@
+package orm
+
+import "github.com/jinzhu/gorm"
+
+type Group struct {
+	gorm.Model
+
+	Name string
+}

+ 2 - 0
orm/teacher.go

@@ -21,6 +21,8 @@ type Teacher struct {
 	Activities  []*Activity
 	Departments []*Department
 
+	Groups []*Group `gorm:many2may:teacher_groups`
+
 	SubjectsByClass map[uint][]*Subject `gorm:"-"`
 
 	Hours       int