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() {
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
import (
"time"
"gorm.io/gorm"
)
type Post struct {
gorm.Model
Name string
Email string `gorm:"unique"`
Password string
Gender string
Address string
Tempat string
TLahir string
Nik string
Name string
Photo string
Birthdate time.Time
JobTitle string
Email string `gorm:"unique"`
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