Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Product ¶
type Product struct { ID uint `gorm:"primarykey" json:"id"` Name string `json:"name"` Price int `json:"price"` Timestamps }
type Timestamps ¶
type Timestamps struct { CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
func (*Timestamps) BeforeCreate ¶
func (t *Timestamps) BeforeCreate(tx *gorm.DB) (err error)
func (*Timestamps) BeforeUpdate ¶
func (t *Timestamps) BeforeUpdate(tx *gorm.DB) (err error)
type User ¶
type User struct { ID uint `gorm:"primaryKey" json:"id"` Username string `gorm:"unique;not null" json:"username"` Password string `gorm:"not null" json:"-"` Timestamps }
func (*User) BeforeCreate ¶
BeforeCreate adalah hook yang akan dijalankan sebelum data pengguna baru disimpan ke database
func (*User) CheckPassword ¶
CheckPassword memeriksa apakah password yang diberikan cocok dengan password yang di-hash
func (*User) HashPassword ¶
HashPassword mengenkripsi password pengguna menggunakan bcrypt
Click to show internal directories.
Click to hide internal directories.