refactor(workflow): Move the variable component in the Workflow package into the common crossdomain package (#738)
This commit is contained in:
117
backend/domain/workflow/variable/variable.go
Normal file
117
backend/domain/workflow/variable/variable.go
Normal file
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Copyright 2025 coze-dev Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package variable
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/cloudwego/eino/compose"
|
||||
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/entity/vo"
|
||||
)
|
||||
|
||||
var variableHandlerSingleton *Handler
|
||||
|
||||
func GetVariableHandler() *Handler {
|
||||
return NewVariableHandler()
|
||||
}
|
||||
|
||||
type Handler struct {
|
||||
UserVarStore Store
|
||||
SystemVarStore Store
|
||||
AppVarStore Store
|
||||
}
|
||||
|
||||
func (v *Handler) Get(ctx context.Context, t vo.GlobalVarType, path compose.FieldPath, opts ...OptionFn) (any, error) {
|
||||
switch t {
|
||||
case vo.GlobalUser:
|
||||
return v.UserVarStore.Get(ctx, path, opts...)
|
||||
case vo.GlobalSystem:
|
||||
return v.SystemVarStore.Get(ctx, path, opts...)
|
||||
case vo.GlobalAPP:
|
||||
return v.AppVarStore.Get(ctx, path, opts...)
|
||||
default:
|
||||
return nil, fmt.Errorf("unknown variable type: %v", t)
|
||||
}
|
||||
}
|
||||
|
||||
func (v *Handler) Set(ctx context.Context, t vo.GlobalVarType, path compose.FieldPath, value any, opts ...OptionFn) error {
|
||||
switch t {
|
||||
case vo.GlobalUser:
|
||||
return v.UserVarStore.Set(ctx, path, value, opts...)
|
||||
case vo.GlobalSystem:
|
||||
return v.SystemVarStore.Set(ctx, path, value, opts...)
|
||||
case vo.GlobalAPP:
|
||||
return v.AppVarStore.Set(ctx, path, value, opts...)
|
||||
default:
|
||||
return fmt.Errorf("unknown variable type: %v", t)
|
||||
}
|
||||
}
|
||||
|
||||
func (v *Handler) Init(ctx context.Context) context.Context {
|
||||
if v.UserVarStore != nil {
|
||||
v.UserVarStore.Init(ctx)
|
||||
}
|
||||
|
||||
if v.SystemVarStore != nil {
|
||||
v.SystemVarStore.Init(ctx)
|
||||
}
|
||||
|
||||
if v.AppVarStore != nil {
|
||||
v.AppVarStore.Init(ctx)
|
||||
}
|
||||
|
||||
return ctx
|
||||
}
|
||||
|
||||
type StoreInfo struct {
|
||||
AppID *int64
|
||||
AgentID *int64
|
||||
ConnectorID int64
|
||||
ConnectorUID string
|
||||
}
|
||||
|
||||
type StoreConfig struct {
|
||||
StoreInfo StoreInfo
|
||||
}
|
||||
|
||||
type OptionFn func(*StoreConfig)
|
||||
|
||||
func WithStoreInfo(info StoreInfo) OptionFn {
|
||||
return func(option *StoreConfig) {
|
||||
option.StoreInfo = info
|
||||
}
|
||||
}
|
||||
|
||||
//go:generate mockgen -destination varmock/var_mock.go --package mockvar -source variable.go
|
||||
type Store interface {
|
||||
Init(ctx context.Context)
|
||||
Get(ctx context.Context, path compose.FieldPath, opts ...OptionFn) (any, error)
|
||||
Set(ctx context.Context, path compose.FieldPath, value any, opts ...OptionFn) error
|
||||
}
|
||||
|
||||
var variablesMetaGetterImpl VariablesMetaGetter
|
||||
|
||||
func GetVariablesMetaGetter() VariablesMetaGetter {
|
||||
return NewVariablesMetaGetter()
|
||||
}
|
||||
|
||||
type VariablesMetaGetter interface {
|
||||
GetAppVariablesMeta(ctx context.Context, id, version string) (m map[string]*vo.TypeInfo, err error)
|
||||
GetAgentVariablesMeta(ctx context.Context, id int64, version string) (m map[string]*vo.TypeInfo, err error)
|
||||
}
|
||||
389
backend/domain/workflow/variable/variable_impl.go
Normal file
389
backend/domain/workflow/variable/variable_impl.go
Normal file
@@ -0,0 +1,389 @@
|
||||
/*
|
||||
* Copyright 2025 coze-dev Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package variable
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
||||
"github.com/bytedance/sonic"
|
||||
"github.com/cloudwego/eino/compose"
|
||||
|
||||
variablesModel "github.com/coze-dev/coze-studio/backend/api/model/crossdomain/variables"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/data/variable/kvmemory"
|
||||
"github.com/coze-dev/coze-studio/backend/api/model/data/variable/project_memory"
|
||||
crossvariables "github.com/coze-dev/coze-studio/backend/crossdomain/contract/variables"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/memory/variables/entity"
|
||||
"github.com/coze-dev/coze-studio/backend/domain/workflow/entity/vo"
|
||||
"github.com/coze-dev/coze-studio/backend/pkg/lang/ternary"
|
||||
"github.com/coze-dev/coze-studio/backend/types/errno"
|
||||
)
|
||||
|
||||
type varStore struct {
|
||||
variableChannel project_memory.VariableChannel
|
||||
}
|
||||
|
||||
func NewVariableHandler() *Handler {
|
||||
return &Handler{
|
||||
UserVarStore: newUserVarStore(),
|
||||
AppVarStore: newAppVarStore(),
|
||||
SystemVarStore: newSystemVarStore(),
|
||||
}
|
||||
}
|
||||
|
||||
func newUserVarStore() Store {
|
||||
return &varStore{
|
||||
variableChannel: project_memory.VariableChannel_Custom,
|
||||
}
|
||||
}
|
||||
|
||||
func newAppVarStore() Store {
|
||||
return &varStore{
|
||||
variableChannel: project_memory.VariableChannel_APP,
|
||||
}
|
||||
}
|
||||
|
||||
func newSystemVarStore() Store {
|
||||
return &varStore{
|
||||
variableChannel: project_memory.VariableChannel_System,
|
||||
}
|
||||
}
|
||||
|
||||
func (v *varStore) Init(ctx context.Context) {
|
||||
}
|
||||
|
||||
func (v *varStore) Get(ctx context.Context, path compose.FieldPath, opts ...OptionFn) (any, error) {
|
||||
opt := &StoreConfig{}
|
||||
for _, o := range opts {
|
||||
o(opt)
|
||||
}
|
||||
|
||||
var (
|
||||
bizID string
|
||||
bizType project_memory.VariableConnector
|
||||
)
|
||||
|
||||
if opt.StoreInfo.AppID != nil {
|
||||
bizID = strconv.FormatInt(*opt.StoreInfo.AppID, 10)
|
||||
bizType = project_memory.VariableConnector_Project
|
||||
} else if opt.StoreInfo.AgentID != nil {
|
||||
bizID = strconv.FormatInt(*opt.StoreInfo.AgentID, 10)
|
||||
bizType = project_memory.VariableConnector_Bot
|
||||
} else {
|
||||
return nil, fmt.Errorf("there must be one of the App ID or Agent ID")
|
||||
}
|
||||
|
||||
meta := &variablesModel.UserVariableMeta{
|
||||
BizType: bizType,
|
||||
BizID: bizID,
|
||||
ConnectorID: opt.StoreInfo.ConnectorID,
|
||||
ConnectorUID: opt.StoreInfo.ConnectorUID,
|
||||
}
|
||||
if len(path) == 0 {
|
||||
return nil, errors.New("field path is required")
|
||||
}
|
||||
key := path[0]
|
||||
kvItems, err := crossvariables.DefaultSVC().GetVariableChannelInstance(ctx, meta, []string{key}, project_memory.VariableChannelPtr(v.variableChannel))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(kvItems) == 0 {
|
||||
return nil, fmt.Errorf("variable %s not exists", key)
|
||||
}
|
||||
|
||||
value := kvItems[0].GetValue()
|
||||
|
||||
schema := kvItems[0].GetSchema()
|
||||
|
||||
varSchema, err := entity.NewVariableMetaSchema([]byte(schema))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if varSchema.IsArrayType() {
|
||||
if value == "" {
|
||||
return nil, nil
|
||||
}
|
||||
result := make([]interface{}, 0)
|
||||
err = sonic.Unmarshal([]byte(value), &result)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
if varSchema.IsObjectType() {
|
||||
if value == "" {
|
||||
return nil, nil
|
||||
}
|
||||
result := make(map[string]any)
|
||||
err = sonic.Unmarshal([]byte(value), &result)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(path) > 1 {
|
||||
if val, ok := takeMapValue(result, path[1:]); ok {
|
||||
return val, nil
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
if varSchema.IsStringType() {
|
||||
return value, nil
|
||||
}
|
||||
|
||||
if varSchema.IsBooleanType() {
|
||||
if value == "" {
|
||||
return false, nil
|
||||
}
|
||||
result, err := strconv.ParseBool(value)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
if varSchema.IsNumberType() {
|
||||
if value == "" {
|
||||
return 0, nil
|
||||
}
|
||||
result, err := strconv.ParseFloat(value, 64)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
if varSchema.IsIntegerType() {
|
||||
if value == "" {
|
||||
return 0, nil
|
||||
}
|
||||
result, err := strconv.ParseInt(value, 64, 10)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
return value, nil
|
||||
}
|
||||
|
||||
func (v *varStore) Set(ctx context.Context, path compose.FieldPath, value any, opts ...OptionFn) (err error) {
|
||||
opt := &StoreConfig{}
|
||||
for _, o := range opts {
|
||||
o(opt)
|
||||
}
|
||||
|
||||
var (
|
||||
bizID string
|
||||
bizType project_memory.VariableConnector
|
||||
)
|
||||
|
||||
if opt.StoreInfo.AppID != nil {
|
||||
bizID = strconv.FormatInt(*opt.StoreInfo.AppID, 10)
|
||||
bizType = project_memory.VariableConnector_Project
|
||||
} else if opt.StoreInfo.AgentID != nil {
|
||||
bizID = strconv.FormatInt(*opt.StoreInfo.AgentID, 10)
|
||||
bizType = project_memory.VariableConnector_Bot
|
||||
} else {
|
||||
return fmt.Errorf("there must be one of the App ID or Agent ID")
|
||||
}
|
||||
|
||||
meta := &variablesModel.UserVariableMeta{
|
||||
BizType: bizType,
|
||||
BizID: bizID,
|
||||
ConnectorID: opt.StoreInfo.ConnectorID,
|
||||
ConnectorUID: opt.StoreInfo.ConnectorUID,
|
||||
}
|
||||
|
||||
if len(path) == 0 {
|
||||
return errors.New("field path is required")
|
||||
}
|
||||
|
||||
key := path[0]
|
||||
kvItems := make([]*kvmemory.KVItem, 0, 1)
|
||||
|
||||
valueString := ""
|
||||
if _, ok := value.(string); ok {
|
||||
valueString = value.(string)
|
||||
} else {
|
||||
valueString, err = sonic.MarshalString(value)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
isSystem := ternary.IFElse[bool](v.variableChannel == project_memory.VariableChannel_System, true, false)
|
||||
kvItems = append(kvItems, &kvmemory.KVItem{
|
||||
Keyword: key,
|
||||
Value: valueString,
|
||||
IsSystem: isSystem,
|
||||
})
|
||||
|
||||
_, err = crossvariables.DefaultSVC().SetVariableInstance(ctx, meta, kvItems)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type variablesMetaGetter struct {
|
||||
}
|
||||
|
||||
func NewVariablesMetaGetter() VariablesMetaGetter {
|
||||
return &variablesMetaGetter{}
|
||||
}
|
||||
|
||||
func (v variablesMetaGetter) GetAppVariablesMeta(ctx context.Context, id, version string) (m map[string]*vo.TypeInfo, err error) {
|
||||
var varMetas *entity.VariablesMeta
|
||||
varMetas, err = crossvariables.DefaultSVC().GetProjectVariablesMeta(ctx, id, version)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
m = make(map[string]*vo.TypeInfo, len(varMetas.Variables))
|
||||
for _, v := range varMetas.Variables {
|
||||
varSchema, err := v.GetSchema(ctx)
|
||||
if err != nil {
|
||||
return nil, vo.WrapIfNeeded(errno.ErrVariablesAPIFail, err)
|
||||
}
|
||||
|
||||
t, err := varMeta2TypeInfo(varSchema)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
m[v.Keyword] = t
|
||||
}
|
||||
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (v variablesMetaGetter) GetAgentVariablesMeta(ctx context.Context, id int64, version string) (m map[string]*vo.TypeInfo, err error) {
|
||||
var varMetas *entity.VariablesMeta
|
||||
varMetas, err = crossvariables.DefaultSVC().GetAgentVariableMeta(ctx, id, version)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
m = make(map[string]*vo.TypeInfo, len(varMetas.Variables))
|
||||
for _, v := range varMetas.Variables {
|
||||
varSchema, err := v.GetSchema(ctx)
|
||||
if err != nil {
|
||||
return nil, vo.WrapIfNeeded(errno.ErrVariablesAPIFail, err)
|
||||
}
|
||||
|
||||
t, err := varMeta2TypeInfo(varSchema)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
m[v.Keyword] = t
|
||||
}
|
||||
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func varMeta2TypeInfo(v *entity.VariableMetaSchema) (*vo.TypeInfo, error) {
|
||||
if v.IsBooleanType() {
|
||||
return &vo.TypeInfo{
|
||||
Type: vo.DataTypeBoolean,
|
||||
}, nil
|
||||
}
|
||||
if v.IsStringType() {
|
||||
return &vo.TypeInfo{
|
||||
Type: vo.DataTypeString,
|
||||
}, nil
|
||||
}
|
||||
if v.IsNumberType() {
|
||||
return &vo.TypeInfo{
|
||||
Type: vo.DataTypeNumber,
|
||||
}, nil
|
||||
}
|
||||
if v.IsIntegerType() {
|
||||
return &vo.TypeInfo{
|
||||
Type: vo.DataTypeInteger,
|
||||
}, nil
|
||||
}
|
||||
if v.IsArrayType() {
|
||||
if len(v.Schema) == 0 {
|
||||
return nil, vo.WrapError(errno.ErrVariablesAPIFail, fmt.Errorf("array type should contain element type info"))
|
||||
}
|
||||
|
||||
elemType, err := entity.NewVariableMetaSchema(v.Schema)
|
||||
if err != nil {
|
||||
return nil, vo.WrapIfNeeded(errno.ErrVariablesAPIFail, err)
|
||||
}
|
||||
|
||||
et, err := varMeta2TypeInfo(elemType)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &vo.TypeInfo{
|
||||
Type: vo.DataTypeArray,
|
||||
ElemTypeInfo: et,
|
||||
}, nil
|
||||
}
|
||||
if v.IsObjectType() {
|
||||
ps, err := v.GetObjectProperties(v.Schema)
|
||||
if err != nil {
|
||||
return nil, vo.WrapIfNeeded(errno.ErrVariablesAPIFail, err)
|
||||
}
|
||||
|
||||
properties := make(map[string]*vo.TypeInfo, len(ps))
|
||||
for k, p := range ps {
|
||||
pt, err := varMeta2TypeInfo(p)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
properties[k] = pt
|
||||
}
|
||||
|
||||
return &vo.TypeInfo{
|
||||
Type: vo.DataTypeObject,
|
||||
Properties: properties,
|
||||
}, nil
|
||||
}
|
||||
return nil, vo.WrapError(errno.ErrVariablesAPIFail, fmt.Errorf("invalid variable type"))
|
||||
}
|
||||
|
||||
func takeMapValue(m map[string]any, path []string) (any, bool) {
|
||||
if m == nil {
|
||||
return nil, false
|
||||
}
|
||||
|
||||
container := m
|
||||
for _, p := range path[:len(path)-1] {
|
||||
if _, ok := container[p]; !ok {
|
||||
return nil, false
|
||||
}
|
||||
container = container[p].(map[string]any)
|
||||
}
|
||||
|
||||
if v, ok := container[path[len(path)-1]]; ok {
|
||||
return v, true
|
||||
}
|
||||
|
||||
return nil, false
|
||||
}
|
||||
149
backend/domain/workflow/variable/varmock/var_mock.go
Normal file
149
backend/domain/workflow/variable/varmock/var_mock.go
Normal file
@@ -0,0 +1,149 @@
|
||||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: variable.go
|
||||
//
|
||||
// Generated by this command:
|
||||
//
|
||||
// mockgen -destination varmock/var_mock.go --package mockvar -source variable.go
|
||||
//
|
||||
|
||||
// Package mockvar is a generated GoMock package.
|
||||
package mockvar
|
||||
|
||||
import (
|
||||
context "context"
|
||||
reflect "reflect"
|
||||
|
||||
compose "github.com/cloudwego/eino/compose"
|
||||
vo "github.com/coze-dev/coze-studio/backend/domain/workflow/entity/vo"
|
||||
variable "github.com/coze-dev/coze-studio/backend/domain/workflow/variable"
|
||||
gomock "go.uber.org/mock/gomock"
|
||||
)
|
||||
|
||||
// MockStore is a mock of Store interface.
|
||||
type MockStore struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockStoreMockRecorder
|
||||
isgomock struct{}
|
||||
}
|
||||
|
||||
// MockStoreMockRecorder is the mock recorder for MockStore.
|
||||
type MockStoreMockRecorder struct {
|
||||
mock *MockStore
|
||||
}
|
||||
|
||||
// NewMockStore creates a new mock instance.
|
||||
func NewMockStore(ctrl *gomock.Controller) *MockStore {
|
||||
mock := &MockStore{ctrl: ctrl}
|
||||
mock.recorder = &MockStoreMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockStore) EXPECT() *MockStoreMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// Get mocks base method.
|
||||
func (m *MockStore) Get(ctx context.Context, path compose.FieldPath, opts ...variable.OptionFn) (any, error) {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []any{ctx, path}
|
||||
for _, a := range opts {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
ret := m.ctrl.Call(m, "Get", varargs...)
|
||||
ret0, _ := ret[0].(any)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// Get indicates an expected call of Get.
|
||||
func (mr *MockStoreMockRecorder) Get(ctx, path any, opts ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]any{ctx, path}, opts...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockStore)(nil).Get), varargs...)
|
||||
}
|
||||
|
||||
// Init mocks base method.
|
||||
func (m *MockStore) Init(ctx context.Context) {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "Init", ctx)
|
||||
}
|
||||
|
||||
// Init indicates an expected call of Init.
|
||||
func (mr *MockStoreMockRecorder) Init(ctx any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Init", reflect.TypeOf((*MockStore)(nil).Init), ctx)
|
||||
}
|
||||
|
||||
// Set mocks base method.
|
||||
func (m *MockStore) Set(ctx context.Context, path compose.FieldPath, value any, opts ...variable.OptionFn) error {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []any{ctx, path, value}
|
||||
for _, a := range opts {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
ret := m.ctrl.Call(m, "Set", varargs...)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// Set indicates an expected call of Set.
|
||||
func (mr *MockStoreMockRecorder) Set(ctx, path, value any, opts ...any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
varargs := append([]any{ctx, path, value}, opts...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Set", reflect.TypeOf((*MockStore)(nil).Set), varargs...)
|
||||
}
|
||||
|
||||
// MockVariablesMetaGetter is a mock of VariablesMetaGetter interface.
|
||||
type MockVariablesMetaGetter struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockVariablesMetaGetterMockRecorder
|
||||
isgomock struct{}
|
||||
}
|
||||
|
||||
// MockVariablesMetaGetterMockRecorder is the mock recorder for MockVariablesMetaGetter.
|
||||
type MockVariablesMetaGetterMockRecorder struct {
|
||||
mock *MockVariablesMetaGetter
|
||||
}
|
||||
|
||||
// NewMockVariablesMetaGetter creates a new mock instance.
|
||||
func NewMockVariablesMetaGetter(ctrl *gomock.Controller) *MockVariablesMetaGetter {
|
||||
mock := &MockVariablesMetaGetter{ctrl: ctrl}
|
||||
mock.recorder = &MockVariablesMetaGetterMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockVariablesMetaGetter) EXPECT() *MockVariablesMetaGetterMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// GetAgentVariablesMeta mocks base method.
|
||||
func (m *MockVariablesMetaGetter) GetAgentVariablesMeta(ctx context.Context, id int64, version string) (map[string]*vo.TypeInfo, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetAgentVariablesMeta", ctx, id, version)
|
||||
ret0, _ := ret[0].(map[string]*vo.TypeInfo)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetAgentVariablesMeta indicates an expected call of GetAgentVariablesMeta.
|
||||
func (mr *MockVariablesMetaGetterMockRecorder) GetAgentVariablesMeta(ctx, id, version any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAgentVariablesMeta", reflect.TypeOf((*MockVariablesMetaGetter)(nil).GetAgentVariablesMeta), ctx, id, version)
|
||||
}
|
||||
|
||||
// GetAppVariablesMeta mocks base method.
|
||||
func (m *MockVariablesMetaGetter) GetAppVariablesMeta(ctx context.Context, id, version string) (map[string]*vo.TypeInfo, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "GetAppVariablesMeta", ctx, id, version)
|
||||
ret0, _ := ret[0].(map[string]*vo.TypeInfo)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetAppVariablesMeta indicates an expected call of GetAppVariablesMeta.
|
||||
func (mr *MockVariablesMetaGetterMockRecorder) GetAppVariablesMeta(ctx, id, version any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAppVariablesMeta", reflect.TypeOf((*MockVariablesMetaGetter)(nil).GetAppVariablesMeta), ctx, id, version)
|
||||
}
|
||||
Reference in New Issue
Block a user