diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 09ac3c4..bfa44f4 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -9,7 +9,7 @@ jobs: fetch-depth: 2 - uses: actions/setup-go@v2 with: - go-version: '1.13' + go-version: '1.14' - name: Run coverage run: go test -race -coverprofile=coverage.txt -covermode=atomic - name: Upload coverage to Codecov diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index a1b6803..059bb2b 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -7,7 +7,7 @@ jobs: golangci: strategy: matrix: - go-version: [1.13, 1.14, 1.15, 1.16] + go-version: [1.14, 1.15, 1.16] name: lint runs-on: ubuntu-latest steps: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 94d0059..916487b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,7 +7,7 @@ jobs: test: strategy: matrix: - go-version: [1.13, 1.14, 1.15, 1.16] + go-version: [1.14, 1.15, 1.16] name: test runs-on: ubuntu-latest steps: diff --git a/README.md b/README.md index a1e7876..2301d9e 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Installation ----------- - go get github.com/citilinkru/camunda-client-go/v2 + go get github.com/citilinkru/camunda-client-go Usage ----------- @@ -70,7 +70,7 @@ logger := func(err error) { fmt.Println(err.Error()) } asyncResponseTimeout := 5000 -proc := processor.NewProcessor(client, &processor.ProcessorOptions{ +proc := processor.NewProcessor(client, &processor.Options{ WorkerId: "demo-worker", LockDuration: time.Second * 5, MaxTasks: 10, @@ -82,7 +82,7 @@ proc := processor.NewProcessor(client, &processor.ProcessorOptions{ Add and subscribe external task handler: ```go proc.AddHandler( - &[]camunda_client_go.QueryFetchAndLockTopic{ + []*camunda_client_go.QueryFetchAndLockTopic{ {TopicName: "HelloWorldSetter"}, }, func(ctx *processor.Context) error { @@ -136,7 +136,7 @@ go test -v -race ./... Run linter: ```bash -docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.40 golangci-lint run -v +docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.42.0 golangci-lint run -v ``` Integration tests: diff --git a/client_integration_test.go b/client_integration_test.go index dabd24b..d12a67b 100644 --- a/client_integration_test.go +++ b/client_integration_test.go @@ -26,7 +26,7 @@ func init() { file, err := os.Open("examples/deployment/HelloWorld.bpmn") if err != nil { fmt.Printf("Error read file: %s\n", err) - os.Exit(1) + return } _, err = client.Deployment.Create(ReqDeploymentCreate{ DeploymentName: "HelloWorldProcessDemo", @@ -36,6 +36,6 @@ func init() { }) if err != nil { fmt.Printf("Error deploy process: %s\n", err) - os.Exit(1) + return } } diff --git a/examples/deployment/deployment.go b/examples/deployment/deployment.go index 5a6740e..0a54271 100644 --- a/examples/deployment/deployment.go +++ b/examples/deployment/deployment.go @@ -2,7 +2,7 @@ package main import ( "fmt" - camundaclientgo "github.com/citilinkru/camunda-client-go/v2" + camundaclientgo "github.com/citilinkru/camunda-client-go" "os" "time" ) diff --git a/examples/history/processinstance.go b/examples/history/processinstance.go index 08d3624..508de51 100644 --- a/examples/history/processinstance.go +++ b/examples/history/processinstance.go @@ -3,7 +3,7 @@ package main import ( "flag" "fmt" - camundaclientgo "github.com/citilinkru/camunda-client-go/v2" + camundaclientgo "github.com/citilinkru/camunda-client-go" "os" "time" ) diff --git a/examples/process-instance/getprocessinstance.go b/examples/process-instance/getprocessinstance.go index 771b436..65217a6 100644 --- a/examples/process-instance/getprocessinstance.go +++ b/examples/process-instance/getprocessinstance.go @@ -4,7 +4,7 @@ import ( "fmt" "time" - camundaclientgo "github.com/citilinkru/camunda-client-go/v2" + camundaclientgo "github.com/citilinkru/camunda-client-go" ) func main() { diff --git a/examples/processor/processor.go b/examples/processor/processor.go index 0396bdb..092b3f2 100644 --- a/examples/processor/processor.go +++ b/examples/processor/processor.go @@ -2,8 +2,8 @@ package main import ( "fmt" - camundaclientgo "github.com/citilinkru/camunda-client-go/v2" - "github.com/citilinkru/camunda-client-go/v2/processor" + camundaclientgo "github.com/citilinkru/camunda-client-go" + "github.com/citilinkru/camunda-client-go/processor" "time" ) @@ -18,7 +18,7 @@ func main() { logger := func(err error) { fmt.Println(err.Error()) } - proc := processor.NewProcessor(client, &processor.ProcessorOptions{ + proc := processor.NewProcessor(client, &processor.Options{ WorkerId: "hello-world-worker", LockDuration: time.Second * 5, MaxTasks: 10, @@ -27,7 +27,7 @@ func main() { }, logger) proc.AddHandler( - &[]camundaclientgo.QueryFetchAndLockTopic{ + []*camundaclientgo.QueryFetchAndLockTopic{ {TopicName: "PrintHello"}, }, func(ctx *processor.Context) error { @@ -51,7 +51,7 @@ func main() { ) proc.AddHandler( - &[]camundaclientgo.QueryFetchAndLockTopic{ + []*camundaclientgo.QueryFetchAndLockTopic{ {TopicName: "PrintWorld"}, }, func(ctx *processor.Context) error { diff --git a/examples/start-process/start-process.go b/examples/start-process/start-process.go index ee38026..45d050e 100644 --- a/examples/start-process/start-process.go +++ b/examples/start-process/start-process.go @@ -2,7 +2,7 @@ package main import ( "fmt" - camundaclientgo "github.com/citilinkru/camunda-client-go/v2" + camundaclientgo "github.com/citilinkru/camunda-client-go" "time" ) diff --git a/examples/user-task/complete.go b/examples/user-task/complete.go index a7f3bb4..6a4c071 100644 --- a/examples/user-task/complete.go +++ b/examples/user-task/complete.go @@ -2,7 +2,7 @@ package main import ( "fmt" - camundaclientgo "github.com/citilinkru/camunda-client-go/v2" + camundaclientgo "github.com/citilinkru/camunda-client-go" "os" "time" ) diff --git a/external-task.go b/external-task.go index 2ce0413..90b880f 100644 --- a/external-task.go +++ b/external-task.go @@ -77,7 +77,7 @@ type QueryGetListPost struct { // Filter by the id of the activity that an external task is created for ActivityId *string `json:"activityId,omitempty"` // Filter by the comma-separated list of ids of the activities that an external task is created for - ActivityIdIn *[]string `json:"activityIdIn,omitempty"` + ActivityIdIn []string `json:"activityIdIn,omitempty"` // Filter by the id of the execution that an external task belongs to ExecutionId *string `json:"executionId,omitempty"` // Filter by the id of the process instance that an external task belongs to @@ -85,7 +85,7 @@ type QueryGetListPost struct { // Filter by the id of the process definition that an external task belongs to ProcessDefinitionId *string `json:"processDefinitionId,omitempty"` // Filter by a comma-separated list of tenant ids. An external task must have one of the given tenant ids - TenantIdIn *[]string `json:"tenantIdIn,omitempty"` + TenantIdIn []string `json:"tenantIdIn,omitempty"` // Only include active tasks. Value may only be true, as false matches any external task Active *bool `json:"active,omitempty"` // Only include suspended tasks. Value may only be true, as false matches any external task @@ -114,7 +114,7 @@ type QueryFetchAndLock struct { AsyncResponseTimeout *int `json:"asyncResponseTimeout,omitempty"` // A JSON array of topic objects for which external tasks should be fetched. // The returned tasks may be arbitrarily distributed among these topics - Topics *[]QueryFetchAndLockTopic `json:"topics,omitempty"` + Topics []*QueryFetchAndLockTopic `json:"topics,omitempty"` } // QueryFetchAndLockTopic a JSON array of topic objects for which external tasks should be fetched @@ -126,7 +126,7 @@ type QueryFetchAndLockTopic struct { // A JSON array of String values that represent variable names. For each result task belonging to this topic, // the given variables are returned as well if they are accessible from the external task's execution. // If not provided - all variables will be fetched - Variables *[]string `json:"variables,omitempty"` + Variables []string `json:"variables,omitempty"` // If true only local variables will be fetched LocalVariables *bool `json:"localVariables,omitempty"` // A String value which enables the filtering of tasks based on process instance business key @@ -134,7 +134,7 @@ type QueryFetchAndLockTopic struct { // Filter tasks based on process definition id ProcessDefinitionId *string `json:"processDefinitionId,omitempty"` // Filter tasks based on process definition ids - ProcessDefinitionIdIn *[]string `json:"processDefinitionIdIn,omitempty"` + ProcessDefinitionIdIn []string `json:"processDefinitionIdIn,omitempty"` // Filter tasks based on process definition key ProcessDefinitionKey *string `json:"processDefinitionKey,omitempty"` // Filter tasks based on process definition keys diff --git a/external-task_integration_test.go b/external-task_integration_test.go index 779c2f5..500ea73 100644 --- a/external-task_integration_test.go +++ b/external-task_integration_test.go @@ -30,12 +30,12 @@ func TestFetchAndLockIntegration(t *testing.T) { assert.NoError(t, err) // wait processing StartInstance in camunda - time.Sleep(time.Second * 10) + time.Sleep(time.Second * 15) tasks, err := client.ExternalTask.FetchAndLock(QueryFetchAndLock{ WorkerId: "test-fetch-and-lock-integration", MaxTasks: 10, - Topics: &[]QueryFetchAndLockTopic{ + Topics: []*QueryFetchAndLockTopic{ { LockDuration: 1000, TopicName: "PrintHello", @@ -53,7 +53,7 @@ func TestFetchAndLockIntegration(t *testing.T) { tasks, err = client.ExternalTask.FetchAndLock(QueryFetchAndLock{ WorkerId: "test-fetch-and-lock-integration", MaxTasks: 10, - Topics: &[]QueryFetchAndLockTopic{ + Topics: []*QueryFetchAndLockTopic{ { LockDuration: 1000, TopicName: "PrintHello", diff --git a/go.mod b/go.mod index f293681..4360bc4 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/citilinkru/camunda-client-go/v2 +module github.com/citilinkru/camunda-client-go go 1.14 diff --git a/history.go b/history.go index c42ec87..f7d3ccf 100644 --- a/history.go +++ b/history.go @@ -12,7 +12,7 @@ type ReqHistoryProcessInstanceQuery struct { // Filter by process instance id. ProcessInstanceId *string `json:"processInstanceId"` // Filter by a list of process instance ids. Must be a JSON array of Strings. - ProcessInstanceIds *[]string `json:"processInstanceIds"` + ProcessInstanceIds []string `json:"processInstanceIds"` // Filter by process instance business key. BusinessKey *string `json:"processInstanceBusinessKey"` // Filter by process instance business key that the parameter is a substring of. @@ -25,10 +25,10 @@ type ReqHistoryProcessInstanceQuery struct { ProcessDefinitionKey *string `json:"processDefinitionKey"` // Filter by a list of process definition keys. A process instance must have one of the // given process definition keys. Must be a JSON array of Strings. - ProcessDefinitionKeyIn *[]string `json:"processDefinitionKeyIn"` + ProcessDefinitionKeyIn []string `json:"processDefinitionKeyIn"` // Exclude instances by a list of process definition keys. A process instance must not have one of the // given process definition keys. Must be a JSON array of Strings. - ProcessDefinitionKeyNotIn *[]string `json:"processDefinitionKeyNotIn"` + ProcessDefinitionKeyNotIn []string `json:"processDefinitionKeyNotIn"` // Filter by the name of the process definition the instances run on. ProcessDefinitionName *string `json:"processDefinitionName"` // Filter by process definition names that the parameter is a substring of. @@ -75,13 +75,13 @@ type ReqHistoryProcessInstanceQuery struct { IncidentMessageLike *string `json:"incidentMessageLike"` // Filter by a list of tenant ids. A process instance must have one of the given tenant ids. // Must be a JSON array of Strings. - TenantIdIn *[]string `json:"tenantIdIn"` + TenantIdIn []string `json:"tenantIdIn"` // Only include process instances which belong to no tenant. Value may only be true, as false is the default behavior. WithoutTenantId *bool `json:"withoutTenantId"` // Filter by a list of activity ids. A process instance must currently wait in a leaf activity with one of the given activity ids. - ActivityIdIn *[]string `json:"activityIdIn"` + ActivityIdIn []string `json:"activityIdIn"` // Restrict to instance that executed an activity with one of given ids. - ExecutedActivityIdIn *[]string `json:"executedActivityIdIn"` + ExecutedActivityIdIn []string `json:"executedActivityIdIn"` // Restrict the query to all process instances that are top level process instances. RootProcessInstances *bool `json:"rootProcessInstances"` // Restrict the query to all process instances that are leaf instances. (i.e. don't have any sub instances) @@ -89,7 +89,7 @@ type ReqHistoryProcessInstanceQuery struct { // Only include process instances which process definition has no tenant id. ProcessDefinitionWithoutTenantId *bool `json:"processDefinitionWithoutTenantId"` // A JSON array to only include process instances that have variables with certain values. - Variables *[]ReqProcessVariableQuery `json:"variables"` + Variables []ReqProcessVariableQuery `json:"variables"` // Match all variable names in this query case-insensitively. // If set to true variable-Name and variable-name are treated as equal. VariableNamesIgnoreCase *bool `json:"variableNamesIgnoreCase"` @@ -100,11 +100,11 @@ type ReqHistoryProcessInstanceQuery struct { // A process instance matches a nested query if it fulfills at least one of the query's predicates. // With multiple nested queries, a process instance must fulfill at least one predicate of each query. // All process instance query properties can be used except for: sorting. - OrQueries *[]ReqProcessInstanceQuery `json:"orQueries"` + OrQueries []ReqProcessInstanceQuery `json:"orQueries"` // A JSON array of criteria to sort the result by. // Each element of the array is a JSON object that specifies one ordering. // The position in the array identifies the rank of an ordering, i.e., whether it is primary, secondary, etc. - Sorting *[]ReqSort `json:"sorting"` + Sorting []ReqSort `json:"sorting"` // Restrict to instance that was started before the given date. // By default, the date must have the format yyyy-MM-dd'T'HH:mm:ss.SSSZ, e.g., 2013-01-23T14:42:45.000+0200. StartedBefore *string `json:"startedBefore"` @@ -135,7 +135,7 @@ type ReqHistoryProcessInstanceQuery struct { // or an empty request body) type ReqHistoryDeleteProcessInstance struct { // A list process instance ids to delete. - HistoricProcessInstanceIds *[]string `json:"historicProcessInstanceIds,omitempty"` + HistoricProcessInstanceIds []string `json:"historicProcessInstanceIds,omitempty"` // A process instance query HistoricProcessInstanceQuery *ReqProcessInstanceQuery `json:"historicProcessInstanceQuery,omitempty"` // A string with delete reason. @@ -149,15 +149,15 @@ type ReqHistoryVariableInstanceQuery struct { VariableNameLike *string `json:"variableNameLike"` VariableValue interface{} `json:"variableValue"` ProcessInstanceId *string `json:"processInstanceId"` - ProcessInstanceIdIn *[]string `json:"processInstanceIdIn"` + ProcessInstanceIdIn []string `json:"processInstanceIdIn"` ProcessDefinitionId *string `json:"process_definition_id"` - ExecutionIdIn *[]string `json:"executionIdIn"` + ExecutionIdIn []string `json:"executionIdIn"` CaseInstanceId *string `json:"caseInstanceId"` - CaseExecutionIdIn *[]string `json:"caseExecutionIdIn"` - CaseActivityIdIn *[]string `json:"caseActivityIdIn"` - TaskIdIn *[]string `json:"taskIdIn"` - ActivityInstanceIdIn *[]string `json:"activityInstanceIdIn"` - TenantIdIn *[]string `json:"tenantIdIn"` + CaseExecutionIdIn []string `json:"caseExecutionIdIn"` + CaseActivityIdIn []string `json:"caseActivityIdIn"` + TaskIdIn []string `json:"taskIdIn"` + ActivityInstanceIdIn []string `json:"activityInstanceIdIn"` + TenantIdIn []string `json:"tenantIdIn"` } // ResHistoryProcessInstance a response object for process instance diff --git a/process-definition.go b/process-definition.go index b889201..24bae2d 100644 --- a/process-definition.go +++ b/process-definition.go @@ -88,7 +88,7 @@ type ReqStartInstance struct { CaseInstanceId *string `json:"caseInstanceId,omitempty"` // Optional. A JSON array of instructions that specify which activities to start the process instance at. // If this property is omitted, the process instance starts at its default blank start event - StartInstructions *[]ReqStartInstructions `json:"startInstructions,omitempty"` + StartInstructions []ReqStartInstructions `json:"startInstructions,omitempty"` // Skip execution listener invocation for activities that are started or ended as part of this request // Note: This option is currently only respected when start instructions are submitted via // the startInstructions property @@ -109,7 +109,7 @@ type ReqRestartInstance struct { HistoricProcessInstanceQuery *string `json:"historicProcessInstanceQuery,omitempty"` // Optional. A JSON array of instructions that specify which activities to start the process instance at. // If this property is omitted, the process instance starts at its default blank start event - StartInstructions *[]ReqStartInstructions `json:"startInstructions,omitempty"` + StartInstructions []ReqStartInstructions `json:"startInstructions,omitempty"` // Skip execution listener invocation for activities that are started or ended as part of this request // Note: This option is currently only respected when start instructions are submitted via // the startInstructions property diff --git a/process-instance.go b/process-instance.go index 3f73e38..4b2f23d 100644 --- a/process-instance.go +++ b/process-instance.go @@ -45,7 +45,7 @@ type ReqModifyProcessVariables struct { // A JSON object containing variable key-value pairs. Each key is a variable name and each value a JSON. Modifications *map[string]ReqProcessVariable `json:"modifications,omitempty"` // An array of String keys of variables to be deleted. - Deletions *[]string `json:"deletions,omitempty"` + Deletions []string `json:"deletions,omitempty"` } // ReqModifyProcessInstanceInstruction a JSON object with the following properties: (at least an empty JSON object {} @@ -78,7 +78,7 @@ type ReqModifyProcessInstanceInstruction struct { // Can be used with instructions of type startBeforeActivity, startAfterActivity, and startTransition. // A JSON object containing variable key-value pairs. // Each key is a variable name and each value a JSON variable value object. - Variables *[]ReqProcessVariable `json:"variables"` + Variables []ReqProcessVariable `json:"variables"` } // ReqModifyProcessInstance a JSON object with the following properties: (at least an empty JSON object {} @@ -89,7 +89,7 @@ type ReqModifyProcessInstance struct { // Skip execution of input/output variable mappings for activities that are started or ended as part of this request. SkipIOMappings *bool `json:"skipIoMappings"` // A JSON array of modification instructions. The instructions are executed in the order they are in. - Instructions *[]ReqModifyProcessInstanceInstruction `json:"instructions"` + Instructions []ReqModifyProcessInstanceInstruction `json:"instructions"` // An arbitrary text annotation set by a user for auditing reasons. Annotation *string `json:"annotation"` } @@ -110,7 +110,7 @@ type ReqProcessVariableQuery struct { // or an empty request body) type ReqProcessInstanceQuery struct { // Filter by a list of process instance ids. Must be a JSON array of Strings. - ProcessInstanceIds *[]string `json:"processInstanceIds"` + ProcessInstanceIds []string `json:"processInstanceIds"` // Filter by process instance business key. BusinessKey *string `json:"businessKey"` // Filter by process instance business key that the parameter is a substring of. @@ -123,10 +123,10 @@ type ReqProcessInstanceQuery struct { ProcessDefinitionKey *string `json:"processDefinitionKey"` // Filter by a list of process definition keys. A process instance must have one of the // given process definition keys. Must be a JSON array of Strings. - ProcessDefinitionKeyIn *[]string `json:"processDefinitionKeyIn"` + ProcessDefinitionKeyIn []string `json:"processDefinitionKeyIn"` // Exclude instances by a list of process definition keys. A process instance must not have one of the // given process definition keys. Must be a JSON array of Strings. - ProcessDefinitionKeyNotIn *[]string `json:"processDefinitionKeyNotIn"` + ProcessDefinitionKeyNotIn []string `json:"processDefinitionKeyNotIn"` // Filter by the deployment the id belongs to. DeploymentId *string `json:"deploymentId"` // Restrict query to all process instances that are sub process instances of the given process instance. @@ -157,11 +157,11 @@ type ReqProcessInstanceQuery struct { IncidentMessageLike *string `json:"incidentMessageLike"` // Filter by a list of tenant ids. A process instance must have one of the given tenant ids. // Must be a JSON array of Strings. - TenantIdIn *[]string `json:"tenantIdIn"` + TenantIdIn []string `json:"tenantIdIn"` // Only include process instances which belong to no tenant. Value may only be true, as false is the default behavior. WithoutTenantId *bool `json:"withoutTenantId"` // Filter by a list of activity ids. A process instance must currently wait in a leaf activity with one of the given activity ids. - ActivityIdIn *[]string `json:"activityIdIn"` + ActivityIdIn []string `json:"activityIdIn"` // Restrict the query to all process instances that are top level process instances. RootProcessInstances *bool `json:"rootProcessInstances"` // Restrict the query to all process instances that are leaf instances. (i.e. don't have any sub instances) @@ -169,7 +169,7 @@ type ReqProcessInstanceQuery struct { // Only include process instances which process definition has no tenant id. ProcessDefinitionWithoutTenantId *bool `json:"processDefinitionWithoutTenantId"` // A JSON array to only include process instances that have variables with certain values. - Variables *[]ReqProcessVariableQuery `json:"variables"` + Variables []ReqProcessVariableQuery `json:"variables"` // Match all variable names in this query case-insensitively. // If set to true variable-Name and variable-name are treated as equal. VariableNamesIgnoreCase *bool `json:"variableNamesIgnoreCase"` @@ -180,18 +180,18 @@ type ReqProcessInstanceQuery struct { // A process instance matches a nested query if it fulfills at least one of the query's predicates. // With multiple nested queries, a process instance must fulfill at least one predicate of each query. // All process instance query properties can be used except for: sorting. - OrQueries *[]ReqProcessInstanceQuery `json:"orQueries"` + OrQueries []ReqProcessInstanceQuery `json:"orQueries"` // A JSON array of criteria to sort the result by. // Each element of the array is a JSON object that specifies one ordering. // The position in the array identifies the rank of an ordering, i.e., whether it is primary, secondary, etc. - Sorting *[]ReqSort `json:"sorting"` + Sorting []ReqSort `json:"sorting"` } // ReqDeleteProcessInstance a JSON object with the following properties: (at least an empty JSON object {} // or an empty request body) type ReqDeleteProcessInstance struct { // A list process instance ids to delete. - ProcessInstanceIds *[]string `json:"processInstanceIds"` + ProcessInstanceIds []string `json:"processInstanceIds"` // A process instance query ProcessInstanceQuery *ReqProcessInstanceQuery `json:"processInstanceQuery"` // A string with delete reason. @@ -208,7 +208,7 @@ type ReqDeleteProcessInstance struct { // or an empty request body) type ReqDeleteHistoryProcessInstance struct { // A list process instance ids to delete. - ProcessInstanceIds *[]string `json:"processInstanceIds"` + ProcessInstanceIds []string `json:"processInstanceIds"` // A historic process instance query HistoricProcessInstanceQuery *ReqHistoryProcessInstanceQuery `json:"historicProcessInstanceQuery"` // A string with delete reason. @@ -225,7 +225,7 @@ type ReqDeleteHistoryProcessInstance struct { // or an empty request body) type ReqProcessInstanceJobRetries struct { // A list of process instance ids to fetch jobs, for which retries will be set. - ProcessInstances *[]string `json:"processInstances"` + ProcessInstances []string `json:"processInstances"` // A process instance query ProcessInstanceQuery *ReqProcessInstanceQuery `json:"processInstanceQuery"` // An integer representing the number of retries. Please note that the value cannot be negative or null. @@ -236,7 +236,7 @@ type ReqProcessInstanceJobRetries struct { // or an empty request body) type ReqHistoricProcessInstanceJobRetries struct { // A list of process instance ids to fetch jobs, for which retries will be set. - ProcessInstances *[]string `json:"processInstances"` + ProcessInstances []string `json:"processInstances"` // A process instance query HistoricProcessInstanceQuery *ReqHistoryProcessInstanceQuery `json:"historicProcessInstanceQuery"` // An integer representing the number of retries. Please note that the value cannot be negative or null. @@ -247,7 +247,7 @@ type ReqHistoricProcessInstanceJobRetries struct { // or an empty request body) type ReqProcessInstanceVariables struct { // A list process instance ids to delete. - ProcessInstanceIds *[]string `json:"processInstanceIds"` + ProcessInstanceIds []string `json:"processInstanceIds"` // A process instance query ProcessInstanceQuery *ReqProcessInstanceQuery `json:"processInstanceQuery"` // A historic process instance query @@ -261,7 +261,7 @@ type ReqProcessInstanceVariables struct { // or an empty request body) type ReqProcessInstanceActivateSuspend struct { // A list process instance ids to delete. - ProcessInstanceIds *[]string `json:"processInstanceIds"` + ProcessInstanceIds []string `json:"processInstanceIds"` // A process instance query ProcessInstanceQuery *ReqProcessInstanceQuery `json:"processInstanceQuery"` // A historic process instance query diff --git a/processor/processor.go b/processor/processor.go index 37423aa..2c260c2 100644 --- a/processor/processor.go +++ b/processor/processor.go @@ -7,18 +7,18 @@ import ( "runtime/debug" "time" - camundaclientgo "github.com/citilinkru/camunda-client-go/v2" + camundaclientgo "github.com/citilinkru/camunda-client-go" ) // Processor external task processor type Processor struct { client *camundaclientgo.Client - options *ProcessorOptions + options *Options logger func(err error) } -// ProcessorOptions options for Processor -type ProcessorOptions struct { +// Options options for Processor +type Options struct { // workerId for all request (default: `worker-{random_int}`) WorkerId string // lock duration for all external task @@ -38,7 +38,7 @@ type ProcessorOptions struct { } // NewProcessor a create new instance Processor -func NewProcessor(client *camundaclientgo.Client, options *ProcessorOptions, logger func(err error)) *Processor { +func NewProcessor(client *camundaclientgo.Client, options *Options, logger func(err error)) *Processor { rand.Seed(time.Now().UnixNano()) if options.WorkerId == "" { // #nosec G404 This is valid for worker selection @@ -92,11 +92,9 @@ func (c *Context) HandleFailure(query QueryHandleFailure) error { } // AddHandler a add handler for external task -func (p *Processor) AddHandler(topics *[]camundaclientgo.QueryFetchAndLockTopic, handler Handler) { +func (p *Processor) AddHandler(topics []*camundaclientgo.QueryFetchAndLockTopic, handler Handler) { if topics != nil && p.options.LockDuration != 0 { - for i := range *topics { - v := &(*topics)[i] - + for _, v := range topics { if v.LockDuration <= 0 { v.LockDuration = int(p.options.LockDuration / time.Millisecond) } diff --git a/processor/processor_integration_test.go b/processor/processor_integration_test.go index 80e479e..9c43eee 100644 --- a/processor/processor_integration_test.go +++ b/processor/processor_integration_test.go @@ -4,7 +4,7 @@ package processor import ( "fmt" - camundaclientgo "github.com/citilinkru/camunda-client-go/v2" + camundaclientgo "github.com/citilinkru/camunda-client-go" "github.com/stretchr/testify/assert" "os" "testing" @@ -44,7 +44,7 @@ func init() { } func TestComplete(t *testing.T) { - proc := NewProcessor(client, &ProcessorOptions{ + proc := NewProcessor(client, &Options{ WorkerId: "hello-world-worker", LockDuration: time.Second * 5, MaxTasks: 10, @@ -66,7 +66,7 @@ func TestComplete(t *testing.T) { done := make(chan bool) proc.AddHandler( - &[]camundaclientgo.QueryFetchAndLockTopic{ + []*camundaclientgo.QueryFetchAndLockTopic{ {TopicName: "PrintHello"}, }, func(ctx *Context) error { diff --git a/processor/types.go b/processor/types.go index 130eff7..662acc0 100644 --- a/processor/types.go +++ b/processor/types.go @@ -1,6 +1,6 @@ package processor -import "github.com/citilinkru/camunda-client-go/v2" +import "github.com/citilinkru/camunda-client-go" // QueryComplete a query for Complete request type QueryComplete struct {