Browse Source

完成数据服务集成

yjp 11 months ago
parent
commit
432979fccc

+ 1 - 1
application/application.go

@@ -64,7 +64,7 @@ func (app *App) Logger() *logger.Logger {
 // Binder 创建Binder
 func (app *App) Binder(routerVersion string) *binding.Binder {
 	var router api.Router
-	if routerVersion != "" {
+	if routerVersion == "" {
 		router = app.apiInstance.RootRouter()
 	} else {
 		router = app.apiInstance.PrefixRouter().VersionedRouter(routerVersion)

+ 35 - 13
baize.go

@@ -4,31 +4,53 @@ import (
 	"git.sxidc.com/go-framework/baize/api"
 	"git.sxidc.com/go-framework/baize/application"
 	"git.sxidc.com/go-framework/baize/infrastructure"
+	"git.sxidc.com/go-framework/baize/infrastructure/database/data_service"
 	"git.sxidc.com/go-framework/baize/infrastructure/database/operations"
 )
 
 func NewApplication(conf application.Config) *application.App {
+	// 创建API
 	apiConfig := conf.ApiConfig
 	apiInstance := api.New(api.WithUrlPrefix(apiConfig.UrlPrefix), api.WithPort(apiConfig.Port))
 
+	// 创建基础设施
 	var infrastructureInstance *infrastructure.Infrastructure
+
+	infrastructureConfig := infrastructure.Config{
+		DatabaseConfig: infrastructure.DatabaseConfig{},
+	}
+
 	if conf.InfrastructureConfig.Database.Operations != nil {
 		operationsConfig := conf.InfrastructureConfig.Database.Operations
-		infrastructureInstance = infrastructure.NewInfrastructure(infrastructure.Config{
-			DatabaseConfig: infrastructure.DatabaseConfig{
-				Operations: &operations.Config{
-					UserName:           operationsConfig.UserName,
-					Password:           operationsConfig.Password,
-					Address:            operationsConfig.Address,
-					Port:               operationsConfig.Port,
-					Database:           operationsConfig.Database,
-					MaxConnections:     operationsConfig.MaxConnections,
-					MaxIdleConnections: operationsConfig.MaxIdleConnections,
-				},
-			},
-		})
+		if operationsConfig != nil {
+			infrastructureConfig.DatabaseConfig.Operations = &operations.Config{
+				UserName:           operationsConfig.UserName,
+				Password:           operationsConfig.Password,
+				Address:            operationsConfig.Address,
+				Port:               operationsConfig.Port,
+				Database:           operationsConfig.Database,
+				MaxConnections:     operationsConfig.MaxConnections,
+				MaxIdleConnections: operationsConfig.MaxIdleConnections,
+			}
+		}
 	}
 
+	if conf.InfrastructureConfig.Database.DataService != nil {
+		dataServiceConfig := conf.InfrastructureConfig.Database.DataService
+		if dataServiceConfig != nil {
+			infrastructureConfig.DatabaseConfig.DataService = &data_service.Config{
+				Token:       dataServiceConfig.Token,
+				BaseUrl:     dataServiceConfig.BaseUrl,
+				GrpcAddress: dataServiceConfig.GrpcAddress,
+				Namespace:   dataServiceConfig.Namespace,
+				DataSource:  dataServiceConfig.DataSource,
+				TimeoutSec:  dataServiceConfig.TimeoutSec,
+			}
+		}
+	}
+
+	infrastructureInstance = infrastructure.NewInfrastructure(infrastructureConfig)
+
 	return application.New(apiInstance, infrastructureInstance)
 }
 

+ 13 - 13
examples/binding/main.go

@@ -16,11 +16,11 @@ import (
 	"time"
 )
 
-// curl -X POST -H "Content-Type: application/json" -d '{"name":"test"}' "http://localhost:10000/test/v1/class/create"
-// curl -X PUT -H "Content-Type: application/json" -d '{"id":"ab0d4a9acce44ddd91ad4746ecd34392", "name":"test-new"}' "http://localhost:10000/test/v1/class/update"
-// curl -X GET "http://localhost:10000/test/v1/class/query?name=test-new&pageNo=0&pageSize=1"
-// curl -X GET "http://localhost:10000/test/v1/class/get?id=ab0d4a9acce44ddd91ad4746ecd34392"
-// curl -X DELETE "http://localhost:10000/test/v1/class/ab0d4a9acce44ddd91ad4746ecd34392/delete"
+// curl -X POST -H "Content-Type: application/json" -d '{"name":"test"}' "http://localhost:10100/test/v1/class/create"
+// curl -X PUT -H "Content-Type: application/json" -d '{"id":"ab0d4a9acce44ddd91ad4746ecd34392", "name":"test-new"}' "http://localhost:10100/test/v1/class/update"
+// curl -X GET "http://localhost:10100/test/v1/class/query?name=test-new&pageNo=0&pageSize=1"
+// curl -X GET "http://localhost:10100/test/v1/class/get?id=ab0d4a9acce44ddd91ad4746ecd34392"
+// curl -X DELETE "http://localhost:10100/test/v1/class/ab0d4a9acce44ddd91ad4746ecd34392/delete"
 
 type CreateClassJsonBody struct {
 	Name string `json:"name" binding:"required" assign:"toField:Name"`
@@ -75,7 +75,7 @@ func main() {
 	app := baize.NewApplication(application.Config{
 		ApiConfig: application.ApiConfig{
 			UrlPrefix: "test",
-			Port:      "10000",
+			Port:      "10100",
 		},
 		InfrastructureConfig: application.InfrastructureConfig{
 			Database: infrastructure.DatabaseConfig{
@@ -96,7 +96,7 @@ func main() {
 		baize.DestroyApplication(app)
 	}()
 
-	dbOperations := app.Infrastructure().GetDBOperations()
+	dbOperations := app.Infrastructure().DBOperations()
 	err := dbOperations.AutoMigrate(operations.Table{
 		TableName: tableName,
 		Columns: []operations.TableColumn{
@@ -149,7 +149,7 @@ func main() {
 			e := domain.ToConcreteObject[*Class](objects[0])
 			e.ID = strutils.SimpleUUID()
 
-			err := database.InsertEntity(i.GetDBOperations(), tableName, e)
+			err := database.InsertEntity(i.DBOperations(), tableName, e)
 			if err != nil {
 				return "", err
 			}
@@ -167,7 +167,7 @@ func main() {
 		ServiceFunc: func(c *api.Context, dto binding.DTO, objects []domain.Object, i *infrastructure.Infrastructure) (any, error) {
 			e := domain.ToConcreteObject[*Class](objects[0])
 
-			err := database.DeleteEntity(i.GetDBOperations(), tableName, e)
+			err := database.DeleteEntity(i.DBOperations(), tableName, e)
 			if err != nil {
 				return "", err
 			}
@@ -185,7 +185,7 @@ func main() {
 		ServiceFunc: func(c *api.Context, dto binding.DTO, objects []domain.Object, i *infrastructure.Infrastructure) (any, error) {
 			e := domain.ToConcreteObject[*Class](objects[0])
 
-			result, err := database.QueryOne(i.GetDBOperations(), &sql.QueryOneExecuteParams{
+			result, err := database.QueryOne(i.DBOperations(), &sql.QueryOneExecuteParams{
 				TableName:  tableName,
 				Conditions: sql.NewConditions().Equal("id", e.ID),
 			})
@@ -207,7 +207,7 @@ func main() {
 				newEntity.Name = e.Name
 			}
 
-			err = database.UpdateEntity(i.GetDBOperations(), tableName, newEntity)
+			err = database.UpdateEntity(i.DBOperations(), tableName, newEntity)
 			if err != nil {
 				return "", err
 			}
@@ -233,7 +233,7 @@ func main() {
 				conditions.Equal("name", e.Name)
 			}
 
-			results, totalCount, err := database.Query(i.GetDBOperations(), &sql.QueryExecuteParams{
+			results, totalCount, err := database.Query(i.DBOperations(), &sql.QueryExecuteParams{
 				TableName:  tableName,
 				Conditions: conditions,
 				PageNo:     pageNo,
@@ -270,7 +270,7 @@ func main() {
 		ServiceFunc: func(c *api.Context, dto binding.DTO, objects []domain.Object, i *infrastructure.Infrastructure) (*ClassInfo, error) {
 			e := domain.ToConcreteObject[*Class](objects[0])
 
-			result, err := database.QueryOne(i.GetDBOperations(), &sql.QueryOneExecuteParams{
+			result, err := database.QueryOne(i.DBOperations(), &sql.QueryOneExecuteParams{
 				TableName:  tableName,
 				Conditions: sql.NewConditions().Equal("id", e.ID),
 			})

+ 269 - 0
examples/binding_ds/main.go

@@ -0,0 +1,269 @@
+package main
+
+import (
+	"git.sxidc.com/go-framework/baize"
+	"git.sxidc.com/go-framework/baize/api"
+	"git.sxidc.com/go-framework/baize/application"
+	"git.sxidc.com/go-framework/baize/binding"
+	"git.sxidc.com/go-framework/baize/domain"
+	"git.sxidc.com/go-framework/baize/infrastructure"
+	"git.sxidc.com/go-framework/baize/infrastructure/database"
+	"git.sxidc.com/go-framework/baize/infrastructure/database/data_service"
+	"git.sxidc.com/go-framework/baize/infrastructure/database/sql"
+	"git.sxidc.com/go-tools/utils/strutils"
+	DEATH "github.com/vrecan/death"
+	"syscall"
+	"time"
+)
+
+// curl -X POST -H "Content-Type: application/json" -d '{"name":"test"}' "http://localhost:10100/test/v1/class/create"
+// curl -X PUT -H "Content-Type: application/json" -d '{"id":"975750d39d674a57af2e49c670033ee8", "name":"test-new"}' "http://localhost:10100/test/v1/class/update"
+// curl -X GET "http://localhost:10100/test/v1/class/query?name=test-new&pageNo=0&pageSize=1"
+// curl -X GET "http://localhost:10100/test/v1/class/get?id=975750d39d674a57af2e49c670033ee8"
+// curl -X DELETE "http://localhost:10100/test/v1/class/975750d39d674a57af2e49c670033ee8/delete"
+
+type CreateClassJsonBody struct {
+	Name string `json:"name" binding:"required" assign:"toField:Name"`
+}
+
+type DeleteClassPathParams struct {
+	ID string `uri:"id" binding:"required" assign:"toField:ID"`
+}
+
+type UpdateClassJsonBody struct {
+	ID   string `json:"id" binding:"required" assign:"toField:ID"`
+	Name string `json:"name" assign:"toField:Name"`
+}
+
+type QueryClassesQueryParams struct {
+	Name     string `form:"name" assign:"toField:Name"`
+	PageNo   int    `form:"pageNo" assign:"-"`
+	PageSize int    `form:"pageSize" assign:"-"`
+}
+
+type GetClassQueryParams struct {
+	ID string `form:"id" binding:"required" assign:"toField:ID"`
+}
+
+type DomainIDField struct {
+	ID string `sqlmapping:"column:id"`
+}
+
+type Class struct {
+	*DomainIDField
+	Name            string `sqlmapping:"column:name"`
+	CreatedTime     time.Time
+	LastUpdatedTime *time.Time
+}
+
+type InfoIDField struct {
+	ID string `json:"id" sqlresult:"column:id"`
+}
+
+type ClassInfo struct {
+	*InfoIDField
+	Name            string `json:"name" sqlresult:"column:name"`
+	CreatedTime     string `sqlresult:"parseTime:'2006-01-02 15:04:05'"`
+	LastUpdatedTime string `sqlresult:"parseTime:'2006-01-02 15:04:05'"`
+}
+
+const (
+	tableName = "test.classes"
+)
+
+func main() {
+	app := baize.NewApplication(application.Config{
+		ApiConfig: application.ApiConfig{
+			UrlPrefix: "test",
+			Port:      "10100",
+		},
+		InfrastructureConfig: application.InfrastructureConfig{
+			Database: infrastructure.DatabaseConfig{
+				DataService: &data_service.Config{
+					Token:       "8qe+uPgpQ2JWxu3lSyOx5NjX+INp5WsnoD1ZWb7PBm4=",
+					BaseUrl:     "http://localhost:10000",
+					GrpcAddress: "localhost:10001",
+					Namespace:   "baize",
+					DataSource:  "baize-binding",
+					TimeoutSec:  30,
+				},
+			},
+		},
+	})
+
+	defer func() {
+		baize.DestroyApplication(app)
+	}()
+
+	app.Api().
+		PrefixRouter().
+		RegisterVersionedRouter("v1")
+
+	binder := app.Binder("v1")
+
+	// 创建班级
+	binding.PostBind(binder, &binding.SimpleBindItem[string]{
+		Path:         "/class/create",
+		ResponseFunc: binding.SendIDResponse[string],
+		DTO:          &CreateClassJsonBody{},
+		Objects:      []domain.Object{&Class{}},
+		ServiceFunc: func(c *api.Context, dto binding.DTO, objects []domain.Object, i *infrastructure.Infrastructure) (string, error) {
+			e := domain.ToConcreteObject[*Class](objects[0])
+			e.ID = strutils.SimpleUUID()
+
+			err := database.InsertEntity(i.DataService(), tableName, e)
+			if err != nil {
+				return "", err
+			}
+
+			return e.ID, nil
+		},
+	})
+
+	// 删除班级
+	binding.DeleteBind(binder, &binding.SimpleBindItem[any]{
+		Path:         "/class/:id/delete",
+		ResponseFunc: binding.SendMsgResponse,
+		DTO:          &DeleteClassPathParams{},
+		Objects:      []domain.Object{&Class{}},
+		ServiceFunc: func(c *api.Context, dto binding.DTO, objects []domain.Object, i *infrastructure.Infrastructure) (any, error) {
+			e := domain.ToConcreteObject[*Class](objects[0])
+
+			err := database.DeleteEntity(i.DataService(), tableName, e)
+			if err != nil {
+				return "", err
+			}
+
+			return nil, nil
+		},
+	})
+
+	// 修改班级
+	binding.PutBind(binder, &binding.SimpleBindItem[any]{
+		Path:         "/class/update",
+		ResponseFunc: binding.SendMsgResponse,
+		DTO:          &UpdateClassJsonBody{},
+		Objects:      []domain.Object{&Class{}},
+		ServiceFunc: func(c *api.Context, dto binding.DTO, objects []domain.Object, i *infrastructure.Infrastructure) (any, error) {
+			e := domain.ToConcreteObject[*Class](objects[0])
+
+			result, err := database.QueryOne(i.DataService(), &sql.QueryOneExecuteParams{
+				TableName:  tableName,
+				Conditions: sql.NewConditions().Equal("id", e.ID),
+			})
+			if err != nil {
+				return nil, err
+			}
+
+			existClass := new(Class)
+			err = sql.ParseSqlResult(result, existClass)
+			if err != nil {
+				return nil, err
+			}
+
+			newEntity := &Class{
+				DomainIDField: &DomainIDField{ID: existClass.ID},
+			}
+
+			if strutils.IsStringNotEmpty(e.Name) && e.Name != existClass.Name {
+				newEntity.Name = e.Name
+			}
+
+			err = database.UpdateEntity(i.DataService(), tableName, newEntity)
+			if err != nil {
+				return "", err
+			}
+
+			return nil, nil
+		},
+	})
+
+	// 查询班级
+	binding.GetBind(binder, &binding.SimpleBindItem[binding.InfosData[ClassInfo]]{
+		Path:         "/class/query",
+		ResponseFunc: binding.SendInfosResponse[ClassInfo],
+		DTO:          &QueryClassesQueryParams{},
+		Objects:      []domain.Object{&Class{}},
+		ServiceFunc: func(c *api.Context, dto binding.DTO, objects []domain.Object, i *infrastructure.Infrastructure) (binding.InfosData[ClassInfo], error) {
+			e := domain.ToConcreteObject[*Class](objects[0])
+			pageNo := binding.Field[int](dto, "PageNo")
+			pageSize := binding.Field[int](dto, "PageSize")
+
+			conditions := sql.NewConditions()
+
+			if strutils.IsStringNotEmpty(e.Name) {
+				conditions.Equal("name", e.Name)
+			}
+
+			results, totalCount, err := database.Query(i.DataService(), &sql.QueryExecuteParams{
+				TableName:  tableName,
+				Conditions: conditions,
+				PageNo:     pageNo,
+				PageSize:   pageSize,
+			})
+			if err != nil {
+				return binding.InfosData[ClassInfo]{
+					Infos: make([]ClassInfo, 0),
+				}, nil
+			}
+
+			classInfos := make([]ClassInfo, 0)
+			err = sql.ParseSqlResult(results, &classInfos)
+			if err != nil {
+				return binding.InfosData[ClassInfo]{
+					Infos: make([]ClassInfo, 0),
+				}, nil
+			}
+
+			return binding.InfosData[ClassInfo]{
+				Infos:      classInfos,
+				TotalCount: totalCount,
+				PageNo:     pageNo,
+			}, nil
+		},
+	})
+
+	// 通过ID获取班级
+	binding.GetBind(binder, &binding.SimpleBindItem[*ClassInfo]{
+		Path:         "/class/get",
+		ResponseFunc: binding.SendInfoResponse[*ClassInfo],
+		DTO:          &GetClassQueryParams{},
+		Objects:      []domain.Object{&Class{}},
+		ServiceFunc: func(c *api.Context, dto binding.DTO, objects []domain.Object, i *infrastructure.Infrastructure) (*ClassInfo, error) {
+			e := domain.ToConcreteObject[*Class](objects[0])
+
+			result, err := database.QueryOne(i.DataService(), &sql.QueryOneExecuteParams{
+				TableName:  tableName,
+				Conditions: sql.NewConditions().Equal("id", e.ID),
+			})
+			if err != nil {
+				return nil, err
+			}
+
+			info := new(ClassInfo)
+			err = sql.ParseSqlResult(result, info)
+			if err != nil {
+				return nil, err
+			}
+
+			return info, nil
+		},
+	})
+
+	go func() {
+		err := app.Start()
+		if err != nil {
+			panic(err)
+		}
+	}()
+
+	defer func() {
+		err := app.Finish()
+		if err != nil {
+			panic(err)
+		}
+	}()
+
+	death := DEATH.NewDeath(syscall.SIGINT, syscall.SIGTERM)
+	_ = death.WaitForDeath()
+}

+ 47 - 0
examples/binding_ds/resources.yaml

@@ -0,0 +1,47 @@
+kind: Namespace
+spec:
+  name: baize
+
+---
+
+kind: DataSource
+spec:
+  type: database
+  namespace: baize
+  name: baize-binding
+  spec:
+    type: postgres
+    user_name: test
+    password: "123456"
+    address: "10.0.0.84"
+    port: "30432"
+    database: test
+    max_connections: 40
+    max_idle_connections: 10
+
+---
+
+kind: DataContainer
+spec:
+  namespace: baize
+  data_source: baize-binding
+  name: baize-binding
+  spec:
+    table_name: test.classes
+    columns:
+      - name: id
+        type: varchar(32)
+        comment: id
+        primary_key: true
+      - name: name
+        type: varchar(128)
+        comment: 班名
+        not_null: true
+      - name: created_time
+        type: "timestamp with time zone"
+        comment: 创建时间
+        not_null: true
+      - name: last_updated_time
+        type: "timestamp with time zone"
+        comment: 最近更新时间
+        not_null: true

+ 1 - 1
examples/common_crud/main.go

@@ -24,7 +24,7 @@ package main
 //}
 
 func main() {
-	//app, err := baize.NewApplication("10000", WithDB(config))
+	//app, err := baize.NewApplication("10100", WithDB(config))
 	//if err != nil {
 	//	panic(err)
 	//}

+ 1 - 1
examples/quick_start/main.go

@@ -14,7 +14,7 @@ func main() {
 	app := baize.NewApplication(application.Config{
 		ApiConfig: application.ApiConfig{
 			UrlPrefix: "test",
-			Port:      "10000",
+			Port:      "10100",
 		},
 	})
 

+ 19 - 19
infrastructure/database/data_service/data_service.go

@@ -12,12 +12,12 @@ import (
 )
 
 type Config struct {
-	token       string
-	baseUrl     string
-	grpcAddress string
-	namespace   string
-	dataSource  string
-	timeout     time.Duration
+	Token       string
+	BaseUrl     string
+	GrpcAddress string
+	Namespace   string
+	DataSource  string
+	TimeoutSec  time.Duration
 }
 
 type DataService struct {
@@ -26,10 +26,10 @@ type DataService struct {
 	grpcClient *grpc_client.Client
 }
 
-func NewDataService(config Config) (*DataService, error) {
-	c := client.New(config.timeout)
+func NewDataService(config *Config) (*DataService, error) {
+	c := client.New(config.TimeoutSec * time.Second)
 
-	namespaceInfos, err := c.GetNamespaces(config.token, config.baseUrl, config.namespace, 1, 1)
+	namespaceInfos, err := c.GetNamespaces(config.Token, config.BaseUrl, config.Namespace, 1, 1)
 	if err != nil {
 		return nil, err
 	}
@@ -39,7 +39,7 @@ func NewDataService(config Config) (*DataService, error) {
 	}
 
 	dataSourceInfos, err := c.GetDataSources(
-		config.token, config.baseUrl, config.namespace, config.dataSource, "", 1, 1)
+		config.Token, config.BaseUrl, config.Namespace, config.DataSource, "", 1, 1)
 	if err != nil {
 		return nil, err
 	}
@@ -48,13 +48,13 @@ func NewDataService(config Config) (*DataService, error) {
 		return nil, fserr.New("数据源不存在")
 	}
 
-	grpcClient, err := grpc_client.NewClient(config.grpcAddress)
+	grpcClient, err := grpc_client.NewClient(config.GrpcAddress)
 	if err != nil {
 		return nil, err
 	}
 
 	return &DataService{
-		config:     config,
+		config:     *config,
 		client:     c,
 		grpcClient: grpcClient,
 	}, nil
@@ -82,8 +82,8 @@ func (ds *DataService) ExecuteRawSql(sqlStr string, executeParams map[string]any
 
 	config := ds.config
 
-	tableRows, err := ds.client.ExecuteRawSql(config.token, config.baseUrl,
-		config.namespace, config.dataSource, sqlStr, executeParams)
+	tableRows, err := ds.client.ExecuteRawSql(config.Token, config.BaseUrl,
+		config.Namespace, config.DataSource, sqlStr, executeParams)
 	if err != nil {
 		return nil, err
 	}
@@ -103,8 +103,8 @@ func (ds *DataService) ExecuteSql(name string, executeParams map[string]any) ([]
 
 	config := ds.config
 
-	tableRows, err := ds.client.ExecuteSql(config.token, config.baseUrl,
-		config.namespace, config.dataSource, name, executeParams)
+	tableRows, err := ds.client.ExecuteSql(config.Token, config.BaseUrl,
+		config.Namespace, config.DataSource, name, executeParams)
 	if err != nil {
 		return nil, err
 	}
@@ -133,9 +133,9 @@ func (ds *DataService) Transaction(txFunc TxFunc) error {
 	err = stream.Send(&request.TransactionOperation{
 		Request: &request.TransactionOperation_TransactionBeginRequest{
 			TransactionBeginRequest: &request.TransactionBeginRequest{
-				Token:      ds.config.token,
-				Namespace:  ds.config.namespace,
-				DataSource: ds.config.dataSource,
+				Token:      ds.config.Token,
+				Namespace:  ds.config.Namespace,
+				DataSource: ds.config.DataSource,
 			},
 		}})
 	if err != nil {

+ 20 - 3
infrastructure/infrastructure.go

@@ -10,7 +10,8 @@ type Config struct {
 }
 
 type DatabaseConfig struct {
-	Operations *operations.Config
+	Operations  *operations.Config
+	DataService *data_service.Config
 }
 
 type Infrastructure struct {
@@ -30,6 +31,15 @@ func NewInfrastructure(config Config) *Infrastructure {
 		i.dbOperations = op
 	}
 
+	if config.DatabaseConfig.DataService != nil {
+		dataService, err := data_service.NewDataService(config.DatabaseConfig.DataService)
+		if err != nil {
+			panic("创建数据服务失败" + err.Error())
+		}
+
+		i.dataService = dataService
+	}
+
 	return i
 }
 
@@ -38,6 +48,13 @@ func DestroyInfrastructure(i *Infrastructure) {
 		return
 	}
 
+	if i.dataService != nil {
+		err := data_service.DestroyDataService(i.dataService)
+		if err != nil {
+			panic("销毁数据服务失败" + err.Error())
+		}
+	}
+
 	if i.dbOperations != nil {
 		err := operations.DestroyOperation(i.dbOperations)
 		if err != nil {
@@ -48,10 +65,10 @@ func DestroyInfrastructure(i *Infrastructure) {
 	return
 }
 
-func (i Infrastructure) GetDBOperations() *operations.Operations {
+func (i Infrastructure) DBOperations() *operations.Operations {
 	return i.dbOperations
 }
 
-func (i Infrastructure) GetDataService() *data_service.DataService {
+func (i Infrastructure) DataService() *data_service.DataService {
 	return i.dataService
 }