Skip to content

Commit 09942a6

Browse files
authored
fix(121): split inject state to separate file (#123)
Signed-off-by: lsytj0413 <511121939@qq.com> Signed-off-by: lsytj0413 <511121939@qq.com>
1 parent 02fbe11 commit 09942a6

File tree

3 files changed

+30
-15
lines changed

3 files changed

+30
-15
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,4 @@ The `Workflow` structure then can be used in your application.
6464

6565
## Slack Channel
6666

67-
Join us at [CNCF Slack](https://communityinviter.com/apps/cloud-native/cncf), channel `#serverless-workflow-sdk` and say hello 🙋.
67+
Join us at [CNCF Slack](https://communityinviter.com/apps/cloud-native/cncf), channel `#serverless-workflow-sdk` and say hello 🙋.

model/inject_state.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 2022 The Serverless Workflow Specification Authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package model
16+
17+
// InjectState used to inject static data into state data input.
18+
type InjectState struct {
19+
BaseState
20+
// JSON object which can be set as states data input and can be manipulated via filters
21+
Data map[string]interface{} `json:"data" validate:"required,min=1"`
22+
// State specific timeouts
23+
Timeouts *InjectStateTimeout `json:"timeouts,omitempty"`
24+
}
25+
26+
// InjectStateTimeout defines timeout settings for inject state
27+
type InjectStateTimeout struct {
28+
StateExecTimeout *StateExecTimeout `json:"stateExecTimeout,omitempty"`
29+
}

model/states.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -136,20 +136,6 @@ func (s *BaseState) GetStateDataFilter() *StateDataFilter { return s.StateDataFi
136136
// GetMetadata ...
137137
func (s *BaseState) GetMetadata() *Metadata { return s.Metadata }
138138

139-
// InjectState ...
140-
type InjectState struct {
141-
BaseState
142-
// JSON object which can be set as states data input and can be manipulated via filters
143-
Data map[string]interface{} `json:"data" validate:"required,min=1"`
144-
// State specific timeouts
145-
Timeouts *InjectStateTimeout `json:"timeouts,omitempty"`
146-
}
147-
148-
// InjectStateTimeout ...
149-
type InjectStateTimeout struct {
150-
StateExecTimeout *StateExecTimeout `json:"stateExecTimeout,omitempty"`
151-
}
152-
153139
// BaseSwitchState ...
154140
type BaseSwitchState struct {
155141
BaseState

0 commit comments

Comments
 (0)