pembaruhan baru
This commit is contained in:
No files matched your search
@@ -0,0 +1,25 @@
|
||||
package mongo
|
||||
|
||||
import (
|
||||
"api-poliklinik/pkg/models/mongo/appointment"
|
||||
"context"
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"log"
|
||||
"time"
|
||||
)
|
||||
|
||||
func (s *DatabaseService) Getappointment() ([]*appointment.Appointment, error) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel()
|
||||
dataappointment, err := s.DBMongo.Collection("location").Find(ctx, bson.D{})
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
var appointment []*appointment.Appointment
|
||||
err = dataappointment.All(ctx, &appointment)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return nil, err
|
||||
}
|
||||
return appointment, nil
|
||||
}
|
||||
Reference in New Issue
Block a user