init project
This commit is contained in:
24
pkg/database/mongo/master_data.go
Normal file
24
pkg/database/mongo/master_data.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package mongo
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
"template_blueprint/pkg/models/master_data"
|
||||
"time"
|
||||
)
|
||||
|
||||
func (s *DatabaseService) InsertDataMaster(req master_data.ReqInsertData) error {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel()
|
||||
_, err := s.DB.Collection(req.Table).InsertOne(ctx, master_data.ReqInsertDataMaster{
|
||||
ID: req.ID,
|
||||
System: req.System,
|
||||
Code: req.Code,
|
||||
Display: req.Display,
|
||||
})
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user