lengkap belum account
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user