Skip to content

Instantly share code, notes, and snippets.

View yusufsholeh's full-sized avatar

yusufsholeh

View GitHub Profile
func TestMitraGetByPhoneNumber(t *testing.T) {
var mitraFieldNames = []string{"id", "phone", "email", "password"}
rows := sqlmock.NewRows(mitraFieldNames)
rows.AddRow("1", "0812345678", "abdul@gmail.com", "abcdefghi")
db, mock, _ := sqlmock.New()
gormDb, _ := gorm.Open("postgres", db)
gormDb.LogMode(true)
}
// Class ORM
type Mitra struct {
gorm.Model
Phone string `gorm:"type:varchar(50);not null;unique default:null"`
Email string `gorm:"type:varchar(50);not null;unique"`
Password string
}
type MitraRepository struct {
}