20 lines
409 B
Go
20 lines
409 B
Go
package mongo
|
|
|
|
import (
|
|
"api-poliklinik/pkg/models/mongo/practitioner"
|
|
"context"
|
|
"log"
|
|
"time"
|
|
)
|
|
|
|
func (s *DatabaseService) InsertPractitioner(req practitioner.Practitioner) error {
|
|
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
|
defer cancel()
|
|
_, err := s.DBMongo.Collection("practitioner").InsertOne(ctx, req)
|
|
if err != nil {
|
|
log.Println(err)
|
|
return err
|
|
}
|
|
return nil
|
|
}
|