Browse Source

Upload

user
Seyora24 1 year ago
parent
commit
28b0d4b7a3
  1. 1
      initializers/syncDatabase.go
  2. 15
      models/loginRecord.go
  3. 27
      models/postModel.go
  4. BIN
      tugas1.exe

1
initializers/syncDatabase.go

@ -4,4 +4,5 @@ import "tugas1/models"
func SyncDatabase() { func SyncDatabase() {
DB.AutoMigrate(&models.Post{}) DB.AutoMigrate(&models.Post{})
DB.AutoMigrate(&models.LoginRecord{})
} }

15
models/loginRecord.go

@ -0,0 +1,15 @@
package models
import (
"time"
"gorm.io/gorm"
)
type LoginRecord struct {
gorm.Model
LoginDate time.Time
UserIDs string `gorm:"type:text"`
Users []Post `json:"users" gorm:"-"`
}

27
models/postModel.go

@ -1,16 +1,29 @@
package models package models
import ( import (
"time"
"gorm.io/gorm" "gorm.io/gorm"
) )
type Post struct { type Post struct {
gorm.Model gorm.Model
Name string Nik string
Email string `gorm:"unique"` Name string
Password string Photo string
Gender string Birthdate time.Time
Address string JobTitle string
Tempat string Email string `gorm:"unique"`
TLahir string LastLoginAt time.Time
CreatedBy string
UpdatedBy string
DeletedBy string
Token string
Username string
RoleID int
Password string
Gender string
Address string
Tempat string
TLahir string
} }

BIN
tugas1.exe

Binary file not shown.
Loading…
Cancel
Save