lengkap belum account

This commit is contained in:
2025-05-15 13:45:45 +07:00
parent 1fb1caaf19
commit fd30463082
28 changed files with 1571 additions and 639 deletions
+39
View File
@@ -55,6 +55,45 @@ func (s *DatabaseService) InsertVillage(req Mongomaster.Village) error {
}
return nil
}
func (s *DatabaseService) Getsmf() ([]*Mongomaster.Smfmongo, error) {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
datasmf, err := s.DBMongo.Collection("smf").Find(ctx, bson.D{})
if err != nil {
log.Println(err)
}
var smf []*Mongomaster.Smfmongo
err = datasmf.All(ctx, &smf)
if err != nil {
log.Println(err)
return nil, err
}
return smf, nil
}
func (s *DatabaseService) GetICD(limit int64, skip int64) ([]*Mongomaster.Icdmongo, error) {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
findOptions := options.Find()
findOptions.SetLimit(limit)
findOptions.SetSkip(skip)
filter := bson.M{
"status": "active",
}
dataICD, err := s.DBMongo.Collection("icd").Find(ctx, filter, findOptions)
if err != nil {
log.Println(err)
}
var ICD []*Mongomaster.Icdmongo
err = dataICD.All(ctx, &ICD)
if err != nil {
log.Println(err)
return nil, err
}
return ICD, nil
}
func (s *DatabaseService) Getdataprovinsi() ([]*Mongomaster.State, error) {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()