Merged in feature/internalServices (pull request #5)
Move to Internal Service Interfaces
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
[submodule "api/serviceInterfaces"]
|
||||
path = api/serviceInterfaces
|
||||
url = https://bitbucket.org/aarete/service-interfaces.git
|
||||
+1
-8
@@ -7,12 +7,5 @@ includes:
|
||||
taskfile: scripts/Taskfile.yml
|
||||
flatten: true
|
||||
vars:
|
||||
PROJECT_NAME: QueryOrchestration
|
||||
COVERAGE_FILE: coverage.out
|
||||
COVERAGE_THRESHOLD: 80
|
||||
PROJECT_MAIN: cmd/grpc/main.go
|
||||
PROTOBUF_DIR: api/serviceInterfaces/queryOrchestration
|
||||
API_GRPC_DIR: api/grpc
|
||||
IMAGE_NAME: queryorchestration
|
||||
DOCKERFILE_DIR: build/package
|
||||
COMPOSE_FILE: deployments/compose.yaml
|
||||
COVERAGE_THRESHOLD: 80
|
||||
|
||||
@@ -2,14 +2,14 @@ package controllers
|
||||
|
||||
import (
|
||||
"context"
|
||||
"queryorchestration/api/grpc/spec"
|
||||
serviceinterfaces "queryorchestration/api/serviceInterfaces"
|
||||
"queryorchestration/internal/export"
|
||||
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
type ExportController struct {
|
||||
spec.UnimplementedExportServiceServer
|
||||
serviceinterfaces.UnimplementedExportServiceServer
|
||||
export export.Service
|
||||
validator *validator.Validate
|
||||
}
|
||||
@@ -21,6 +21,6 @@ func NewExportController(exportSvc export.Service, validator *validator.Validate
|
||||
}
|
||||
}
|
||||
|
||||
func (s *ExportController) Trigger(ctx context.Context, req *spec.ExportTrigger) (*spec.IdMessage, error) {
|
||||
return &spec.IdMessage{}, nil
|
||||
func (s *ExportController) Trigger(ctx context.Context, req *serviceinterfaces.ExportTrigger) (*serviceinterfaces.IdMessage, error) {
|
||||
return &serviceinterfaces.IdMessage{}, nil
|
||||
}
|
||||
@@ -2,7 +2,7 @@ package controllers
|
||||
|
||||
import (
|
||||
"context"
|
||||
"queryorchestration/api/grpc/spec"
|
||||
serviceinterfaces "queryorchestration/api/serviceInterfaces"
|
||||
"queryorchestration/internal/collector"
|
||||
|
||||
"github.com/go-playground/validator/v10"
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
)
|
||||
|
||||
type JobCollectorController struct {
|
||||
spec.UnimplementedJobCollectorServiceServer
|
||||
serviceinterfaces.UnimplementedJobCollectorServiceServer
|
||||
collector collector.Service
|
||||
validator *validator.Validate
|
||||
}
|
||||
@@ -23,14 +23,14 @@ func NewJobCollectorController(collSvc collector.Service, validator *validator.V
|
||||
}
|
||||
}
|
||||
|
||||
func (s *JobCollectorController) Get(ctx context.Context, req *spec.IdMessage) (*spec.JobCollector, error) {
|
||||
return &spec.JobCollector{}, nil
|
||||
func (s *JobCollectorController) Get(ctx context.Context, req *serviceinterfaces.IdMessage) (*serviceinterfaces.JobCollector, error) {
|
||||
return &serviceinterfaces.JobCollector{}, nil
|
||||
}
|
||||
|
||||
func (s *JobCollectorController) Create(ctx context.Context, req *spec.JobCollectorCreate) (*spec.IdMessage, error) {
|
||||
return &spec.IdMessage{}, nil
|
||||
func (s *JobCollectorController) Create(ctx context.Context, req *serviceinterfaces.JobCollectorCreate) (*serviceinterfaces.IdMessage, error) {
|
||||
return &serviceinterfaces.IdMessage{}, nil
|
||||
}
|
||||
|
||||
func (s *JobCollectorController) Update(ctx context.Context, req *spec.JobCollectorUpdate) (*emptypb.Empty, error) {
|
||||
func (s *JobCollectorController) Update(ctx context.Context, req *serviceinterfaces.JobCollectorUpdate) (*emptypb.Empty, error) {
|
||||
return &emptypb.Empty{}, nil
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"context"
|
||||
serviceinterfaces "queryorchestration/api/serviceInterfaces"
|
||||
"queryorchestration/internal/query"
|
||||
|
||||
"github.com/go-playground/validator/v10"
|
||||
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
type QueryController struct {
|
||||
serviceinterfaces.UnimplementedQueryServiceServer
|
||||
query query.Service
|
||||
validator *validator.Validate
|
||||
}
|
||||
|
||||
func NewQueryController(querySvc query.Service, validator *validator.Validate) *QueryController {
|
||||
return &QueryController{
|
||||
query: querySvc,
|
||||
validator: validator,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *QueryController) List(ctx context.Context, req *serviceinterfaces.QueryFilter) (*serviceinterfaces.Queries, error) {
|
||||
return &serviceinterfaces.Queries{}, nil
|
||||
}
|
||||
|
||||
func (s *QueryController) Get(ctx context.Context, req *serviceinterfaces.IdMessage) (*serviceinterfaces.Query, error) {
|
||||
return &serviceinterfaces.Query{}, nil
|
||||
}
|
||||
|
||||
func (s *QueryController) Create(ctx context.Context, req *serviceinterfaces.QueryCreate) (*serviceinterfaces.IdMessage, error) {
|
||||
return &serviceinterfaces.IdMessage{}, nil
|
||||
}
|
||||
|
||||
func (s *QueryController) Update(ctx context.Context, req *serviceinterfaces.QueryUpdate) (*emptypb.Empty, error) {
|
||||
return &emptypb.Empty{}, nil
|
||||
}
|
||||
|
||||
func (s *QueryController) Remove(ctx context.Context, req *serviceinterfaces.IdMessage) (*emptypb.Empty, error) {
|
||||
return &emptypb.Empty{}, nil
|
||||
}
|
||||
|
||||
func (s *QueryController) Test(ctx context.Context, req *serviceinterfaces.QueryTestRequest) (*serviceinterfaces.QueryTestResponse, error) {
|
||||
return &serviceinterfaces.QueryTestResponse{}, nil
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"context"
|
||||
"queryorchestration/api/grpc/spec"
|
||||
"queryorchestration/internal/query"
|
||||
|
||||
"github.com/go-playground/validator/v10"
|
||||
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
type QueryController struct {
|
||||
spec.UnimplementedQueryServiceServer
|
||||
query query.Service
|
||||
validator *validator.Validate
|
||||
}
|
||||
|
||||
func NewQueryController(querySvc query.Service, validator *validator.Validate) *QueryController {
|
||||
return &QueryController{
|
||||
query: querySvc,
|
||||
validator: validator,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *QueryController) List(ctx context.Context, req *spec.QueryFilter) (*spec.Queries, error) {
|
||||
return &spec.Queries{}, nil
|
||||
}
|
||||
|
||||
func (s *QueryController) Get(ctx context.Context, req *spec.IdMessage) (*spec.Query, error) {
|
||||
return &spec.Query{}, nil
|
||||
}
|
||||
|
||||
func (s *QueryController) Create(ctx context.Context, req *spec.QueryCreate) (*spec.IdMessage, error) {
|
||||
return &spec.IdMessage{}, nil
|
||||
}
|
||||
|
||||
func (s *QueryController) Update(ctx context.Context, req *spec.QueryUpdate) (*emptypb.Empty, error) {
|
||||
return &emptypb.Empty{}, nil
|
||||
}
|
||||
|
||||
func (s *QueryController) Remove(ctx context.Context, req *spec.IdMessage) (*emptypb.Empty, error) {
|
||||
return &emptypb.Empty{}, nil
|
||||
}
|
||||
|
||||
func (s *QueryController) Test(ctx context.Context, req *spec.QueryTestRequest) (*spec.QueryTestResponse, error) {
|
||||
return &spec.QueryTestResponse{}, nil
|
||||
}
|
||||
@@ -1,628 +0,0 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.0
|
||||
// protoc v3.12.4
|
||||
// source: main.proto
|
||||
|
||||
package spec
|
||||
|
||||
import (
|
||||
empty "github.com/golang/protobuf/ptypes/empty"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type QueryTestRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *QueryTestRequest) Reset() {
|
||||
*x = QueryTestRequest{}
|
||||
mi := &file_main_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *QueryTestRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*QueryTestRequest) ProtoMessage() {}
|
||||
|
||||
func (x *QueryTestRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_main_proto_msgTypes[0]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use QueryTestRequest.ProtoReflect.Descriptor instead.
|
||||
func (*QueryTestRequest) Descriptor() ([]byte, []int) {
|
||||
return file_main_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
type QueryTestResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *QueryTestResponse) Reset() {
|
||||
*x = QueryTestResponse{}
|
||||
mi := &file_main_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *QueryTestResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*QueryTestResponse) ProtoMessage() {}
|
||||
|
||||
func (x *QueryTestResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_main_proto_msgTypes[1]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use QueryTestResponse.ProtoReflect.Descriptor instead.
|
||||
func (*QueryTestResponse) Descriptor() ([]byte, []int) {
|
||||
return file_main_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
type Query struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *Query) Reset() {
|
||||
*x = Query{}
|
||||
mi := &file_main_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *Query) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Query) ProtoMessage() {}
|
||||
|
||||
func (x *Query) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_main_proto_msgTypes[2]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Query.ProtoReflect.Descriptor instead.
|
||||
func (*Query) Descriptor() ([]byte, []int) {
|
||||
return file_main_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
type QueryFilter struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *QueryFilter) Reset() {
|
||||
*x = QueryFilter{}
|
||||
mi := &file_main_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *QueryFilter) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*QueryFilter) ProtoMessage() {}
|
||||
|
||||
func (x *QueryFilter) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_main_proto_msgTypes[3]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use QueryFilter.ProtoReflect.Descriptor instead.
|
||||
func (*QueryFilter) Descriptor() ([]byte, []int) {
|
||||
return file_main_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
type QueryCreate struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *QueryCreate) Reset() {
|
||||
*x = QueryCreate{}
|
||||
mi := &file_main_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *QueryCreate) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*QueryCreate) ProtoMessage() {}
|
||||
|
||||
func (x *QueryCreate) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_main_proto_msgTypes[4]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use QueryCreate.ProtoReflect.Descriptor instead.
|
||||
func (*QueryCreate) Descriptor() ([]byte, []int) {
|
||||
return file_main_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
type QueryUpdate struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *QueryUpdate) Reset() {
|
||||
*x = QueryUpdate{}
|
||||
mi := &file_main_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *QueryUpdate) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*QueryUpdate) ProtoMessage() {}
|
||||
|
||||
func (x *QueryUpdate) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_main_proto_msgTypes[5]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use QueryUpdate.ProtoReflect.Descriptor instead.
|
||||
func (*QueryUpdate) Descriptor() ([]byte, []int) {
|
||||
return file_main_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
type Queries struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Queries []*Query `protobuf:"bytes,1,rep,name=queries,proto3" json:"queries,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *Queries) Reset() {
|
||||
*x = Queries{}
|
||||
mi := &file_main_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *Queries) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Queries) ProtoMessage() {}
|
||||
|
||||
func (x *Queries) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_main_proto_msgTypes[6]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Queries.ProtoReflect.Descriptor instead.
|
||||
func (*Queries) Descriptor() ([]byte, []int) {
|
||||
return file_main_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *Queries) GetQueries() []*Query {
|
||||
if x != nil {
|
||||
return x.Queries
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type JobCollector struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *JobCollector) Reset() {
|
||||
*x = JobCollector{}
|
||||
mi := &file_main_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *JobCollector) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*JobCollector) ProtoMessage() {}
|
||||
|
||||
func (x *JobCollector) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_main_proto_msgTypes[7]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use JobCollector.ProtoReflect.Descriptor instead.
|
||||
func (*JobCollector) Descriptor() ([]byte, []int) {
|
||||
return file_main_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
type JobCollectorCreate struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *JobCollectorCreate) Reset() {
|
||||
*x = JobCollectorCreate{}
|
||||
mi := &file_main_proto_msgTypes[8]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *JobCollectorCreate) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*JobCollectorCreate) ProtoMessage() {}
|
||||
|
||||
func (x *JobCollectorCreate) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_main_proto_msgTypes[8]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use JobCollectorCreate.ProtoReflect.Descriptor instead.
|
||||
func (*JobCollectorCreate) Descriptor() ([]byte, []int) {
|
||||
return file_main_proto_rawDescGZIP(), []int{8}
|
||||
}
|
||||
|
||||
type JobCollectorUpdate struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *JobCollectorUpdate) Reset() {
|
||||
*x = JobCollectorUpdate{}
|
||||
mi := &file_main_proto_msgTypes[9]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *JobCollectorUpdate) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*JobCollectorUpdate) ProtoMessage() {}
|
||||
|
||||
func (x *JobCollectorUpdate) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_main_proto_msgTypes[9]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use JobCollectorUpdate.ProtoReflect.Descriptor instead.
|
||||
func (*JobCollectorUpdate) Descriptor() ([]byte, []int) {
|
||||
return file_main_proto_rawDescGZIP(), []int{9}
|
||||
}
|
||||
|
||||
type ExportTrigger struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ExportTrigger) Reset() {
|
||||
*x = ExportTrigger{}
|
||||
mi := &file_main_proto_msgTypes[10]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ExportTrigger) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ExportTrigger) ProtoMessage() {}
|
||||
|
||||
func (x *ExportTrigger) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_main_proto_msgTypes[10]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ExportTrigger.ProtoReflect.Descriptor instead.
|
||||
func (*ExportTrigger) Descriptor() ([]byte, []int) {
|
||||
return file_main_proto_rawDescGZIP(), []int{10}
|
||||
}
|
||||
|
||||
type IdMessage struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *IdMessage) Reset() {
|
||||
*x = IdMessage{}
|
||||
mi := &file_main_proto_msgTypes[11]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *IdMessage) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*IdMessage) ProtoMessage() {}
|
||||
|
||||
func (x *IdMessage) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_main_proto_msgTypes[11]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use IdMessage.ProtoReflect.Descriptor instead.
|
||||
func (*IdMessage) Descriptor() ([]byte, []int) {
|
||||
return file_main_proto_rawDescGZIP(), []int{11}
|
||||
}
|
||||
|
||||
func (x *IdMessage) GetId() string {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_main_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_main_proto_rawDesc = []byte{
|
||||
0x0a, 0x0a, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x71, 0x75,
|
||||
0x65, 0x72, 0x79, 0x6f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
|
||||
0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x12, 0x0a,
|
||||
0x10, 0x51, 0x75, 0x65, 0x72, 0x79, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x22, 0x13, 0x0a, 0x11, 0x51, 0x75, 0x65, 0x72, 0x79, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x07, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x22,
|
||||
0x0d, 0x0a, 0x0b, 0x51, 0x75, 0x65, 0x72, 0x79, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x22, 0x0d,
|
||||
0x0a, 0x0b, 0x51, 0x75, 0x65, 0x72, 0x79, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x22, 0x0d, 0x0a,
|
||||
0x0b, 0x51, 0x75, 0x65, 0x72, 0x79, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x22, 0x3e, 0x0a, 0x07,
|
||||
0x51, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x12, 0x33, 0x0a, 0x07, 0x71, 0x75, 0x65, 0x72, 0x69,
|
||||
0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79,
|
||||
0x6f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x51, 0x75,
|
||||
0x65, 0x72, 0x79, 0x52, 0x07, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x22, 0x0e, 0x0a, 0x0c,
|
||||
0x4a, 0x6f, 0x62, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x22, 0x14, 0x0a, 0x12,
|
||||
0x4a, 0x6f, 0x62, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x43, 0x72, 0x65, 0x61,
|
||||
0x74, 0x65, 0x22, 0x14, 0x0a, 0x12, 0x4a, 0x6f, 0x62, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74,
|
||||
0x6f, 0x72, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x22, 0x0f, 0x0a, 0x0d, 0x45, 0x78, 0x70, 0x6f,
|
||||
0x72, 0x74, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x22, 0x1b, 0x0a, 0x09, 0x49, 0x64, 0x4d,
|
||||
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x32, 0xb8, 0x03, 0x0a, 0x0c, 0x51, 0x75, 0x65, 0x72, 0x79,
|
||||
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x44, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x12,
|
||||
0x1f, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x6f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, 0x61,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72,
|
||||
0x1a, 0x1b, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x6f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72,
|
||||
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x12, 0x3f, 0x0a,
|
||||
0x03, 0x47, 0x65, 0x74, 0x12, 0x1d, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x6f, 0x72, 0x63, 0x68,
|
||||
0x65, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x49, 0x64, 0x4d, 0x65, 0x73, 0x73,
|
||||
0x61, 0x67, 0x65, 0x1a, 0x19, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x6f, 0x72, 0x63, 0x68, 0x65,
|
||||
0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x48,
|
||||
0x0a, 0x06, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x1f, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79,
|
||||
0x6f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x51, 0x75,
|
||||
0x65, 0x72, 0x79, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x1a, 0x1d, 0x2e, 0x71, 0x75, 0x65, 0x72,
|
||||
0x79, 0x6f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x49,
|
||||
0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x41, 0x0a, 0x06, 0x55, 0x70, 0x64, 0x61,
|
||||
0x74, 0x65, 0x12, 0x1f, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x6f, 0x72, 0x63, 0x68, 0x65, 0x73,
|
||||
0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x55, 0x70, 0x64,
|
||||
0x61, 0x74, 0x65, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x3f, 0x0a, 0x06, 0x52,
|
||||
0x65, 0x6d, 0x6f, 0x76, 0x65, 0x12, 0x1d, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x6f, 0x72, 0x63,
|
||||
0x68, 0x65, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x49, 0x64, 0x4d, 0x65, 0x73,
|
||||
0x73, 0x61, 0x67, 0x65, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x53, 0x0a, 0x04,
|
||||
0x54, 0x65, 0x73, 0x74, 0x12, 0x24, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x6f, 0x72, 0x63, 0x68,
|
||||
0x65, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x54,
|
||||
0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x71, 0x75, 0x65,
|
||||
0x72, 0x79, 0x6f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e,
|
||||
0x51, 0x75, 0x65, 0x72, 0x79, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x32, 0xf8, 0x01, 0x0a, 0x13, 0x4a, 0x6f, 0x62, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74,
|
||||
0x6f, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x4f, 0x0a, 0x06, 0x43, 0x72, 0x65,
|
||||
0x61, 0x74, 0x65, 0x12, 0x26, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x6f, 0x72, 0x63, 0x68, 0x65,
|
||||
0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4a, 0x6f, 0x62, 0x43, 0x6f, 0x6c, 0x6c,
|
||||
0x65, 0x63, 0x74, 0x6f, 0x72, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x1a, 0x1d, 0x2e, 0x71, 0x75,
|
||||
0x65, 0x72, 0x79, 0x6f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x2e, 0x49, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x48, 0x0a, 0x06, 0x55, 0x70,
|
||||
0x64, 0x61, 0x74, 0x65, 0x12, 0x26, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x6f, 0x72, 0x63, 0x68,
|
||||
0x65, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4a, 0x6f, 0x62, 0x43, 0x6f, 0x6c,
|
||||
0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x1a, 0x16, 0x2e, 0x67,
|
||||
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45,
|
||||
0x6d, 0x70, 0x74, 0x79, 0x12, 0x46, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x1d, 0x2e, 0x71, 0x75,
|
||||
0x65, 0x72, 0x79, 0x6f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x2e, 0x49, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x20, 0x2e, 0x71, 0x75, 0x65,
|
||||
0x72, 0x79, 0x6f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e,
|
||||
0x4a, 0x6f, 0x62, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x32, 0x5c, 0x0a, 0x0d,
|
||||
0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x4b, 0x0a,
|
||||
0x07, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x12, 0x21, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79,
|
||||
0x6f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x45, 0x78,
|
||||
0x70, 0x6f, 0x72, 0x74, 0x54, 0x72, 0x69, 0x67, 0x67, 0x65, 0x72, 0x1a, 0x1d, 0x2e, 0x71, 0x75,
|
||||
0x65, 0x72, 0x79, 0x6f, 0x72, 0x63, 0x68, 0x65, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x2e, 0x49, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x2f,
|
||||
0x73, 0x70, 0x65, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_main_proto_rawDescOnce sync.Once
|
||||
file_main_proto_rawDescData = file_main_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_main_proto_rawDescGZIP() []byte {
|
||||
file_main_proto_rawDescOnce.Do(func() {
|
||||
file_main_proto_rawDescData = protoimpl.X.CompressGZIP(file_main_proto_rawDescData)
|
||||
})
|
||||
return file_main_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_main_proto_msgTypes = make([]protoimpl.MessageInfo, 12)
|
||||
var file_main_proto_goTypes = []any{
|
||||
(*QueryTestRequest)(nil), // 0: queryorchestration.QueryTestRequest
|
||||
(*QueryTestResponse)(nil), // 1: queryorchestration.QueryTestResponse
|
||||
(*Query)(nil), // 2: queryorchestration.Query
|
||||
(*QueryFilter)(nil), // 3: queryorchestration.QueryFilter
|
||||
(*QueryCreate)(nil), // 4: queryorchestration.QueryCreate
|
||||
(*QueryUpdate)(nil), // 5: queryorchestration.QueryUpdate
|
||||
(*Queries)(nil), // 6: queryorchestration.Queries
|
||||
(*JobCollector)(nil), // 7: queryorchestration.JobCollector
|
||||
(*JobCollectorCreate)(nil), // 8: queryorchestration.JobCollectorCreate
|
||||
(*JobCollectorUpdate)(nil), // 9: queryorchestration.JobCollectorUpdate
|
||||
(*ExportTrigger)(nil), // 10: queryorchestration.ExportTrigger
|
||||
(*IdMessage)(nil), // 11: queryorchestration.IdMessage
|
||||
(*empty.Empty)(nil), // 12: google.protobuf.Empty
|
||||
}
|
||||
var file_main_proto_depIdxs = []int32{
|
||||
2, // 0: queryorchestration.Queries.queries:type_name -> queryorchestration.Query
|
||||
3, // 1: queryorchestration.QueryService.List:input_type -> queryorchestration.QueryFilter
|
||||
11, // 2: queryorchestration.QueryService.Get:input_type -> queryorchestration.IdMessage
|
||||
4, // 3: queryorchestration.QueryService.Create:input_type -> queryorchestration.QueryCreate
|
||||
5, // 4: queryorchestration.QueryService.Update:input_type -> queryorchestration.QueryUpdate
|
||||
11, // 5: queryorchestration.QueryService.Remove:input_type -> queryorchestration.IdMessage
|
||||
0, // 6: queryorchestration.QueryService.Test:input_type -> queryorchestration.QueryTestRequest
|
||||
8, // 7: queryorchestration.JobCollectorService.Create:input_type -> queryorchestration.JobCollectorCreate
|
||||
9, // 8: queryorchestration.JobCollectorService.Update:input_type -> queryorchestration.JobCollectorUpdate
|
||||
11, // 9: queryorchestration.JobCollectorService.Get:input_type -> queryorchestration.IdMessage
|
||||
10, // 10: queryorchestration.ExportService.Trigger:input_type -> queryorchestration.ExportTrigger
|
||||
6, // 11: queryorchestration.QueryService.List:output_type -> queryorchestration.Queries
|
||||
2, // 12: queryorchestration.QueryService.Get:output_type -> queryorchestration.Query
|
||||
11, // 13: queryorchestration.QueryService.Create:output_type -> queryorchestration.IdMessage
|
||||
12, // 14: queryorchestration.QueryService.Update:output_type -> google.protobuf.Empty
|
||||
12, // 15: queryorchestration.QueryService.Remove:output_type -> google.protobuf.Empty
|
||||
1, // 16: queryorchestration.QueryService.Test:output_type -> queryorchestration.QueryTestResponse
|
||||
11, // 17: queryorchestration.JobCollectorService.Create:output_type -> queryorchestration.IdMessage
|
||||
12, // 18: queryorchestration.JobCollectorService.Update:output_type -> google.protobuf.Empty
|
||||
7, // 19: queryorchestration.JobCollectorService.Get:output_type -> queryorchestration.JobCollector
|
||||
11, // 20: queryorchestration.ExportService.Trigger:output_type -> queryorchestration.IdMessage
|
||||
11, // [11:21] is the sub-list for method output_type
|
||||
1, // [1:11] is the sub-list for method input_type
|
||||
1, // [1:1] is the sub-list for extension type_name
|
||||
1, // [1:1] is the sub-list for extension extendee
|
||||
0, // [0:1] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_main_proto_init() }
|
||||
func file_main_proto_init() {
|
||||
if File_main_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_main_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 12,
|
||||
NumExtensions: 0,
|
||||
NumServices: 3,
|
||||
},
|
||||
GoTypes: file_main_proto_goTypes,
|
||||
DependencyIndexes: file_main_proto_depIdxs,
|
||||
MessageInfos: file_main_proto_msgTypes,
|
||||
}.Build()
|
||||
File_main_proto = out.File
|
||||
file_main_proto_rawDesc = nil
|
||||
file_main_proto_goTypes = nil
|
||||
file_main_proto_depIdxs = nil
|
||||
}
|
||||
@@ -1,592 +0,0 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.5.1
|
||||
// - protoc v3.12.4
|
||||
// source: main.proto
|
||||
|
||||
package spec
|
||||
|
||||
import (
|
||||
context "context"
|
||||
empty "github.com/golang/protobuf/ptypes/empty"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.64.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion9
|
||||
|
||||
const (
|
||||
QueryService_List_FullMethodName = "/queryorchestration.QueryService/List"
|
||||
QueryService_Get_FullMethodName = "/queryorchestration.QueryService/Get"
|
||||
QueryService_Create_FullMethodName = "/queryorchestration.QueryService/Create"
|
||||
QueryService_Update_FullMethodName = "/queryorchestration.QueryService/Update"
|
||||
QueryService_Remove_FullMethodName = "/queryorchestration.QueryService/Remove"
|
||||
QueryService_Test_FullMethodName = "/queryorchestration.QueryService/Test"
|
||||
)
|
||||
|
||||
// QueryServiceClient is the client API for QueryService service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type QueryServiceClient interface {
|
||||
List(ctx context.Context, in *QueryFilter, opts ...grpc.CallOption) (*Queries, error)
|
||||
Get(ctx context.Context, in *IdMessage, opts ...grpc.CallOption) (*Query, error)
|
||||
Create(ctx context.Context, in *QueryCreate, opts ...grpc.CallOption) (*IdMessage, error)
|
||||
Update(ctx context.Context, in *QueryUpdate, opts ...grpc.CallOption) (*empty.Empty, error)
|
||||
Remove(ctx context.Context, in *IdMessage, opts ...grpc.CallOption) (*empty.Empty, error)
|
||||
Test(ctx context.Context, in *QueryTestRequest, opts ...grpc.CallOption) (*QueryTestResponse, error)
|
||||
}
|
||||
|
||||
type queryServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewQueryServiceClient(cc grpc.ClientConnInterface) QueryServiceClient {
|
||||
return &queryServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *queryServiceClient) List(ctx context.Context, in *QueryFilter, opts ...grpc.CallOption) (*Queries, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(Queries)
|
||||
err := c.cc.Invoke(ctx, QueryService_List_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryServiceClient) Get(ctx context.Context, in *IdMessage, opts ...grpc.CallOption) (*Query, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(Query)
|
||||
err := c.cc.Invoke(ctx, QueryService_Get_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryServiceClient) Create(ctx context.Context, in *QueryCreate, opts ...grpc.CallOption) (*IdMessage, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(IdMessage)
|
||||
err := c.cc.Invoke(ctx, QueryService_Create_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryServiceClient) Update(ctx context.Context, in *QueryUpdate, opts ...grpc.CallOption) (*empty.Empty, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(empty.Empty)
|
||||
err := c.cc.Invoke(ctx, QueryService_Update_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryServiceClient) Remove(ctx context.Context, in *IdMessage, opts ...grpc.CallOption) (*empty.Empty, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(empty.Empty)
|
||||
err := c.cc.Invoke(ctx, QueryService_Remove_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryServiceClient) Test(ctx context.Context, in *QueryTestRequest, opts ...grpc.CallOption) (*QueryTestResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(QueryTestResponse)
|
||||
err := c.cc.Invoke(ctx, QueryService_Test_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// QueryServiceServer is the server API for QueryService service.
|
||||
// All implementations must embed UnimplementedQueryServiceServer
|
||||
// for forward compatibility.
|
||||
type QueryServiceServer interface {
|
||||
List(context.Context, *QueryFilter) (*Queries, error)
|
||||
Get(context.Context, *IdMessage) (*Query, error)
|
||||
Create(context.Context, *QueryCreate) (*IdMessage, error)
|
||||
Update(context.Context, *QueryUpdate) (*empty.Empty, error)
|
||||
Remove(context.Context, *IdMessage) (*empty.Empty, error)
|
||||
Test(context.Context, *QueryTestRequest) (*QueryTestResponse, error)
|
||||
mustEmbedUnimplementedQueryServiceServer()
|
||||
}
|
||||
|
||||
// UnimplementedQueryServiceServer must be embedded to have
|
||||
// forward compatible implementations.
|
||||
//
|
||||
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||||
// pointer dereference when methods are called.
|
||||
type UnimplementedQueryServiceServer struct{}
|
||||
|
||||
func (UnimplementedQueryServiceServer) List(context.Context, *QueryFilter) (*Queries, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method List not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServiceServer) Get(context.Context, *IdMessage) (*Query, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Get not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServiceServer) Create(context.Context, *QueryCreate) (*IdMessage, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Create not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServiceServer) Update(context.Context, *QueryUpdate) (*empty.Empty, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Update not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServiceServer) Remove(context.Context, *IdMessage) (*empty.Empty, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Remove not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServiceServer) Test(context.Context, *QueryTestRequest) (*QueryTestResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Test not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServiceServer) mustEmbedUnimplementedQueryServiceServer() {}
|
||||
func (UnimplementedQueryServiceServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafeQueryServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to QueryServiceServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeQueryServiceServer interface {
|
||||
mustEmbedUnimplementedQueryServiceServer()
|
||||
}
|
||||
|
||||
func RegisterQueryServiceServer(s grpc.ServiceRegistrar, srv QueryServiceServer) {
|
||||
// If the following call pancis, it indicates UnimplementedQueryServiceServer was
|
||||
// embedded by pointer and is nil. This will cause panics if an
|
||||
// unimplemented method is ever invoked, so we test this at initialization
|
||||
// time to prevent it from happening at runtime later due to I/O.
|
||||
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
||||
t.testEmbeddedByValue()
|
||||
}
|
||||
s.RegisterService(&QueryService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _QueryService_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryFilter)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QueryServiceServer).List(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: QueryService_List_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QueryServiceServer).List(ctx, req.(*QueryFilter))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _QueryService_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(IdMessage)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QueryServiceServer).Get(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: QueryService_Get_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QueryServiceServer).Get(ctx, req.(*IdMessage))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _QueryService_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryCreate)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QueryServiceServer).Create(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: QueryService_Create_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QueryServiceServer).Create(ctx, req.(*QueryCreate))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _QueryService_Update_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryUpdate)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QueryServiceServer).Update(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: QueryService_Update_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QueryServiceServer).Update(ctx, req.(*QueryUpdate))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _QueryService_Remove_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(IdMessage)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QueryServiceServer).Remove(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: QueryService_Remove_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QueryServiceServer).Remove(ctx, req.(*IdMessage))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _QueryService_Test_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryTestRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QueryServiceServer).Test(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: QueryService_Test_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QueryServiceServer).Test(ctx, req.(*QueryTestRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// QueryService_ServiceDesc is the grpc.ServiceDesc for QueryService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var QueryService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "queryorchestration.QueryService",
|
||||
HandlerType: (*QueryServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "List",
|
||||
Handler: _QueryService_List_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Get",
|
||||
Handler: _QueryService_Get_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Create",
|
||||
Handler: _QueryService_Create_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Update",
|
||||
Handler: _QueryService_Update_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Remove",
|
||||
Handler: _QueryService_Remove_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Test",
|
||||
Handler: _QueryService_Test_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "main.proto",
|
||||
}
|
||||
|
||||
const (
|
||||
JobCollectorService_Create_FullMethodName = "/queryorchestration.JobCollectorService/Create"
|
||||
JobCollectorService_Update_FullMethodName = "/queryorchestration.JobCollectorService/Update"
|
||||
JobCollectorService_Get_FullMethodName = "/queryorchestration.JobCollectorService/Get"
|
||||
)
|
||||
|
||||
// JobCollectorServiceClient is the client API for JobCollectorService service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type JobCollectorServiceClient interface {
|
||||
Create(ctx context.Context, in *JobCollectorCreate, opts ...grpc.CallOption) (*IdMessage, error)
|
||||
Update(ctx context.Context, in *JobCollectorUpdate, opts ...grpc.CallOption) (*empty.Empty, error)
|
||||
Get(ctx context.Context, in *IdMessage, opts ...grpc.CallOption) (*JobCollector, error)
|
||||
}
|
||||
|
||||
type jobCollectorServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewJobCollectorServiceClient(cc grpc.ClientConnInterface) JobCollectorServiceClient {
|
||||
return &jobCollectorServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *jobCollectorServiceClient) Create(ctx context.Context, in *JobCollectorCreate, opts ...grpc.CallOption) (*IdMessage, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(IdMessage)
|
||||
err := c.cc.Invoke(ctx, JobCollectorService_Create_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *jobCollectorServiceClient) Update(ctx context.Context, in *JobCollectorUpdate, opts ...grpc.CallOption) (*empty.Empty, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(empty.Empty)
|
||||
err := c.cc.Invoke(ctx, JobCollectorService_Update_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *jobCollectorServiceClient) Get(ctx context.Context, in *IdMessage, opts ...grpc.CallOption) (*JobCollector, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(JobCollector)
|
||||
err := c.cc.Invoke(ctx, JobCollectorService_Get_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// JobCollectorServiceServer is the server API for JobCollectorService service.
|
||||
// All implementations must embed UnimplementedJobCollectorServiceServer
|
||||
// for forward compatibility.
|
||||
type JobCollectorServiceServer interface {
|
||||
Create(context.Context, *JobCollectorCreate) (*IdMessage, error)
|
||||
Update(context.Context, *JobCollectorUpdate) (*empty.Empty, error)
|
||||
Get(context.Context, *IdMessage) (*JobCollector, error)
|
||||
mustEmbedUnimplementedJobCollectorServiceServer()
|
||||
}
|
||||
|
||||
// UnimplementedJobCollectorServiceServer must be embedded to have
|
||||
// forward compatible implementations.
|
||||
//
|
||||
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||||
// pointer dereference when methods are called.
|
||||
type UnimplementedJobCollectorServiceServer struct{}
|
||||
|
||||
func (UnimplementedJobCollectorServiceServer) Create(context.Context, *JobCollectorCreate) (*IdMessage, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Create not implemented")
|
||||
}
|
||||
func (UnimplementedJobCollectorServiceServer) Update(context.Context, *JobCollectorUpdate) (*empty.Empty, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Update not implemented")
|
||||
}
|
||||
func (UnimplementedJobCollectorServiceServer) Get(context.Context, *IdMessage) (*JobCollector, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Get not implemented")
|
||||
}
|
||||
func (UnimplementedJobCollectorServiceServer) mustEmbedUnimplementedJobCollectorServiceServer() {}
|
||||
func (UnimplementedJobCollectorServiceServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafeJobCollectorServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to JobCollectorServiceServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeJobCollectorServiceServer interface {
|
||||
mustEmbedUnimplementedJobCollectorServiceServer()
|
||||
}
|
||||
|
||||
func RegisterJobCollectorServiceServer(s grpc.ServiceRegistrar, srv JobCollectorServiceServer) {
|
||||
// If the following call pancis, it indicates UnimplementedJobCollectorServiceServer was
|
||||
// embedded by pointer and is nil. This will cause panics if an
|
||||
// unimplemented method is ever invoked, so we test this at initialization
|
||||
// time to prevent it from happening at runtime later due to I/O.
|
||||
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
||||
t.testEmbeddedByValue()
|
||||
}
|
||||
s.RegisterService(&JobCollectorService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _JobCollectorService_Create_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(JobCollectorCreate)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(JobCollectorServiceServer).Create(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: JobCollectorService_Create_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(JobCollectorServiceServer).Create(ctx, req.(*JobCollectorCreate))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _JobCollectorService_Update_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(JobCollectorUpdate)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(JobCollectorServiceServer).Update(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: JobCollectorService_Update_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(JobCollectorServiceServer).Update(ctx, req.(*JobCollectorUpdate))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _JobCollectorService_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(IdMessage)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(JobCollectorServiceServer).Get(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: JobCollectorService_Get_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(JobCollectorServiceServer).Get(ctx, req.(*IdMessage))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// JobCollectorService_ServiceDesc is the grpc.ServiceDesc for JobCollectorService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var JobCollectorService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "queryorchestration.JobCollectorService",
|
||||
HandlerType: (*JobCollectorServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "Create",
|
||||
Handler: _JobCollectorService_Create_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Update",
|
||||
Handler: _JobCollectorService_Update_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Get",
|
||||
Handler: _JobCollectorService_Get_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "main.proto",
|
||||
}
|
||||
|
||||
const (
|
||||
ExportService_Trigger_FullMethodName = "/queryorchestration.ExportService/Trigger"
|
||||
)
|
||||
|
||||
// ExportServiceClient is the client API for ExportService service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type ExportServiceClient interface {
|
||||
Trigger(ctx context.Context, in *ExportTrigger, opts ...grpc.CallOption) (*IdMessage, error)
|
||||
}
|
||||
|
||||
type exportServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewExportServiceClient(cc grpc.ClientConnInterface) ExportServiceClient {
|
||||
return &exportServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *exportServiceClient) Trigger(ctx context.Context, in *ExportTrigger, opts ...grpc.CallOption) (*IdMessage, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(IdMessage)
|
||||
err := c.cc.Invoke(ctx, ExportService_Trigger_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// ExportServiceServer is the server API for ExportService service.
|
||||
// All implementations must embed UnimplementedExportServiceServer
|
||||
// for forward compatibility.
|
||||
type ExportServiceServer interface {
|
||||
Trigger(context.Context, *ExportTrigger) (*IdMessage, error)
|
||||
mustEmbedUnimplementedExportServiceServer()
|
||||
}
|
||||
|
||||
// UnimplementedExportServiceServer must be embedded to have
|
||||
// forward compatible implementations.
|
||||
//
|
||||
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||||
// pointer dereference when methods are called.
|
||||
type UnimplementedExportServiceServer struct{}
|
||||
|
||||
func (UnimplementedExportServiceServer) Trigger(context.Context, *ExportTrigger) (*IdMessage, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Trigger not implemented")
|
||||
}
|
||||
func (UnimplementedExportServiceServer) mustEmbedUnimplementedExportServiceServer() {}
|
||||
func (UnimplementedExportServiceServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafeExportServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to ExportServiceServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeExportServiceServer interface {
|
||||
mustEmbedUnimplementedExportServiceServer()
|
||||
}
|
||||
|
||||
func RegisterExportServiceServer(s grpc.ServiceRegistrar, srv ExportServiceServer) {
|
||||
// If the following call pancis, it indicates UnimplementedExportServiceServer was
|
||||
// embedded by pointer and is nil. This will cause panics if an
|
||||
// unimplemented method is ever invoked, so we test this at initialization
|
||||
// time to prevent it from happening at runtime later due to I/O.
|
||||
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
||||
t.testEmbeddedByValue()
|
||||
}
|
||||
s.RegisterService(&ExportService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _ExportService_Trigger_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ExportTrigger)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ExportServiceServer).Trigger(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ExportService_Trigger_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ExportServiceServer).Trigger(ctx, req.(*ExportTrigger))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// ExportService_ServiceDesc is the grpc.ServiceDesc for ExportService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var ExportService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "queryorchestration.ExportService",
|
||||
HandlerType: (*ExportServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "Trigger",
|
||||
Handler: _ExportService_Trigger_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "main.proto",
|
||||
}
|
||||
@@ -26,13 +26,20 @@ RUN --mount=type=cache,target=/go/pkg/mod/ \
|
||||
# Placing it here allows the previous steps to be cached across architectures.
|
||||
ARG TARGETARCH
|
||||
|
||||
ARG TARGETCMD
|
||||
|
||||
RUN if [ -z "$TARGETCMD" ]; then \
|
||||
echo "Error: TARGETCMD is not set."; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
# Build the application.
|
||||
# Leverage a cache mount to /go/pkg/mod/ to speed up subsequent builds.
|
||||
# Leverage a bind mount to the current directory to avoid having to copy the
|
||||
# source code into the container.
|
||||
RUN --mount=type=cache,target=/go/pkg/mod/ \
|
||||
--mount=type=bind,target=. \
|
||||
CGO_ENABLED=0 GOARCH=$TARGETARCH go build -o /bin/server ./cmd/grpc/main.go
|
||||
CGO_ENABLED=0 GOARCH=$TARGETARCH go build -o /bin/server ./cmd/$TARGETCMD/main.go
|
||||
|
||||
################################################################################
|
||||
# Create a new stage for running the application that contains the minimal
|
||||
@@ -74,8 +81,5 @@ COPY database/migrations/ database/migrations/
|
||||
# Copy the executable from the "build" stage.
|
||||
COPY --from=build /bin/server /bin/
|
||||
|
||||
# Expose the port that the application listens on.
|
||||
EXPOSE 8080
|
||||
|
||||
# What the container should run when it is started.
|
||||
ENTRYPOINT [ "/bin/server" ]
|
||||
@@ -1,78 +0,0 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
# Comments are provided throughout this file to help you get started.
|
||||
# If you need more help, visit the Dockerfile reference guide at
|
||||
# https://docs.docker.com/go/dockerfile-reference/
|
||||
|
||||
# Want to help us make this template better? Share your feedback here: https://forms.gle/ybq9Krt8jtBL3iCk7
|
||||
|
||||
################################################################################
|
||||
# Create a stage for building the application.
|
||||
ARG GO_VERSION=1.23
|
||||
#FROM --platform=$BUILDPLATFORM golang:${GO_VERSION} AS build
|
||||
FROM golang:${GO_VERSION} AS build
|
||||
WORKDIR /src
|
||||
|
||||
# Download dependencies as a separate step to take advantage of Docker's caching.
|
||||
# Leverage a cache mount to /go/pkg/mod/ to speed up subsequent builds.
|
||||
# Leverage bind mounts to go.sum and go.mod to avoid having to copy them into
|
||||
# the container.
|
||||
RUN --mount=type=cache,target=/go/pkg/mod/ \
|
||||
--mount=type=bind,source=go.sum,target=go.sum \
|
||||
--mount=type=bind,source=go.mod,target=go.mod \
|
||||
go mod download -x
|
||||
|
||||
# This is the architecture you're building for, which is passed in by the builder.
|
||||
# Placing it here allows the previous steps to be cached across architectures.
|
||||
ARG TARGETARCH
|
||||
|
||||
# Build the application.
|
||||
# Leverage a cache mount to /go/pkg/mod/ to speed up subsequent builds.
|
||||
# Leverage a bind mount to the current directory to avoid having to copy the
|
||||
# source code into the container.
|
||||
RUN --mount=type=cache,target=/go/pkg/mod/ \
|
||||
--mount=type=bind,target=. \
|
||||
CGO_ENABLED=0 GOARCH=$TARGETARCH go build -o /bin/server ./cmd/queue/main.go
|
||||
|
||||
################################################################################
|
||||
# Create a new stage for running the application that contains the minimal
|
||||
# runtime dependencies for the application. This often uses a different base
|
||||
# image from the build stage where the necessary files are copied from the build
|
||||
# stage.
|
||||
#
|
||||
# The example below uses the alpine image as the foundation for running the app.
|
||||
# By specifying the "latest" tag, it will also use whatever happens to be the
|
||||
# most recent version of that image when you build your Dockerfile. If
|
||||
# reproducability is important, consider using a versioned tag
|
||||
# (e.g., alpine:3.17.2) or SHA (e.g., alpine@sha256:c41ab5c992deb4fe7e5da09f67a8804a46bd0592bfdf0b1847dde0e0889d2bff).
|
||||
FROM alpine:latest AS final
|
||||
|
||||
# Install any runtime dependencies that are needed to run your application.
|
||||
# Leverage a cache mount to /var/cache/apk/ to speed up subsequent builds.
|
||||
RUN --mount=type=cache,target=/var/cache/apk \
|
||||
apk --update add \
|
||||
ca-certificates \
|
||||
tzdata \
|
||||
&& \
|
||||
update-ca-certificates
|
||||
|
||||
# Create a non-privileged user that the app will run under.
|
||||
# See https://docs.docker.com/go/dockerfile-user-best-practices/
|
||||
ARG UID=10001
|
||||
RUN adduser \
|
||||
--disabled-password \
|
||||
--gecos "" \
|
||||
--home "/nonexistent" \
|
||||
--shell "/sbin/nologin" \
|
||||
--no-create-home \
|
||||
--uid "${UID}" \
|
||||
appuser
|
||||
USER appuser
|
||||
|
||||
COPY database/migrations/ database/migrations/
|
||||
|
||||
# Copy the executable from the "build" stage.
|
||||
COPY --from=build /bin/server /bin/
|
||||
|
||||
# What the container should run when it is started.
|
||||
ENTRYPOINT [ "/bin/server" ]
|
||||
@@ -5,8 +5,8 @@ import (
|
||||
"log"
|
||||
"net"
|
||||
"os"
|
||||
"queryorchestration/api/grpc/controllers"
|
||||
"queryorchestration/api/grpc/spec"
|
||||
"queryorchestration/api/controllers"
|
||||
serviceinterfaces "queryorchestration/api/serviceInterfaces"
|
||||
"queryorchestration/internal/collector"
|
||||
"queryorchestration/internal/database"
|
||||
"queryorchestration/internal/database/repository"
|
||||
@@ -42,9 +42,9 @@ func main() {
|
||||
valid := validator.New()
|
||||
|
||||
grpcServer := grpc.NewServer()
|
||||
spec.RegisterQueryServiceServer(grpcServer, controllers.NewQueryController(*query.New(db), valid))
|
||||
spec.RegisterExportServiceServer(grpcServer, controllers.NewExportController(*export.New(db), valid))
|
||||
spec.RegisterJobCollectorServiceServer(grpcServer, controllers.NewJobCollectorController(*collector.New(db), valid))
|
||||
serviceinterfaces.RegisterQueryServiceServer(grpcServer, controllers.NewQueryController(*query.New(db), valid))
|
||||
serviceinterfaces.RegisterExportServiceServer(grpcServer, controllers.NewExportController(*export.New(db), valid))
|
||||
serviceinterfaces.RegisterJobCollectorServiceServer(grpcServer, controllers.NewJobCollectorController(*collector.New(db), valid))
|
||||
|
||||
log.Printf("Listening on port %d", port)
|
||||
if err := grpcServer.Serve(lis); err != nil {
|
||||
+2
-15
@@ -26,21 +26,6 @@ tasks:
|
||||
deps:
|
||||
- db:generate
|
||||
- proto:generate
|
||||
dev:
|
||||
deps:
|
||||
- generate
|
||||
cmds:
|
||||
- go run {{.PROJECT_MAIN}}
|
||||
build:
|
||||
deps:
|
||||
- generate
|
||||
cmds:
|
||||
- go build -o {{.OUT_FILE}} {{.PROJECT_MAIN}}
|
||||
start:
|
||||
deps:
|
||||
- build
|
||||
cmds:
|
||||
- ./{{.OUT_FILE}}
|
||||
lint:
|
||||
cmds:
|
||||
- task code:lint
|
||||
@@ -49,9 +34,11 @@ tasks:
|
||||
- task docker:lint
|
||||
- task compose:lint
|
||||
- task shell:lint
|
||||
- task proto:lint
|
||||
lint:fix:
|
||||
cmds:
|
||||
- task code:lint:fix
|
||||
- task proto:lint:fix
|
||||
code:lint:
|
||||
cmds:
|
||||
- golangci-lint run
|
||||
|
||||
+4
-4
@@ -3,15 +3,15 @@
|
||||
version: '3'
|
||||
|
||||
vars:
|
||||
COMPOSE_FILE_WITH_CONTEXT: "{{.CONTEXT}}/{{.COMPOSE_FILE}}"
|
||||
COMPOSE_FILE: "{{.CONTEXT}}/deployments/compose.yaml"
|
||||
|
||||
tasks:
|
||||
build:
|
||||
cmds:
|
||||
- docker compose -f {{.COMPOSE_FILE_WITH_CONTEXT}} build
|
||||
- docker compose -f {{.COMPOSE_FILE}} build
|
||||
up:
|
||||
cmds:
|
||||
- docker compose -f {{.COMPOSE_FILE_WITH_CONTEXT}} up
|
||||
- docker compose -f {{.COMPOSE_FILE}} up
|
||||
lint:
|
||||
cmds:
|
||||
- docker compose -f {{.COMPOSE_FILE_WITH_CONTEXT}} config
|
||||
- docker compose -f {{.COMPOSE_FILE}} config
|
||||
+4
-5
@@ -3,14 +3,13 @@
|
||||
version: '3'
|
||||
|
||||
vars:
|
||||
DOCKERFILE_DIR_WITH_CONTEXT: "{{.CONTEXT}}/{{.DOCKERFILE_DIR}}"
|
||||
DOCKERFILE: "{{.CONTEXT}}/build/Dockerfile"
|
||||
|
||||
tasks:
|
||||
lint:
|
||||
cmds:
|
||||
- godolint {{.DOCKERFILE_DIR_WITH_CONTEXT}}/grpc/Dockerfile
|
||||
- godolint {{.DOCKERFILE_DIR_WITH_CONTEXT}}/queue/Dockerfile
|
||||
- godolint {{.DOCKERFILE}}
|
||||
build:
|
||||
cmds:
|
||||
- docker build -t {{.IMAGE_NAME}}_grpc -f {{.DOCKERFILE_DIR_WITH_CONTEXT}}/grpc/Dockerfile {{.CONTEXT}}
|
||||
- docker build -t {{.IMAGE_NAME}}_queue -f {{.DOCKERFILE_DIR_WITH_CONTEXT}}/queue/Dockerfile {{.CONTEXT}}
|
||||
- docker build --build-arg TARGETCMD=queryService -t {{.IMAGE_NAME}}_queryservice -f {{.DOCKERFILE}} {{.CONTEXT}}
|
||||
- docker build --build-arg TARGETCMD=queryRunner -t {{.IMAGE_NAME}}_queryrunner -f {{.DOCKERFILE}} {{.CONTEXT}}
|
||||
+11
-2
@@ -3,9 +3,18 @@
|
||||
version: '3'
|
||||
|
||||
vars:
|
||||
PROTO_DIR_WITH_CONTEXT: "{{.CONTEXT}}/{{.PROTOBUF_DIR}}"
|
||||
PROTO_DIR: "{{.CONTEXT}}/serviceInterfaces"
|
||||
API_DIR: "{{.CONTEXT}}/api"
|
||||
|
||||
tasks:
|
||||
lint:
|
||||
cmds:
|
||||
- protolint lint {{.PROTO_DIR}}
|
||||
lint:fix:
|
||||
cmds:
|
||||
- protolint lint -fix {{.PROTO_DIR}}
|
||||
generate:
|
||||
cmds:
|
||||
- protoc --proto_path={{.PROTO_DIR_WITH_CONTEXT}} --go_out={{.CONTEXT}}/{{.API_GRPC_DIR}}/spec --go-grpc_out={{.CONTEXT}}/{{.API_GRPC_DIR}} --go_opt=paths=source_relative main.proto
|
||||
- pwd
|
||||
- mkdir -p {{.API_DIR}}/serviceInterfaces
|
||||
- protoc --proto_path={{.PROTO_DIR}} --go_out={{.API_DIR}}/serviceInterfaces --go-grpc_out={{.API_DIR}} --go_opt=paths=source_relative --experimental_allow_proto3_optional main.proto
|
||||
+3
-3
@@ -8,20 +8,20 @@ includes:
|
||||
internal: true
|
||||
|
||||
vars:
|
||||
COVERAGE_FILE_WITH_CONTEXT: "{{.CONTEXT}}/{{.OUT_DIR}}/{{.COVERAGE_FILE}}"
|
||||
COVERAGE_FILE: "{{.CONTEXT}}/{{.OUT_DIR}}/coverage.out"
|
||||
|
||||
tasks:
|
||||
unit:
|
||||
cmds:
|
||||
- mkdir -p {{.CONTEXT}}/{{.OUT_DIR}}
|
||||
- go test {{.CONTEXT}}/test/unit/... -coverpkg={{.CONTEXT}}/internal/...,{{.CONTEXT}}/pkg/... -coverprofile={{.COVERAGE_FILE_WITH_CONTEXT}}
|
||||
- go test {{.CONTEXT}}/test/unit/... -coverpkg={{.CONTEXT}}/internal/...,{{.CONTEXT}}/pkg/... -coverprofile={{.COVERAGE_FILE}}
|
||||
unit:coverage:
|
||||
deps:
|
||||
- unit
|
||||
vars:
|
||||
TMP_FILE: "{{.CONTEXT}}/{{.OUT_DIR}}/coverage.tmp"
|
||||
cmds:
|
||||
- go tool cover -func={{.COVERAGE_FILE_WITH_CONTEXT}} > {{.TMP_FILE}}
|
||||
- go tool cover -func={{.COVERAGE_FILE}} > {{.TMP_FILE}}
|
||||
- cat {{.TMP_FILE}}
|
||||
- |
|
||||
COVERAGE=$(grep total: {{.TMP_FILE}} | awk '{print $3}' | sed 's/%//' | bc)
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package queryorchestration;
|
||||
|
||||
import "google/protobuf/empty.proto";
|
||||
|
||||
option go_package = "./serviceinterfaces";
|
||||
|
||||
service QueryService {
|
||||
rpc List(QueryFilter) returns (Queries);
|
||||
rpc Get(IdMessage) returns (Query);
|
||||
rpc Create(QueryCreate) returns (IdMessage);
|
||||
rpc Update(QueryUpdate) returns (google.protobuf.Empty);
|
||||
rpc Deprecate(IdMessage) returns (google.protobuf.Empty);
|
||||
rpc Test(QueryTestRequest) returns (QueryTestResponse);
|
||||
}
|
||||
|
||||
message QueryTestRequest {
|
||||
string query_id = 1;
|
||||
string document_id = 2;
|
||||
int32 query_version = 3;
|
||||
}
|
||||
|
||||
message QueryTestResponse {
|
||||
string value = 1;
|
||||
}
|
||||
|
||||
enum QueryType {
|
||||
QUERY_TYPE_UNSPECIFIED = 0;
|
||||
QUERY_TYPE_JSON_EXTRACTOR = 1;
|
||||
QUERY_TYPE_CONTEXT_FULL = 2;
|
||||
}
|
||||
|
||||
message Query {
|
||||
string id = 1;
|
||||
QueryType type = 2;
|
||||
int32 active_version = 3;
|
||||
int32 latest_version = 4;
|
||||
optional string config = 5;
|
||||
repeated string required_queries = 6;
|
||||
}
|
||||
|
||||
message QueryFilter {
|
||||
repeated QueryType types = 1;
|
||||
}
|
||||
|
||||
message QueryCreate {
|
||||
QueryType type = 1;
|
||||
optional string config = 2;
|
||||
repeated string required_queries = 3;
|
||||
}
|
||||
|
||||
message QueryUpdate {
|
||||
string id = 1;
|
||||
optional string config = 2;
|
||||
optional int32 active_version = 3;
|
||||
repeated string required_queries = 4;
|
||||
}
|
||||
|
||||
message Queries {
|
||||
repeated Query queries = 1;
|
||||
}
|
||||
|
||||
service JobCollectorService {
|
||||
rpc Create(JobCollectorCreate) returns (IdMessage);
|
||||
rpc Update(JobCollectorUpdate) returns (google.protobuf.Empty);
|
||||
rpc Get(IdMessage) returns (JobCollector);
|
||||
}
|
||||
|
||||
message JobCollector {
|
||||
}
|
||||
message JobCollectorCreate {
|
||||
}
|
||||
message JobCollectorUpdate {
|
||||
}
|
||||
|
||||
service ExportService {
|
||||
rpc Trigger(ExportTrigger) returns (IdMessage);
|
||||
}
|
||||
|
||||
message ExportTrigger {
|
||||
}
|
||||
|
||||
message IdMessage {
|
||||
string id = 1;
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package integration_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"github.com/docker/go-connections/nat"
|
||||
"github.com/testcontainers/testcontainers-go"
|
||||
"github.com/testcontainers/testcontainers-go/wait"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials/insecure"
|
||||
)
|
||||
|
||||
type apiContainerConfig struct {
|
||||
ServiceName string
|
||||
DB dbConfig
|
||||
Network *testcontainers.DockerNetwork
|
||||
}
|
||||
|
||||
func createAPIContainer(t *testing.T, ctx context.Context, config *apiContainerConfig) (*grpc.ClientConn, func()) {
|
||||
port, err := nat.NewPort("tcp", "8080")
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to create port: %v", err)
|
||||
}
|
||||
|
||||
req := testcontainers.ContainerRequest{
|
||||
Image: fmt.Sprintf("queryorchestration_%s:latest", config.ServiceName),
|
||||
Env: map[string]string{
|
||||
"DB_USER": config.DB.User,
|
||||
"DB_PASS": config.DB.Password,
|
||||
"DB_HOST": config.DB.Host,
|
||||
"DB_NAME": config.DB.Name,
|
||||
"DB_PORT": strconv.Itoa(config.DB.Port),
|
||||
},
|
||||
ExposedPorts: []string{port.Port()},
|
||||
WaitingFor: wait.ForListeningPort(port),
|
||||
Networks: []string{config.Network.Name},
|
||||
}
|
||||
|
||||
container, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{
|
||||
ContainerRequest: req,
|
||||
Started: true,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to start container: %v", err)
|
||||
}
|
||||
|
||||
host, err := container.Host(ctx)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to extract host: %v", err)
|
||||
}
|
||||
mappedPort, err := container.MappedPort(ctx, port)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to extract port: %v", err)
|
||||
}
|
||||
|
||||
conn, err := grpc.NewClient(
|
||||
fmt.Sprintf("%s:%s", host, mappedPort.Port()),
|
||||
grpc.WithTransportCredentials(insecure.NewCredentials()),
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to connect to gRPC server: %v", err)
|
||||
}
|
||||
|
||||
return conn, func() {
|
||||
container.Terminate(ctx)
|
||||
}
|
||||
}
|
||||
|
||||
func createAPIDependencies(t *testing.T, ctx context.Context, serviceName string) (*grpc.ClientConn, func()) {
|
||||
network := createNetwork(t, ctx)
|
||||
|
||||
dbconfig, dbContainer := createDB(t, ctx, network)
|
||||
|
||||
conn, containerCleanup := createAPIContainer(t, ctx, &apiContainerConfig{
|
||||
ServiceName: serviceName,
|
||||
DB: *dbconfig,
|
||||
Network: network,
|
||||
})
|
||||
|
||||
return conn, func() {
|
||||
testcontainers.CleanupNetwork(t, network)
|
||||
dbContainer.Terminate(ctx)
|
||||
containerCleanup()
|
||||
conn.Close()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package integration_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/docker/go-connections/nat"
|
||||
"github.com/testcontainers/testcontainers-go"
|
||||
"github.com/testcontainers/testcontainers-go/network"
|
||||
"github.com/testcontainers/testcontainers-go/wait"
|
||||
)
|
||||
|
||||
func createNetwork(t *testing.T, ctx context.Context) *testcontainers.DockerNetwork {
|
||||
network, err := network.New(ctx, network.WithDriver("bridge"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
return network
|
||||
}
|
||||
|
||||
type dbConfig struct {
|
||||
Name string
|
||||
Host string
|
||||
Port int
|
||||
User string
|
||||
Password string
|
||||
}
|
||||
|
||||
func createDB(t *testing.T, ctx context.Context, network *testcontainers.DockerNetwork) (*dbConfig, testcontainers.Container) {
|
||||
alias := "postgres"
|
||||
port, err := nat.NewPort("tcp", "5432")
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to create port: %v", err)
|
||||
}
|
||||
|
||||
config := dbConfig{
|
||||
Name: "queryorchestration",
|
||||
Password: "pass",
|
||||
User: "postgres",
|
||||
Port: port.Int(),
|
||||
Host: alias,
|
||||
}
|
||||
|
||||
req := testcontainers.ContainerRequest{
|
||||
Image: "postgres:latest",
|
||||
Env: map[string]string{
|
||||
"POSTGRES_DB": config.Name,
|
||||
"POSTGRES_USER": config.User,
|
||||
"POSTGRES_PASSWORD": config.Password,
|
||||
},
|
||||
Networks: []string{network.Name},
|
||||
NetworkAliases: map[string][]string{
|
||||
network.Name: {alias},
|
||||
},
|
||||
ExposedPorts: []string{port.Port()},
|
||||
WaitingFor: wait.ForListeningPort(port),
|
||||
}
|
||||
|
||||
container, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{
|
||||
ContainerRequest: req,
|
||||
Started: true,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to start container: %v", err)
|
||||
}
|
||||
|
||||
return &config, container
|
||||
}
|
||||
@@ -1,146 +0,0 @@
|
||||
package grpc_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"github.com/docker/go-connections/nat"
|
||||
"github.com/testcontainers/testcontainers-go"
|
||||
"github.com/testcontainers/testcontainers-go/network"
|
||||
"github.com/testcontainers/testcontainers-go/wait"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials/insecure"
|
||||
)
|
||||
|
||||
type containerConfig struct {
|
||||
DB dbConfig
|
||||
Network *testcontainers.DockerNetwork
|
||||
}
|
||||
|
||||
func createContainer(t *testing.T, ctx context.Context, config *containerConfig) (*grpc.ClientConn, func()) {
|
||||
port, err := nat.NewPort("tcp", "8080")
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to create port: %v", err)
|
||||
}
|
||||
|
||||
req := testcontainers.ContainerRequest{
|
||||
Image: "queryorchestration_grpc:latest",
|
||||
Env: map[string]string{
|
||||
"DB_USER": config.DB.User,
|
||||
"DB_PASS": config.DB.Password,
|
||||
"DB_HOST": config.DB.Host,
|
||||
"DB_NAME": config.DB.Name,
|
||||
"DB_PORT": strconv.Itoa(config.DB.Port),
|
||||
},
|
||||
ExposedPorts: []string{port.Port()},
|
||||
WaitingFor: wait.ForListeningPort(port),
|
||||
Networks: []string{config.Network.Name},
|
||||
}
|
||||
|
||||
container, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{
|
||||
ContainerRequest: req,
|
||||
Started: true,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to start container: %v", err)
|
||||
}
|
||||
|
||||
host, err := container.Host(ctx)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to extract host: %v", err)
|
||||
}
|
||||
mappedPort, err := container.MappedPort(ctx, port)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to extract port: %v", err)
|
||||
}
|
||||
|
||||
conn, err := grpc.NewClient(
|
||||
fmt.Sprintf("%s:%s", host, mappedPort.Port()),
|
||||
grpc.WithTransportCredentials(insecure.NewCredentials()),
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to connect to gRPC server: %v", err)
|
||||
}
|
||||
|
||||
return conn, func() {
|
||||
container.Terminate(ctx)
|
||||
}
|
||||
}
|
||||
|
||||
type dbConfig struct {
|
||||
Name string
|
||||
Host string
|
||||
Port int
|
||||
User string
|
||||
Password string
|
||||
}
|
||||
|
||||
func createDB(t *testing.T, ctx context.Context, network *testcontainers.DockerNetwork) (*dbConfig, testcontainers.Container) {
|
||||
alias := "postgres"
|
||||
port, err := nat.NewPort("tcp", "5432")
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to create port: %v", err)
|
||||
}
|
||||
|
||||
config := dbConfig{
|
||||
Name: "queryorchestration",
|
||||
Password: "pass",
|
||||
User: "postgres",
|
||||
Port: port.Int(),
|
||||
Host: alias,
|
||||
}
|
||||
|
||||
req := testcontainers.ContainerRequest{
|
||||
Image: "postgres:latest",
|
||||
Env: map[string]string{
|
||||
"POSTGRES_DB": config.Name,
|
||||
"POSTGRES_USER": config.User,
|
||||
"POSTGRES_PASSWORD": config.Password,
|
||||
},
|
||||
Networks: []string{network.Name},
|
||||
NetworkAliases: map[string][]string{
|
||||
network.Name: {alias},
|
||||
},
|
||||
ExposedPorts: []string{port.Port()},
|
||||
WaitingFor: wait.ForListeningPort(port),
|
||||
}
|
||||
|
||||
container, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{
|
||||
ContainerRequest: req,
|
||||
Started: true,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to start container: %v", err)
|
||||
}
|
||||
|
||||
return &config, container
|
||||
}
|
||||
|
||||
func createNetwork(t *testing.T, ctx context.Context) *testcontainers.DockerNetwork {
|
||||
network, err := network.New(ctx, network.WithDriver("bridge"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
return network
|
||||
}
|
||||
|
||||
func createDependencies(t *testing.T, ctx context.Context) (*grpc.ClientConn, func()) {
|
||||
network := createNetwork(t, ctx)
|
||||
|
||||
dbconfig, dbContainer := createDB(t, ctx, network)
|
||||
|
||||
conn, containerCleanup := createContainer(t, ctx, &containerConfig{
|
||||
DB: *dbconfig,
|
||||
Network: network,
|
||||
})
|
||||
|
||||
return conn, func() {
|
||||
testcontainers.CleanupNetwork(t, network)
|
||||
dbContainer.Terminate(ctx)
|
||||
containerCleanup()
|
||||
conn.Close()
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package grpc_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"queryorchestration/api/grpc/spec"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestQuery(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
conn, cleanup := createDependencies(t, ctx)
|
||||
defer cleanup()
|
||||
|
||||
client := spec.NewQueryServiceClient(conn)
|
||||
|
||||
id := "sample_id"
|
||||
|
||||
_, err := client.Get(ctx, &spec.IdMessage{
|
||||
Id: id,
|
||||
})
|
||||
|
||||
assert.Nil(t, err)
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package queue_test
|
||||
package integration_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
func TestName(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
queue, cleanup := createDependencies(t, ctx)
|
||||
queue, cleanup := createQueueDependencies(t, ctx, "queryrunner")
|
||||
defer cleanup()
|
||||
|
||||
document := document.Document{
|
||||
@@ -0,0 +1,26 @@
|
||||
package integration_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
serviceinterfaces "queryorchestration/api/serviceInterfaces"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestQuery(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
conn, cleanup := createAPIDependencies(t, ctx, "queryservice")
|
||||
defer cleanup()
|
||||
|
||||
client := serviceinterfaces.NewQueryServiceClient(conn)
|
||||
|
||||
id := "sample_id"
|
||||
|
||||
_, err := client.Get(ctx, &serviceinterfaces.IdMessage{
|
||||
Id: id,
|
||||
})
|
||||
|
||||
assert.Nil(t, err)
|
||||
}
|
||||
+14
-71
@@ -1,4 +1,4 @@
|
||||
package queue_test
|
||||
package integration_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -15,24 +15,24 @@ import (
|
||||
"github.com/docker/go-connections/nat"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/testcontainers/testcontainers-go"
|
||||
"github.com/testcontainers/testcontainers-go/network"
|
||||
"github.com/testcontainers/testcontainers-go/wait"
|
||||
)
|
||||
|
||||
type containerConfig struct {
|
||||
Queue queueConfig
|
||||
DB *dbConfig
|
||||
Network *testcontainers.DockerNetwork
|
||||
type queueContainerConfig struct {
|
||||
ServiceName string
|
||||
Queue queueConfig
|
||||
DB *dbConfig
|
||||
Network *testcontainers.DockerNetwork
|
||||
}
|
||||
|
||||
func createContainer(t *testing.T, ctx context.Context, config containerConfig) testcontainers.Container {
|
||||
func createQueueContainer(t *testing.T, ctx context.Context, config *queueContainerConfig) testcontainers.Container {
|
||||
queueCredentials, err := config.Queue.Credentials.Retrieve(ctx)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
req := testcontainers.ContainerRequest{
|
||||
Image: "queryorchestration_queue:latest",
|
||||
Image: fmt.Sprintf("queryorchestration_%s:latest", config.ServiceName),
|
||||
Env: map[string]string{
|
||||
"QUEUE_URL": config.Queue.URL,
|
||||
"AWS_DEFAULT_REGION": config.Queue.Region,
|
||||
@@ -153,64 +153,6 @@ func createQueue(t *testing.T, ctx context.Context, network *testcontainers.Dock
|
||||
}
|
||||
}
|
||||
|
||||
func createNetwork(t *testing.T, ctx context.Context) *testcontainers.DockerNetwork {
|
||||
network, err := network.New(ctx, network.WithDriver("bridge"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
return network
|
||||
}
|
||||
|
||||
type dbConfig struct {
|
||||
Name string
|
||||
Host string
|
||||
Port int
|
||||
User string
|
||||
Password string
|
||||
}
|
||||
|
||||
func createDB(t *testing.T, ctx context.Context, network *testcontainers.DockerNetwork) (*dbConfig, testcontainers.Container) {
|
||||
alias := "postgres"
|
||||
port, err := nat.NewPort("tcp", "5432")
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to create port: %v", err)
|
||||
}
|
||||
|
||||
config := dbConfig{
|
||||
Name: "queryorchestration",
|
||||
Password: "pass",
|
||||
User: "postgres",
|
||||
Port: port.Int(),
|
||||
Host: alias,
|
||||
}
|
||||
|
||||
req := testcontainers.ContainerRequest{
|
||||
Image: "postgres:latest",
|
||||
Env: map[string]string{
|
||||
"POSTGRES_DB": config.Name,
|
||||
"POSTGRES_USER": config.User,
|
||||
"POSTGRES_PASSWORD": config.Password,
|
||||
},
|
||||
Networks: []string{network.Name},
|
||||
NetworkAliases: map[string][]string{
|
||||
network.Name: {alias},
|
||||
},
|
||||
ExposedPorts: []string{port.Port()},
|
||||
WaitingFor: wait.ForListeningPort(port),
|
||||
}
|
||||
|
||||
container, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{
|
||||
ContainerRequest: req,
|
||||
Started: true,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to start container: %v", err)
|
||||
}
|
||||
|
||||
return &config, container
|
||||
}
|
||||
|
||||
type message struct {
|
||||
URL string
|
||||
Type string
|
||||
@@ -252,17 +194,18 @@ func assertMessageWait(t *testing.T, ctx context.Context, queue *queue, msgType
|
||||
}
|
||||
}
|
||||
|
||||
func createDependencies(t *testing.T, ctx context.Context) (*queue, func()) {
|
||||
func createQueueDependencies(t *testing.T, ctx context.Context, serviceName string) (*queue, func()) {
|
||||
network := createNetwork(t, ctx)
|
||||
|
||||
dbconfig, dbContainer := createDB(t, ctx, network)
|
||||
|
||||
queue := createQueue(t, ctx, network)
|
||||
|
||||
container := createContainer(t, ctx, containerConfig{
|
||||
Queue: *queue.Config,
|
||||
DB: dbconfig,
|
||||
Network: network,
|
||||
container := createQueueContainer(t, ctx, &queueContainerConfig{
|
||||
ServiceName: serviceName,
|
||||
Queue: *queue.Config,
|
||||
DB: dbconfig,
|
||||
Network: network,
|
||||
})
|
||||
|
||||
return queue, func() {
|
||||
@@ -116,8 +116,11 @@ func TestQueue(t *testing.T) {
|
||||
pgxmock.NewRows([]string{"id", "config"}).
|
||||
AddRow(pgtype.UUID{}, []byte(fmt.Sprintf("{\"path\":\"%s\"}", keyLayerOne))),
|
||||
)
|
||||
db.ExpectExec("name: SetResult :exec").WithArgs(pgxmock.AnyArg(), database.MustToDBUUID(querySixID), database.MustToDBUUID(docID), valueLayerOne, cleanVersion, textVersion, querySixVersion).
|
||||
WillReturnResult(pgxmock.NewResult("", 1))
|
||||
db.ExpectQuery("name: SetResult :one").WithArgs(database.MustToDBUUID(querySixID), database.MustToDBUUID(docID), valueLayerOne, cleanVersion, textVersion, querySixVersion).
|
||||
WillReturnRows(
|
||||
pgxmock.NewRows([]string{"id"}).
|
||||
AddRow(pgtype.UUID{}),
|
||||
)
|
||||
|
||||
db.ExpectQuery("name: ListResultValuesByID :many").WithArgs(pgxmock.AnyArg()).WillReturnRows(
|
||||
pgxmock.NewRows([]string{"id", "queryId", "value"}).
|
||||
@@ -127,8 +130,11 @@ func TestQueue(t *testing.T) {
|
||||
pgxmock.NewRows([]string{"id", "config"}).
|
||||
AddRow(pgtype.UUID{}, []byte(fmt.Sprintf("{\"path\":\"%s\"}", keyLayerTwo))),
|
||||
)
|
||||
db.ExpectExec("name: SetResult :exec").WithArgs(pgxmock.AnyArg(), database.MustToDBUUID(queryFiveID), database.MustToDBUUID(docID), valueLayerTwo, cleanVersion, textVersion, queryFiveVersion).
|
||||
WillReturnResult(pgxmock.NewResult("", 1))
|
||||
db.ExpectQuery("name: SetResult :one").WithArgs(database.MustToDBUUID(queryFiveID), database.MustToDBUUID(docID), valueLayerTwo, cleanVersion, textVersion, queryFiveVersion).
|
||||
WillReturnRows(
|
||||
pgxmock.NewRows([]string{"id"}).
|
||||
AddRow(pgtype.UUID{}),
|
||||
)
|
||||
|
||||
db.ExpectQuery("name: ListResultValuesByID :many").WithArgs(pgxmock.AnyArg()).WillReturnRows(
|
||||
pgxmock.NewRows([]string{"id", "queryId", "value"}).
|
||||
@@ -138,8 +144,11 @@ func TestQueue(t *testing.T) {
|
||||
pgxmock.NewRows([]string{"id", "config"}).
|
||||
AddRow(pgtype.UUID{}, []byte(fmt.Sprintf("{\"path\":\"%s\"}", keyLayerOne))),
|
||||
)
|
||||
db.ExpectExec("name: SetResult :exec").WithArgs(pgxmock.AnyArg(), database.MustToDBUUID(queryOneID), database.MustToDBUUID(docID), valueLayerOne, cleanVersion, textVersion, queryOneVersion).
|
||||
WillReturnResult(pgxmock.NewResult("", 1))
|
||||
db.ExpectQuery("name: SetResult :one").WithArgs(database.MustToDBUUID(queryOneID), database.MustToDBUUID(docID), valueLayerOne, cleanVersion, textVersion, queryOneVersion).
|
||||
WillReturnRows(
|
||||
pgxmock.NewRows([]string{"id"}).
|
||||
AddRow(pgtype.UUID{}),
|
||||
)
|
||||
|
||||
db.ExpectQuery("name: ListResultValuesByID :many").WithArgs(pgxmock.AnyArg()).WillReturnRows(
|
||||
pgxmock.NewRows([]string{"id", "queryId", "value"}).
|
||||
@@ -149,8 +158,11 @@ func TestQueue(t *testing.T) {
|
||||
pgxmock.NewRows([]string{"id", "config"}).
|
||||
AddRow(pgtype.UUID{}, []byte(fmt.Sprintf("{\"path\":\"%s\"}", keyLayerTwo))),
|
||||
)
|
||||
db.ExpectExec("name: SetResult :exec").WithArgs(pgxmock.AnyArg(), database.MustToDBUUID(queryThreeID), database.MustToDBUUID(docID), valueLayerTwo, cleanVersion, textVersion, queryThreeVersion).
|
||||
WillReturnResult(pgxmock.NewResult("", 1))
|
||||
db.ExpectQuery("name: SetResult :one").WithArgs(database.MustToDBUUID(queryThreeID), database.MustToDBUUID(docID), valueLayerTwo, cleanVersion, textVersion, queryThreeVersion).
|
||||
WillReturnRows(
|
||||
pgxmock.NewRows([]string{"id"}).
|
||||
AddRow(pgtype.UUID{}),
|
||||
)
|
||||
|
||||
db.ExpectQuery("name: ListResultValuesByID :many").WithArgs(pgxmock.AnyArg()).WillReturnRows(
|
||||
pgxmock.NewRows([]string{"id", "queryId", "value"}).
|
||||
@@ -160,8 +172,11 @@ func TestQueue(t *testing.T) {
|
||||
pgxmock.NewRows([]string{"id", "config"}).
|
||||
AddRow(pgtype.UUID{}, []byte(fmt.Sprintf("{\"path\":\"%s\"}", keyLayerTwo))),
|
||||
)
|
||||
db.ExpectExec("name: SetResult :exec").WithArgs(pgxmock.AnyArg(), database.MustToDBUUID(queryTwoID), database.MustToDBUUID(docID), valueLayerTwo, cleanVersion, textVersion, queryTwoVersion).
|
||||
WillReturnResult(pgxmock.NewResult("", 1))
|
||||
db.ExpectQuery("name: SetResult :one").WithArgs(database.MustToDBUUID(queryTwoID), database.MustToDBUUID(docID), valueLayerTwo, cleanVersion, textVersion, queryTwoVersion).
|
||||
WillReturnRows(
|
||||
pgxmock.NewRows([]string{"id"}).
|
||||
AddRow(pgtype.UUID{}),
|
||||
)
|
||||
|
||||
err = q.Execute(ctx)
|
||||
assert.Nil(t, err)
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/jackc/pgx/v5/pgtype"
|
||||
"github.com/pashagolub/pgxmock/v3"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
@@ -32,15 +33,18 @@ func TestStore(t *testing.T) {
|
||||
QueryVersion: int32(1),
|
||||
}
|
||||
|
||||
db.ExpectExec("name: SetResult :exec").WithArgs(pgxmock.AnyArg(), database.MustToDBUUID(resultStore.QueryID), database.MustToDBUUID(resultStore.DocumentID), resultStore.Value, resultStore.CleanVersion, resultStore.TextVersion, resultStore.QueryVersion).
|
||||
WillReturnResult(pgxmock.NewResult("", 1))
|
||||
db.ExpectQuery("name: SetResult :one").WithArgs(database.MustToDBUUID(resultStore.QueryID), database.MustToDBUUID(resultStore.DocumentID), resultStore.Value, resultStore.CleanVersion, resultStore.TextVersion, resultStore.QueryVersion).
|
||||
WillReturnRows(
|
||||
pgxmock.NewRows([]string{"id"}).
|
||||
AddRow(pgtype.UUID{}),
|
||||
)
|
||||
|
||||
id, err := result.Store(ctx, queries, &resultStore)
|
||||
assert.Nil(t, err)
|
||||
assert.NotNil(t, id)
|
||||
|
||||
errr := "database failing"
|
||||
db.ExpectExec("name: SetResult :exec").WithArgs(pgxmock.AnyArg(), database.MustToDBUUID(resultStore.QueryID), database.MustToDBUUID(resultStore.DocumentID), resultStore.Value, resultStore.CleanVersion, resultStore.TextVersion, resultStore.QueryVersion).
|
||||
db.ExpectQuery("name: SetResult :one").WithArgs(database.MustToDBUUID(resultStore.QueryID), database.MustToDBUUID(resultStore.DocumentID), resultStore.Value, resultStore.CleanVersion, resultStore.TextVersion, resultStore.QueryVersion).
|
||||
WillReturnError(fmt.Errorf(errr))
|
||||
|
||||
id, err = result.Store(ctx, queries, &resultStore)
|
||||
|
||||
Reference in New Issue
Block a user